In order to determine the efficacy and lethal dosage of cardiac relaxants,anesthetized guinea pigs are infused with a drug (the treatment) till death occurs. The total dosage required for death is the response; smaller lethal doses are considered more effective. There are four drugs, and ten guinea pigs are chosen at random for each drug. Lethal dosages follow.
Use Tukey’s HSD test (only) to compare means; as always, be sure assumptions are met. Report findings using the underline method and clearly highlight which means differ.
We will be using Tukey’s HSD test to compare means.
\(H_0\): \(a_i = a_j\) \(H_A\): \(a_i \neq a_j\) Where \(a_i\) and \(a_j\) are means.
Before conducting the Tukey’s HSD test, we must first confirm that the assumptions that are necessary are met.
By looking at the plots of the ANOVA, -Normality assumption is met, the QQ plot looks fairly straight with average tails -Constant variance assumption is NOT met from the plot of the residuals. The variances differ between groups. we see that the residuals astudy the assumptions by looking at the summary of the Variances are not constant -Dependence assumpition is met
In order to correct for nonconstant variance, we apply a log transformation and recheck the plots. The constant variance assumption is now met. So, we can now utilize a Tukey HSD test.
From the Tukey HSD test in R, we see that the p-value < \(\alpha = 0.05\) for the difference between 1 and 3 and between 1 and 4. This suggests that the differences between drugs 1 and 3 and drugs 1 and 4 are significantly different.
Underline Test
#Dataset
data <- c(18.2, 16.4, 10, 13.5, 13.5, 6.7, 12.2, 18.2, 13.5, 16.4, 5.5, 12.2, 11, 6.7, 16.4, 8.2, 7.4, 12.2, 6.7, 11, 5.5, 5, 8.2, 9, 10, 6, 7.4, 5.5, 12.2, 8.2, 6, 7.4, 12.2, 11, 5, 7.4, 7.4, 5.5, 6.7, 5.5)
drug <- as.factor(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10)))
table <- data.frame(data,drug)
table
## data drug
## 1 18.2 1
## 2 16.4 1
## 3 10.0 1
## 4 13.5 1
## 5 13.5 1
## 6 6.7 1
## 7 12.2 1
## 8 18.2 1
## 9 13.5 1
## 10 16.4 1
## 11 5.5 2
## 12 12.2 2
## 13 11.0 2
## 14 6.7 2
## 15 16.4 2
## 16 8.2 2
## 17 7.4 2
## 18 12.2 2
## 19 6.7 2
## 20 11.0 2
## 21 5.5 3
## 22 5.0 3
## 23 8.2 3
## 24 9.0 3
## 25 10.0 3
## 26 6.0 3
## 27 7.4 3
## 28 5.5 3
## 29 12.2 3
## 30 8.2 3
## 31 6.0 4
## 32 7.4 4
## 33 12.2 4
## 34 11.0 4
## 35 5.0 4
## 36 7.4 4
## 37 7.4 4
## 38 5.5 4
## 39 6.7 4
## 40 5.5 4
#ANOVA
aov1 <- aov(data~drug, data=table)
summary(aov1)
## Df Sum Sq Mean Sq F value Pr(>F)
## drug 3 265.5 88.49 9.865 6.91e-05 ***
## Residuals 36 322.9 8.97
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Plots to check Assumptions
plot(aov1)
#Find a way to transform data
library(car)
## Loading required package: carData
summary(powerTransform(data~drug, data=table))
## bcPower Transformation to Normality
## Est Power Rounded Pwr Wald Lwr Bnd Wald Upr Bnd
## Y1 -0.0281 0 -0.8875 0.8313
##
## Likelihood ratio test that transformation parameter is equal to 0
## (log transformation)
## LRT df pval
## LR test, lambda = (0) 0.004122361 1 0.94881
##
## Likelihood ratio test that no transformation is needed
## LRT df pval
## LR test, lambda = (1) 5.741175 1 0.016572
#Log transform data
aov2 <- aov(log(data)~drug, data=table)
summary(aov2)
## Df Sum Sq Mean Sq F value Pr(>F)
## drug 3 2.493 0.8308 8.604 0.000194 ***
## Residuals 36 3.476 0.0966
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Plot to check Assumptions Round 2!
plot(aov2)
#Tukey HSD on Anova 2 Model
TukeyHSD(aov2, "drug", ordered = TRUE)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
## factor levels have been ordered
##
## Fit: aov(formula = log(data) ~ drug, data = table)
##
## $drug
## diff lwr upr p adj
## 3-4 0.04051152 -0.333773743 0.4147968 0.9912257
## 2-4 0.25939488 -0.114890385 0.6336801 0.2602314
## 1-4 0.62950312 0.255217856 1.0037884 0.0003514
## 2-3 0.21888336 -0.155401903 0.5931686 0.4052485
## 1-3 0.58899160 0.214706338 0.9632769 0.0008281
## 1-2 0.37010824 -0.004177021 0.7443935 0.0535511
Nondigestible carbohydrates can be used in diet foods, but they may have effects on colonic hydrogen production in humans. We want to test to see if inulin, fructooligosaccharide, and lactulose are equivalent in their hydrogen production. Preliminary data suggest that the treatment means could be about 45, 32, and 60 respectively, with the error variance conservatively estimated at 35. How many subjects do we need to have power .95 for this situation when testing at the EI = .01 level?
Sample size needed per treatment = 4 Sample size needed for overall experiment = 12
n = 2
g = 3
sigma = 35
ybar=c(45,32,60)
a = (ybar-mean(ybar))
asq = sum(a^2)
f <- sqrt(asq/(g*sigma))
f
## [1] 1.933826
library(pwr)
pwr.anova.test(k=3,f=f, sig.level=0.01, power=0.95)
##
## Balanced one-way analysis of variance power calculation
##
## k = 3
## n = 3.623698
## f = 1.933826
## sig.level = 0.01
## power = 0.95
##
## NOTE: n is number in each group