setwd("C:/Users/lhomm/OneDrive/Documents/R")
library(asbio)
## Loading required package: tcltk
library(car)
## Loading required package: carData
Dat <- read.table("http://users.stat.ufl.edu/~rrandles/sta4210/Rclassnotes/data/textdatasets/KutnerData/Chapter%2020%20Data%20Sets/CH20PR05.txt")
colnames(Dat) <- c("Ideas", "Group", "Size")
Dat$Group <- factor(Dat$Group)
Dat$Size <- factor(Dat$Size)
### The Model Y_ij = Mu + ALphai + Beta_2 +DAlpha_iBeta_j + Epsilon_ij. ###
### Ho: D equals 0 H1: D does not equal 0. ###
Decsion_Rule <- qf(0.01, 1, 2, lower.tail=FALSE) ### Decision Rule ###
Decsion_Rule
## [1] 98.50251
Add1 <- tukey.add.test(Dat$Ideas, Dat$Group, Dat$Size)
Add1
## 
## Tukey's one df test for additivity 
## F = 0.5987716   Denom df = 2    p-value = 0.5199941
### With an F-Value well below our decision rule and a P-Val larger than .1/.05/.01 we fail to reject Ho that D equals 0. ###

### To remediate we can try transofrmations. ###
IdeasLog <- log(Dat$Ideas)
Add2 <- tukey.add.test(IdeasLog, Dat$Group, Dat$Size)
Add2
## 
## Tukey's one df test for additivity 
## F = 1.5349516   Denom df = 2    p-value = 0.3410452
IdeasSqrt <- sqrt(Dat$Ideas)
Add3 <- tukey.add.test(IdeasSqrt, Dat$Group, Dat$Size)
Add3
## 
## Tukey's one df test for additivity 
## F = 0.9833965   Denom df = 2    p-value = 0.4258719
Ideas1Over <- 1/Dat$Ideas 
Add4 <- tukey.add.test(Ideas1Over, Dat$Group, Dat$Size)
Add4
## 
## Tukey's one df test for additivity 
## F = 3.3169367   Denom df = 2    p-value = 0.2101623
### None of the transformations managed to correct the error and produce a large enough F-Statistic or a small enough P-value although it does seem that the 1 over transformation was the most effective. ###
Dat2 <- read.table("http://users.stat.ufl.edu/~rrandles/sta4210/Rclassnotes/data/textdatasets/KutnerData/Chapter%2019%20Data%20Sets/CH19PR14.txt")
colnames(Dat2) <- c("Relief", "Compound1", "Compound2", "Count")
Dat2$Compound1 <- factor(Dat2$Compound1)
Dat2$Compound2 <- factor(Dat2$Compound2)
Relieflm <- lm(Relief ~ Compound1 * Compound2, data = Dat2)
Relieflm
## 
## Call:
## lm(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## Coefficients:
##           (Intercept)             Compound12             Compound13  
##                 2.475                  2.975                  3.500  
##            Compound22             Compound23  Compound12:Compound22  
##                 2.125                  2.100                  1.350  
## Compound13:Compound22  Compound12:Compound23  Compound13:Compound23  
##                 2.175                  1.575                  5.175
summary(Relieflm)
## 
## Call:
## lm(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.4250 -0.1750  0.0125  0.1875  0.3500 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             2.4750     0.1227  20.177  < 2e-16 ***
## Compound12              2.9750     0.1735  17.150 4.82e-16 ***
## Compound13              3.5000     0.1735  20.176  < 2e-16 ***
## Compound22              2.1250     0.1735  12.250 1.55e-12 ***
## Compound23              2.1000     0.1735  12.106 2.03e-12 ***
## Compound12:Compound22   1.3500     0.2453   5.503 7.91e-06 ***
## Compound13:Compound22   2.1750     0.2453   8.866 1.76e-09 ***
## Compound12:Compound23   1.5750     0.2453   6.420 7.05e-07 ***
## Compound13:Compound23   5.1750     0.2453  21.094  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2453 on 27 degrees of freedom
## Multiple R-squared:  0.9957, Adjusted R-squared:  0.9944 
## F-statistic: 774.9 on 8 and 27 DF,  p-value: < 2.2e-16
### Alphaihat estimates the main effect of compound1. ###
Anova1 <- aov(Relief ~ Compound1 * Compound2, data = Dat2)
Anova1
## Call:
##    aov(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## Terms:
##                 Compound1 Compound2 Compound1:Compound2 Residuals
## Sum of Squares    220.020   123.660              29.425     1.625
## Deg. of Freedom         2         2                   4        27
## 
## Residual standard error: 0.2453267
## Estimated effects may be unbalanced
summary(Anova1)
##                     Df Sum Sq Mean Sq F value Pr(>F)    
## Compound1            2 220.02  110.01  1827.9 <2e-16 ***
## Compound2            2 123.66   61.83  1027.3 <2e-16 ***
## Compound1:Compound2  4  29.43    7.36   122.2 <2e-16 ***
## Residuals           27   1.63    0.06                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Anova2 <- Anova(Anova1, type = "III")
Anova2
## Anova Table (Type III tests)
## 
## Response: Relief
##                     Sum Sq Df F value    Pr(>F)    
## (Intercept)         24.503  1 407.118 < 2.2e-16 ***
## Compound1           28.502  2 236.783 < 2.2e-16 ***
## Compound2           11.902  2  98.875 3.762e-13 ***
## Compound1:Compound2 29.425  4 122.227 < 2.2e-16 ***
## Residuals            1.625 27                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(Anova2)
##      Sum Sq             Df          F value           Pr(>F) 
##  Min.   : 1.625   Min.   : 1.0   Min.   : 98.88   Min.   :0  
##  1st Qu.:11.902   1st Qu.: 2.0   1st Qu.:116.39   1st Qu.:0  
##  Median :24.503   Median : 2.0   Median :179.50   Median :0  
##  Mean   :19.191   Mean   : 7.2   Mean   :216.25   Mean   :0  
##  3rd Qu.:28.502   3rd Qu.: 4.0   3rd Qu.:279.37   3rd Qu.:0  
##  Max.   :29.425   Max.   :27.0   Max.   :407.12   Max.   :0  
##                                  NA's   :1        NA's   :1
### While the F-values and the sums of squares for compount 1 and 2 differ between tests the conclusions are fundamentally the same. Both tests have large F-values and P-values all below .01 so in both cases we conclude that there is signifigant interaction between compound 1 and 2. 
Decsion_Rule <- qf(0.05, 1, 2, lower.tail=FALSE) ### Decision Rule ###
Decsion_Rule
## [1] 18.51282
### Ho: There is no interaction between Compound 1 and Compound 2 in the model. ####
### H1: There is interaction between Compound 1 and Compound 2 in the model. ###

