Assignment:
1. Load the ToothGrowth data and perform some basic exploratory data analyses
2. Provide a basic summary of the data.
3. Use confidence intervals and/or hypothesis tests to compare tooth growth by supp and dose. ###### (Only use the techniques from class, even if there’s other approaches worth considering)
4. State your conclusions and the assumptions needed for your conclusions.
3. Use confidence intervals and/or hypothesis tests to compare tooth growth by supp and dose.
Get the mean and standard deviation values for both Acorbic Acid (VC) and Orange Juice (OJ)
supplements by dosage.
TGdata <- ddply(ToothGrowth, c("supp", "dose"), summarise,
mean = mean(len),
sd = sd(len)
)
TGdata
## supp dose mean sd
## 1 OJ 0.5 13.23 4.459709
## 2 OJ 1.0 22.70 3.910953
## 3 OJ 2.0 26.06 2.655058
## 4 VC 0.5 7.98 2.746634
## 5 VC 1.0 16.77 2.515309
## 6 VC 2.0 26.14 4.797731
ggplot(TGdata, aes(dose, mean, color=supp)) +
geom_point(size = 4) +
geom_line() +
ggtitle("ToothGrowth data")

For both Acorbic Acid (VC) and Orange Juice (OJ) supplements, the average tooth
length for 60 guinea pigs increases with an increase in dosage. OJ appears to be
more effective than VC in determining tooth length.
Dose1 = 0.5 dose, Dose2 = 1.0 dose, Dose3 = 2.0 dose
Hypothesis1
H1o:Mean_delta = 0 The null hypothesis
H1a Mean_delta <> 0 There is a difference between the means of the two supplements where
dose = 0.5.
Use t-test to determine whether the means of two groups are equal to each other.
Dose1 = 0.5 dose
Dose1 = ToothGrowth[ToothGrowth$dose == 0.5,]
Dose1_test = t.test(len~supp, paired=FALSE, var.equal=FALSE, data=Dose1)
Dose1_test$conf.int
## [1] 1.719057 8.780943
## attr(,"conf.level")
## [1] 0.95
Dose1_test$estimate
## mean in group OJ mean in group VC
## 13.23 7.98
Dose1_test$p.value
## [1] 0.006358607
Hypothesis2
H2o:Mean_delta = 0 The null hypothesis
H2a Mean_delta <> 0 There is a difference between the means of the two supplements where
dose = 1.0.
Dose2 = 1.0 dose
Dose2 = ToothGrowth[ToothGrowth$dose == 1.0,]
Dose2_test = t.test(len~supp, paired=FALSE, var.equal=FALSE, data=Dose2)
Dose2_test$conf.int
## [1] 2.802148 9.057852
## attr(,"conf.level")
## [1] 0.95
Dose2_test$estimate
## mean in group OJ mean in group VC
## 22.70 16.77
Dose2_test$p.value
## [1] 0.001038376
Hypothesis3
H3o:Mean_delta = 0 The null hypothesis
H3a Mean_delta <> 0 There is a difference between the means of the two supplements where
dose = 2.0.
Dose3 = 2.0 dose
Dose3 = ToothGrowth[ToothGrowth$dose == 2.0,]
Dose3_test = t.test(len~supp, paired=FALSE, var.equal=FALSE, data=Dose3)
Dose3_test$conf.int
## [1] -3.79807 3.63807
## attr(,"conf.level")
## [1] 0.95
Dose3_test$estimate
## mean in group OJ mean in group VC
## 26.06 26.14
Dose3_test$p.value
## [1] 0.9638516
Findings:
Findings for Dose = 0.5:
The 95% confidence interval does not contain zero, therefore the null hypothesis is rehected.
The p-vale < 0.05, therefore the difference in means between the OJ and VS supplements is
statistically significant.
Findings for Dose = 1.0:
The 95% confidence interval contains zero, therefore the null hypothesis cannot be rejected.
The p-vale > 0.05, therefore the difference in means between the OJ and VS supplements is not
statistically significant
Findings for Dose = 2.0:
The 95% confidence interval contains zero, therefore the null hypothesis cannot be rejected.
The p-vale > 0.05, therefore the difference in means between the OJ and VS supplements is not
statistically significant
4. State your conclusions and the assumptions needed for your conclusions.
Conclusion
At lower doses, the OJ supplement is more efffective on tooth length than the VC supplement.
As the dosage amounts increase, the difference in the average tooth length for each supplement
is no longer statitically signficiant.
Assumption:
The assumption for the test is that the data in ToothGrowth is sampled from normal distributions
with equal variances.