We analyze the ToothGrowth dataset, which records
odontoblast (tooth) growth len in 60 guinea pigs given
Vitamin C via one of two delivery methods (supp: orange
juice “OJ” or ascorbic acid “VC”) at one of three dose levels (0.5, 1,
or 2 mg/day). We explore the data, then use two-sample t-tests to assess
whether tooth growth differs by supplement type and by dose.
str(ToothGrowth)
## 'data.frame': 60 obs. of 3 variables:
## $ len : num 4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ...
## $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ...
## $ dose: Factor w/ 3 levels "0.5","1","2": 1 1 1 1 1 1 1 1 1 1 ...
table(ToothGrowth$supp, ToothGrowth$dose)
##
## 0.5 1 2
## OJ 10 10 10
## VC 10 10 10
aggregate(len ~ supp + dose, data = ToothGrowth, FUN = function(x) c(mean = round(mean(x),2), sd = round(sd(x),2)))
The design is balanced: 10 guinea pigs in each of the 6 supplement-by-dose combinations (60 rows total). Mean tooth length increases with dose for both supplements, and OJ means exceed VC means at the two lower doses but are nearly identical at the highest dose (Figure 1).
par(mfrow = c(1,2))
boxplot(len ~ supp * dose, data = ToothGrowth, col = c("orange","lightblue"),
main = "By supp & dose", xlab = "supp.dose", ylab = "Tooth length", cex.axis = 0.6)
boxplot(len ~ supp, data = ToothGrowth, col = c("orange","lightblue"),
main = "By supp only", ylab = "Tooth length")
Tooth length by supplement and dose (left) and by supplement alone (right).
par(mfrow = c(1,1))
We use Welch two-sample t-tests (unequal variances, the default for
t.test in R) throughout, since the supplement/dose groups
are different, independently-sampled guinea pigs (i.e., unpaired groups)
and there is no reason to assume equal variances across groups.
1) OJ vs. VC, ignoring dose:
t.test(len ~ supp, data = ToothGrowth)
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 1.9153, df = 55.309, p-value = 0.06063
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## -0.1710156 7.5710156
## sample estimates:
## mean in group OJ mean in group VC
## 20.66333 16.96333
The difference in means (OJ \(-\) VC \(\approx\) 3.70) has a 95% CI of about \((-0.17, 7.57)\), which contains 0 (p \(\approx\) 0.061). Pooling across all doses, we do not have strong evidence that supplement type alone affects tooth growth.
2) Dose level comparisons (pooled across supplement):
t.test(len ~ dose, data = ToothGrowth, subset = dose %in% c(0.5,1))
##
## Welch Two Sample t-test
##
## data: len by dose
## t = -6.4766, df = 37.986, p-value = 1.268e-07
## alternative hypothesis: true difference in means between group 0.5 and group 1 is not equal to 0
## 95 percent confidence interval:
## -11.983781 -6.276219
## sample estimates:
## mean in group 0.5 mean in group 1
## 10.605 19.735
t.test(len ~ dose, data = ToothGrowth, subset = dose %in% c(1,2))
##
## Welch Two Sample t-test
##
## data: len by dose
## t = -4.9005, df = 37.101, p-value = 1.906e-05
## alternative hypothesis: true difference in means between group 1 and group 2 is not equal to 0
## 95 percent confidence interval:
## -8.996481 -3.733519
## sample estimates:
## mean in group 1 mean in group 2
## 19.735 26.100
Both comparisons (0.5 vs 1 mg, and 1 vs 2 mg) give p-values far below 0.001, with 95% CIs entirely above 0 (about \((6.3, 12.0)\) and \((3.7, 9.0)\) respectively). Higher dose is associated with significantly more tooth growth at every step.
3) OJ vs. VC within each dose level:
for (d in c(0.5, 1, 2)) {
cat("Dose =", d, "\n")
print(t.test(len ~ supp, data = ToothGrowth[ToothGrowth$dose == d, ]))
}
## Dose = 0.5
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 3.1697, df = 14.969, p-value = 0.006359
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## 1.719057 8.780943
## sample estimates:
## mean in group OJ mean in group VC
## 13.23 7.98
##
## Dose = 1
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 4.0328, df = 15.358, p-value = 0.001038
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## 2.802148 9.057852
## sample estimates:
## mean in group OJ mean in group VC
## 22.70 16.77
##
## Dose = 2
##
## Welch Two Sample t-test
##
## data: len by supp
## t = -0.046136, df = 14.04, p-value = 0.9639
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## -3.79807 3.63807
## sample estimates:
## mean in group OJ mean in group VC
## 26.06 26.14
At doses 0.5 and 1 mg, OJ produces significantly more growth than VC (95% CIs of roughly \((1.7,8.8)\) and \((2.8,9.1)\), both p < 0.01). At dose 2 mg, the difference vanishes (mean difference \(\approx -0.08\), 95% CI \((-3.8, 3.6)\), p \(\approx\) 0.96) – the two delivery methods perform equally well at the highest dose, consistent with a ceiling effect on growth.
These conclusions rely on: (1) each group of 10 guinea pigs is an independent random sample (the six dose/supplement groups are not paired or repeated-measures on the same animals); (2) the underlying tooth-length measurements are approximately Normally distributed within each group, or the group sizes (n=10) are large enough for the t-test to be robust to mild non-normality; (3) we used Welch’s t-test, so we do not assume equal variances across groups; (4) no multiple-comparison correction was applied – with several pairwise tests, the overall Type I error rate across all comparisons is higher than 0.05 for any single test (a Bonferroni or similar adjustment would be a reasonable refinement beyond what was covered in class).