### Ho: Compound1 equals 0. ###
### H1: Compound1 does not equal 0. ###

### Ho: Compound2 equals 0. ###
### H1: Compound2 does not equal 0. ###

Anova1
## Call:
##    aov(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## Terms:
##                 Compound1 Compound2 Compound1:Compound2 Residuals
## Sum of Squares    220.020   123.660              29.425     1.625
## Deg. of Freedom         2         2                   4        27
## 
## Residual standard error: 0.2453267
## Estimated effects may be unbalanced
summary(Anova1)
##                     Df Sum Sq Mean Sq F value Pr(>F)    
## Compound1            2 220.02  110.01  1827.9 <2e-16 ***
## Compound2            2 123.66   61.83  1027.3 <2e-16 ***
## Compound1:Compound2  4  29.43    7.36   122.2 <2e-16 ***
## Residuals           27   1.63    0.06                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Interaction1_C1XC2_Comparison <- TukeyHSD(Anova1, which = ("Compound1:Compound2"))
Interaction1_C1XC2_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## $`Compound1:Compound2`
##           diff        lwr        upr     p adj
## 2:1-1:1  2.975  2.3913187  3.5586813 0.0000000
## 3:1-1:1  3.500  2.9163187  4.0836813 0.0000000
## 1:2-1:1  2.125  1.5413187  2.7086813 0.0000000
## 2:2-1:1  6.450  5.8663187  7.0336813 0.0000000
## 3:2-1:1  7.800  7.2163187  8.3836813 0.0000000
## 1:3-1:1  2.100  1.5163187  2.6836813 0.0000000
## 2:3-1:1  6.650  6.0663187  7.2336813 0.0000000
## 3:3-1:1 10.775 10.1913187 11.3586813 0.0000000
## 3:1-2:1  0.525 -0.0586813  1.1086813 0.1033088
## 1:2-2:1 -0.850 -1.4336813 -0.2663187 0.0011424
## 2:2-2:1  3.475  2.8913187  4.0586813 0.0000000
## 3:2-2:1  4.825  4.2413187  5.4086813 0.0000000
## 1:3-2:1 -0.875 -1.4586813 -0.2913187 0.0007862
## 2:3-2:1  3.675  3.0913187  4.2586813 0.0000000
## 3:3-2:1  7.800  7.2163187  8.3836813 0.0000000
## 1:2-3:1 -1.375 -1.9586813 -0.7913187 0.0000005
## 2:2-3:1  2.950  2.3663187  3.5336813 0.0000000
## 3:2-3:1  4.300  3.7163187  4.8836813 0.0000000
## 1:3-3:1 -1.400 -1.9836813 -0.8163187 0.0000004
## 2:3-3:1  3.150  2.5663187  3.7336813 0.0000000
## 3:3-3:1  7.275  6.6913187  7.8586813 0.0000000
## 2:2-1:2  4.325  3.7413187  4.9086813 0.0000000
## 3:2-1:2  5.675  5.0913187  6.2586813 0.0000000
## 1:3-1:2 -0.025 -0.6086813  0.5586813 1.0000000
## 2:3-1:2  4.525  3.9413187  5.1086813 0.0000000
## 3:3-1:2  8.650  8.0663187  9.2336813 0.0000000
## 3:2-2:2  1.350  0.7663187  1.9336813 0.0000007
## 1:3-2:2 -4.350 -4.9336813 -3.7663187 0.0000000
## 2:3-2:2  0.200 -0.3836813  0.7836813 0.9596929
## 3:3-2:2  4.325  3.7413187  4.9086813 0.0000000
## 1:3-3:2 -5.700 -6.2836813 -5.1163187 0.0000000
## 2:3-3:2 -1.150 -1.7336813 -0.5663187 0.0000131
## 3:3-3:2  2.975  2.3913187  3.5586813 0.0000000
## 2:3-1:3  4.550  3.9663187  5.1336813 0.0000000
## 3:3-1:3  8.675  8.0913187  9.2586813 0.0000000
## 3:3-2:3  4.125  3.5413187  4.7086813 0.0000000
Interaction1_All_Comparison <- TukeyHSD(Anova1)
Interaction1_All_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1 * Compound2, data = Dat2)
## 
## $Compound1
##     diff      lwr      upr p adj
## 2-1 3.95 3.701676 4.198324     0
## 3-1 5.95 5.701676 6.198324     0
## 3-2 2.00 1.751676 2.248324     0
## 
## $Compound2
##     diff       lwr      upr p adj
## 2-1 3.30 3.0516759 3.548324     0
## 3-1 4.35 4.1016759 4.598324     0
## 3-2 1.05 0.8016759 1.298324     0
## 
## $`Compound1:Compound2`
##           diff        lwr        upr     p adj
## 2:1-1:1  2.975  2.3913187  3.5586813 0.0000000
## 3:1-1:1  3.500  2.9163187  4.0836813 0.0000000
## 1:2-1:1  2.125  1.5413187  2.7086813 0.0000000
## 2:2-1:1  6.450  5.8663187  7.0336813 0.0000000
## 3:2-1:1  7.800  7.2163187  8.3836813 0.0000000
## 1:3-1:1  2.100  1.5163187  2.6836813 0.0000000
## 2:3-1:1  6.650  6.0663187  7.2336813 0.0000000
## 3:3-1:1 10.775 10.1913187 11.3586813 0.0000000
## 3:1-2:1  0.525 -0.0586813  1.1086813 0.1033088
## 1:2-2:1 -0.850 -1.4336813 -0.2663187 0.0011424
## 2:2-2:1  3.475  2.8913187  4.0586813 0.0000000
## 3:2-2:1  4.825  4.2413187  5.4086813 0.0000000
## 1:3-2:1 -0.875 -1.4586813 -0.2913187 0.0007862
## 2:3-2:1  3.675  3.0913187  4.2586813 0.0000000
## 3:3-2:1  7.800  7.2163187  8.3836813 0.0000000
## 1:2-3:1 -1.375 -1.9586813 -0.7913187 0.0000005
## 2:2-3:1  2.950  2.3663187  3.5336813 0.0000000
## 3:2-3:1  4.300  3.7163187  4.8836813 0.0000000
## 1:3-3:1 -1.400 -1.9836813 -0.8163187 0.0000004
## 2:3-3:1  3.150  2.5663187  3.7336813 0.0000000
## 3:3-3:1  7.275  6.6913187  7.8586813 0.0000000
## 2:2-1:2  4.325  3.7413187  4.9086813 0.0000000
## 3:2-1:2  5.675  5.0913187  6.2586813 0.0000000
## 1:3-1:2 -0.025 -0.6086813  0.5586813 1.0000000
## 2:3-1:2  4.525  3.9413187  5.1086813 0.0000000
## 3:3-1:2  8.650  8.0663187  9.2336813 0.0000000
## 3:2-2:2  1.350  0.7663187  1.9336813 0.0000007
## 1:3-2:2 -4.350 -4.9336813 -3.7663187 0.0000000
## 2:3-2:2  0.200 -0.3836813  0.7836813 0.9596929
## 3:3-2:2  4.325  3.7413187  4.9086813 0.0000000
## 1:3-3:2 -5.700 -6.2836813 -5.1163187 0.0000000
## 2:3-3:2 -1.150 -1.7336813 -0.5663187 0.0000131
## 3:3-3:2  2.975  2.3913187  3.5586813 0.0000000
## 2:3-1:3  4.550  3.9663187  5.1336813 0.0000000
## 3:3-1:3  8.675  8.0913187  9.2586813 0.0000000
## 3:3-2:3  4.125  3.5413187  4.7086813 0.0000000
### With an F-Value larger than our decision rule and a P-value smaller than .01 we can reject HO that there is no interaction and conclude that there is interaction in the model. We also see that all but 3 comparisons were signifigant at .05 and .01 and of those three one's P-value was nearly .1. These comparisons add extra weight to our conclusions and give us further insight into specific differences. ###

