Excercise 5.4

Refer to the data in Exercise 3.1. Test the null hypothesis that all pairs of diets produce the same average weight liver against the alternative that some diets produce different average weights. Control the Protected LSD (least significant difference). For this exercise, be sure to express your answer using the “underline method” and clearly interpret these results. You also need to explicitly discuss the steps involve in the Protected LSD as applied to these data and your findings.

Answer

\(H_0: a_i = a_j\) \(H_A: a_i \neq a_j\) Where \(a_i\) and \(a_j\) are means.

MSE = 0.19274 with 3 degrees of freedom

With an F value of 4.65 and a p-value = 0.0101, at alpha = 0.05, we reject the null hypothesis. We have both hand calculated these values and ran the summary of the model.

Since the p-value is less than \(\alpha = 0.05\), we reject the null hypothesis and conclude that there is significant difference in the average weights produced by the various diets.

Thus, we conclude not all of the means for the treatment groups are the same. So now, we perform the LSD test to see which means are the same.

Since differences for pairs 2,4 and 3,4 are less than the LSD, these two pairs are statistically significant at 5% level.

Underline Graph

Underline Graph

#Data
t1 <- c(3.52, 3.36, 3.57, 4.19, 3.88, 3.76, 3.94)
t2 <- c(3.47, 3.73, 3.38, 3.87, 3.69, 3.51, 3.35, 3.64)
t3 <- c(3.54, 3.52, 3.61, 3.76, 3.65, 3.51)
t4 <- c(3.74, 3.83, 3.87, 4.08, 4.31, 3.98, 3.86, 3.71)

#Data Frames
weight <- c(t1,t2,t3,t4)
diet<-c(rep("A",7),rep("B",8),rep("C",6),rep("D",8))
df<-data.frame(weight,diet)
df
##    weight diet
## 1    3.52    A
## 2    3.36    A
## 3    3.57    A
## 4    4.19    A
## 5    3.88    A
## 6    3.76    A
## 7    3.94    A
## 8    3.47    B
## 9    3.73    B
## 10   3.38    B
## 11   3.87    B
## 12   3.69    B
## 13   3.51    B
## 14   3.35    B
## 15   3.64    B
## 16   3.54    C
## 17   3.52    C
## 18   3.61    C
## 19   3.76    C
## 20   3.65    C
## 21   3.51    C
## 22   3.74    D
## 23   3.83    D
## 24   3.87    D
## 25   4.08    D
## 26   4.31    D
## 27   3.98    D
## 28   3.86    D
## 29   3.71    D
#Model
model<-aov(weight~diet,data=df)
summary(model)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## diet         3 0.5782 0.19274   4.658 0.0102 *
## Residuals   25 1.0344 0.04138                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#MSE = 0.19274 with 3 degrees of freedom
#Residual MSE = 0.04138

rMSE <- 0.04138
t <- qt(0.025, 25, lower.tail=FALSE)
t
## [1] 2.059539
#LSD
lsd12 <- t*sqrt(rMSE)*sqrt(1/7 + 1/8)
lsd13 <- t*sqrt(rMSE)*sqrt(1/7 + 1/6)
lsd14 <- t*sqrt(rMSE)*sqrt(1/7 + 1/8)
lsd23 <- t*sqrt(rMSE)*sqrt(1/8 + 1/6)
lsd24 <- t*sqrt(rMSE)*sqrt(1/8 + 1/8)
lsd34 <- t*sqrt(rMSE)*sqrt(1/6 + 1/8)

#Means for Treatments
m_t1 <- mean(t1)
m_t2 <- mean(t2)
m_t3 <- mean(t3)
m_t4 <- mean(t4)
m_tot <- mean(weight)

