This report analyses the ToothGrowth dataset from the R datasets package, using exploratory summaries, confidence intervals, and hypothesis tests. The aim is to determine whether tooth growth in guinea pigs differs by: - Supplement type (VC vs OJ) - Dose level (0.5, 1.0, 2.0 mg/day)
Only methods taught in class—primarily two‑sample t‑tests and confidence intervals—are used.
data(ToothGrowth)
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: num 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
summary(ToothGrowth)
## len supp dose
## Min. : 4.20 OJ:30 Min. :0.500
## 1st Qu.:13.07 VC:30 1st Qu.:0.500
## Median :19.25 Median :1.000
## Mean :18.81 Mean :1.167
## 3rd Qu.:25.27 3rd Qu.:2.000
## Max. :33.90 Max. :2.000
# Convert dose to a factor for analysis
ToothGrowth$dose <- factor(ToothGrowth$dose)
aggregate(len ~ supp, ToothGrowth, mean)
## supp len
## 1 OJ 20.66333
## 2 VC 16.96333
aggregate(len ~ dose, ToothGrowth, mean)
## dose len
## 1 0.5 10.605
## 2 1 19.735
## 3 2 26.100
aggregate(len ~ supp + dose, ToothGrowth, mean)
## supp dose len
## 1 OJ 0.5 13.23
## 2 VC 0.5 7.98
## 3 OJ 1 22.70
## 4 VC 1 16.77
## 5 OJ 2 26.06
## 6 VC 2 26.14
boxplot(len ~ supp, data = ToothGrowth,
main = "Tooth Length by Supplement",
xlab = "Supplement Type", ylab = "Tooth Length")
boxplot(len ~ dose, data = ToothGrowth,
main = "Tooth Length by Dose",
xlab = "Dose (mg/day)", ylab = "Tooth Length")
boxplot(len ~ supp:dose, data = ToothGrowth, las = 2,
main = "Tooth Length by Supplement and Dose",
xlab = "Supplement : Dose", ylab = "Tooth Length")
We compare tooth length between OJ and VC using a two‑sample Welch t‑test.
t.test(len ~ supp, data = ToothGrowth, var.equal = FALSE)
##
## 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
Interpretation • The 95% confidence interval for the difference in means (OJ − VC) is positive. • The p‑value is below 0.05.
Conclusion There is statistically significant evidence that OJ produces greater tooth growth than VC, averaged across all doses.
Pairwise comparisons are performed using Welch t‑tests.
0.5mg/day vs 1.0mg/day
df <- subset(ToothGrowth, dose %in% c(0.5, 1.0))
df$dose <- as.numeric(as.character(df$dose))
t.test(len ~ dose, data = df, var.equal = FALSE)
##
## 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
1.0mg vs 2.0mg
df <- subset(ToothGrowth, dose %in% c(1.0, 2.0))
df$dose <- as.numeric(as.character(df$dose))
t.test(len ~ dose, data = df, var.equal = FALSE)
##
## 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
Interpretation Across all comparisons: • The 95% confidence intervals do not include zero. • The p‑values are very small (typically < 0.001). Conclusion There is strong evidence that higher doses lead to greater tooth growth, with a clear monotonic pattern: 0.5 mg < 1.0 mg < 2.0 mg
Exploring the mean structure: • At 0.5 mg and 1.0 mg, OJ produces greater tooth growth than VC. • At 2.0 mg, the difference between supplements is small. This suggests that OJ is more effective at lower doses, while at high doses both supplements perform similarly.
The conclusions rely on the following assumptions: 1. Independence Each guinea pig’s measurement is independent. 2. Approximate normality Tooth length within each group is assumed to be approximately normally distributed. (The t‑test is robust with n = 10 per group.) 3. Unequal variances allowed Welch’s t‑test does not assume equal variances. 4. Random assignment Supplement type and dose are treated as if randomly assigned. 5. Validity of confidence intervals The sampling distribution of the mean difference is approximately normal.
This analysis uses only the statistical inference tools taught in class and provides clear evidence of both supplement and dose effects on tooth growth.