Additive1 <- aov(Relief ~ Compound1 + Compound2, data = Dat2) 
Additive1
## Call:
##    aov(formula = Relief ~ Compound1 + Compound2, data = Dat2)
## 
## Terms:
##                 Compound1 Compound2 Residuals
## Sum of Squares     220.02    123.66     31.05
## Deg. of Freedom         2         2        31
## 
## Residual standard error: 1.000806
## Estimated effects may be unbalanced
summary(Additive1)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Compound1    2 220.02  110.01  109.83 8.51e-15 ***
## Compound2    2 123.66   61.83   61.73 1.55e-11 ***
## Residuals   31  31.05    1.00                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Additive2 <- anova(lm(Relief ~ Compound1 + Compound2, data = Dat2))
Additive2
## Analysis of Variance Table
## 
## Response: Relief
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## Compound1  2 220.02 110.010  109.83 8.514e-15 ***
## Compound2  2 123.66  61.830   61.73 1.547e-11 ***
## Residuals 31  31.05   1.002                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(Additive2)
##        Df            Sum Sq          Mean Sq           F value      
##  Min.   : 2.00   Min.   : 31.05   Min.   :  1.002   Min.   : 61.73  
##  1st Qu.: 2.00   1st Qu.: 77.36   1st Qu.: 31.416   1st Qu.: 73.76  
##  Median : 2.00   Median :123.66   Median : 61.830   Median : 85.78  
##  Mean   :11.67   Mean   :124.91   Mean   : 57.614   Mean   : 85.78  
##  3rd Qu.:16.50   3rd Qu.:171.84   3rd Qu.: 85.920   3rd Qu.: 97.81  
##  Max.   :31.00   Max.   :220.02   Max.   :110.010   Max.   :109.83  
##                                                     NA's   :1       
##      Pr(>F) 
##  Min.   :0  
##  1st Qu.:0  
##  Median :0  
##  Mean   :0  
##  3rd Qu.:0  
##  Max.   :0  
##  NA's   :1
Additive1_C1_Comparison <- TukeyHSD(Additive1, which = ("Compound1"))
Additive1_C1_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1 + Compound2, data = Dat2)
## 
## $Compound1
##     diff       lwr      upr    p adj
## 2-1 3.95 2.9444139 4.955586 0.00e+00
## 3-1 5.95 4.9444139 6.955586 0.00e+00
## 3-2 2.00 0.9944139 3.005586 8.42e-05
Additive1_C2_Comparison <- TukeyHSD(Additive1, which = ("Compound2"))
Additive1_C2_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1 + Compound2, data = Dat2)
## 
## $Compound2
##     diff        lwr      upr     p adj
## 2-1 3.30 2.29441388 4.305586 0.0000000
## 3-1 4.35 3.34441388 5.355586 0.0000000
## 3-2 1.05 0.04441388 2.055586 0.0392554
Additive1_All_Comparison <- TukeyHSD(Additive1)
Additive1_All_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1 + Compound2, data = Dat2)
## 
## $Compound1
##     diff       lwr      upr    p adj
## 2-1 3.95 2.9444139 4.955586 0.00e+00
## 3-1 5.95 4.9444139 6.955586 0.00e+00
## 3-2 2.00 0.9944139 3.005586 8.42e-05
## 
## $Compound2
##     diff        lwr      upr     p adj
## 2-1 3.30 2.29441388 4.305586 0.0000000
## 3-1 4.35 3.34441388 5.355586 0.0000000
## 3-2 1.05 0.04441388 2.055586 0.0392554
### In the addative without interaction the F-values, P-values, and pariwise comparisons all demontrast that Compound 1 and 2 both have signifigant main effects on the number of hours of relief from hay fever the respondents experienced. ###