#SSE
SSE <- sum((t1-m_t1)^2) + sum((t2-m_t2)^2) + sum((t3-m_t3)^2) + sum((t4-m_t4)^2) 
SSE
## [1] 1.034405
#SStrt
SStrt <- 7*((m_t1-m_tot)^2) + 8*((m_t2-m_tot)^2) + 6*((m_t3-m_tot)^2) + 8*((m_t4-m_tot)^2) 
SStrt
## [1] 0.578209
#SStot
SStot <- SSE + SStrt
SStot
## [1] 1.612614
#F Value
F_val<-(SStrt/(4-1))/(SSE/(28-3))
F_val
## [1] 4.658146
#P-value
1-pf(F_val,3,25)
## [1] 0.01015794
#With an F value of 4.65 and a p-value = 0.0101, at alpha = 0.05, we reject the null hypothesis. Thus, we conclude not all of the means for the treatment groups are the same. So now, we perform the LSD test to see which means are the same.

#Treatment 1 and Treatment 2
abs(m_t1 - m_t2)
## [1] 0.1657143
lsd12
## [1] 0.2168287
as.logical(abs(m_t1 - m_t2) < lsd12)
## [1] TRUE
#Treatment 1 and Treatment 3
abs(m_t1 - m_t3)
## [1] 0.147381
lsd13
## [1] 0.2330839
as.logical(abs(m_t1 - m_t3) < lsd13)
## [1] TRUE
#Treatment 1 and Treatment 4
abs(m_t1 - m_t4)
## [1] 0.1767857
lsd14
## [1] 0.2168287
as.logical(abs(m_t1 - m_t4) < lsd14)
## [1] TRUE
#Treatment 2 and Treatment 3
abs(m_t2 - m_t3)
## [1] 0.01833333
lsd23
## [1] 0.2262604
as.logical(abs(m_t2 - m_t3) < lsd23)
## [1] TRUE
#Treatment 2 and Treatment 4
abs(m_t2 - m_t4)
## [1] 0.3425
lsd24
## [1] 0.2094764
as.logical(abs(m_t2 - m_t4) < lsd24)
## [1] FALSE
#Treatment 3 and Treatment 4
abs(m_t3 - m_t4)
## [1] 0.3241667
lsd34
## [1] 0.2262604
as.logical(abs(m_t3 - m_t4) < lsd34)
## [1] FALSE

Excercise 5.4

In an experiment with four groups, each with five observations, the group means are 12, 16, 21, and 19, and the MSE is 20. A colleague points out that the contrast with coefficients -4, -2, 3, 3 has a rather large sum of squares. No one knows to begin with why this contrast has a large sum of squares, but after some detective work, you discover that the contrast coefficients are roughly the same (except for the overall mean) as the time the samples had to wait in the lab before being analyzed (3, 5, 10, and 10 days). What is the significance of this contrast?

Answer

We want to use a Scheffe’s T-Test as it is the appropriate technique for assesing contrasts that result from data snooping.

\(H_0\) : \(4(\mu_1) + 2(\mu_2) = 3(\mu_3) + 3(\mu_4)\)

\(H_A\) : \(4(\mu_1) + 2(\mu_2) \neq 3(\mu_3) + 3(\mu_4)\)

At an \(\alpha\) = 0.05, the ratio of SSW over standard error = 3.415188 > scheffe’s value = 0.5874807. So, we reject the \(H_0\) and can conclude \(4(\mu_1) + 2(\mu_2) \neq 3(\mu_3) + 3(\mu_4)\).

m2 <- c(12,16,21,19)
mse <- 20
contrasts <- c(-4,-2,3,3)

#Sum of Squares Within
SSW <- (sum(m2*contrasts))^2/(sum(contrasts^2))
SSW
## [1] 42.10526
#Standard Error
stderror <-sqrt(20*(sum((contrasts^2)/5)))
stderror
## [1] 12.32883
#F Value
F_val <-qf(.05,3,16)
F_val
## [1] 0.1150445
#Scheffe, g=4
Scheffe<-sqrt(3*F_val)
Scheffe
## [1] 0.5874807
#Compare to ratio of SSW/Standard Error
SSW/stderror
## [1] 3.415188