JustC11 <-  aov(Relief ~ Compound1, data = Dat2)
JustC11
## Call:
##    aov(formula = Relief ~ Compound1, data = Dat2)
## 
## Terms:
##                 Compound1 Residuals
## Sum of Squares     220.02    154.71
## Deg. of Freedom         2        33
## 
## Residual standard error: 2.165221
## Estimated effects may be unbalanced
summary(JustC11)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Compound1    2  220.0  110.01   23.46 4.58e-07 ***
## Residuals   33  154.7    4.69                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
JustC12 <- anova(lm(Relief ~ Compound1, data = Dat2))
JustC12
## Analysis of Variance Table
## 
## Response: Relief
##           Df Sum Sq Mean Sq F value    Pr(>F)    
## Compound1  2 220.02 110.010  23.465 4.578e-07 ***
## Residuals 33 154.71   4.688                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(JustC12)  
##        Df            Sum Sq         Mean Sq           F value     
##  Min.   : 2.00   Min.   :154.7   Min.   :  4.688   Min.   :23.47  
##  1st Qu.: 9.75   1st Qu.:171.0   1st Qu.: 31.019   1st Qu.:23.47  
##  Median :17.50   Median :187.4   Median : 57.349   Median :23.47  
##  Mean   :17.50   Mean   :187.4   Mean   : 57.349   Mean   :23.47  
##  3rd Qu.:25.25   3rd Qu.:203.7   3rd Qu.: 83.680   3rd Qu.:23.47  
##  Max.   :33.00   Max.   :220.0   Max.   :110.010   Max.   :23.47  
##                                                    NA's   :1      
##      Pr(>F)     
##  Min.   :5e-07  
##  1st Qu.:5e-07  
##  Median :5e-07  
##  Mean   :5e-07  
##  3rd Qu.:5e-07  
##  Max.   :5e-07  
##  NA's   :1
JustC1_C1_Comparison <- TukeyHSD(JustC11, which = ("Compound1"))
JustC1_C1_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1, data = Dat2)
## 
## $Compound1
##     diff        lwr      upr     p adj
## 2-1 3.95  1.7809738 6.119026 0.0002523
## 3-1 5.95  3.7809738 8.119026 0.0000003
## 3-2 2.00 -0.1690262 4.169026 0.0755297
JustC1_All_Comparison <- TukeyHSD(JustC11)
JustC1_All_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound1, data = Dat2)
## 
## $Compound1
##     diff        lwr      upr     p adj
## 2-1 3.95  1.7809738 6.119026 0.0002523
## 3-1 5.95  3.7809738 8.119026 0.0000003
## 3-2 2.00 -0.1690262 4.169026 0.0755297
### In the model with just Compound 1 the F-Value, P-value, and pair wise comparisons all suggest that the main effect of Compound 1 on the number of hours of relief from hay fever the respondents experienced. ###

JustC21 <-  aov(Relief ~ Compound2, data = Dat2)
JustC21
## Call:
##    aov(formula = Relief ~ Compound2, data = Dat2)
## 
## Terms:
##                 Compound2 Residuals
## Sum of Squares     123.66    251.07
## Deg. of Freedom         2        33
## 
## Residual standard error: 2.758293
## Estimated effects may be unbalanced
summary(JustC21)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Compound2    2  123.7   61.83   8.127 0.00135 **
## Residuals   33  251.1    7.61                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
JustC22 <- anova(lm(Relief ~ Compound2, data = Dat2))
JustC22
## Analysis of Variance Table
## 
## Response: Relief
##           Df Sum Sq Mean Sq F value  Pr(>F)   
## Compound2  2 123.66  61.830  8.1268 0.00135 **
## Residuals 33 251.07   7.608                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(JustC22)  
##        Df            Sum Sq         Mean Sq          F value     
##  Min.   : 2.00   Min.   :123.7   Min.   : 7.608   Min.   :8.127  
##  1st Qu.: 9.75   1st Qu.:155.5   1st Qu.:21.164   1st Qu.:8.127  
##  Median :17.50   Median :187.4   Median :34.719   Median :8.127  
##  Mean   :17.50   Mean   :187.4   Mean   :34.719   Mean   :8.127  
##  3rd Qu.:25.25   3rd Qu.:219.2   3rd Qu.:48.275   3rd Qu.:8.127  
##  Max.   :33.00   Max.   :251.1   Max.   :61.830   Max.   :8.127  
##                                                   NA's   :1      
##      Pr(>F)       
##  Min.   :0.00135  
##  1st Qu.:0.00135  
##  Median :0.00135  
##  Mean   :0.00135  
##  3rd Qu.:0.00135  
##  Max.   :0.00135  
##  NA's   :1
JustC2_C2_Comparison <- TukeyHSD(JustC21, which = ("Compound2"))
JustC2_C2_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound2, data = Dat2)
## 
## $Compound2
##     diff        lwr      upr     p adj
## 2-1 3.30  0.5368592 6.063141 0.0163636
## 3-1 4.35  1.5868592 7.113141 0.0014032
## 3-2 1.05 -1.7131408 3.813141 0.6239689
JustC2_All_Comparison <- TukeyHSD(JustC21)
JustC2_All_Comparison
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Relief ~ Compound2, data = Dat2)
## 
## $Compound2
##     diff        lwr      upr     p adj
## 2-1 3.30  0.5368592 6.063141 0.0163636
## 3-1 4.35  1.5868592 7.113141 0.0014032
## 3-2 1.05 -1.7131408 3.813141 0.6239689
## In the model with just Compound 1 the F-Value, P-value, and pair wise comparisons all suggest that the main effect of Compound 2 on the number of hours of relief from hay fever the respondents experienced. ###