Inferential Data Analysis with ToothGrowth Dataset
## len supp dose
## Min. : 4.2 OJ:30 Min. :0.50
## 1st Qu.:13.1 VC:30 1st Qu.:0.50
## Median :19.2 Median :1.00
## Mean :18.8 Mean :1.17
## 3rd Qu.:25.3 3rd Qu.:2.00
## Max. :33.9 Max. :2.00
We can see that there are three columns in the ToothGrowth dataset: tooth length, supplement name, and dosage amount. It is clear to see only two supplements are being tested, abbreviated OJ and VC, and three diﬀerent dosages with 10 data points each at values 0.5, 1.0, and 2.0.
Comparing Supplements and Dosages
Since there are only ten samples within each supplement/dose combination, we will use t-testing to analyze the signiﬁcance of the data. Our null hypothesis is that the diﬀerence in means of the two supplements at a given dose is 0.
vc <- group_by(select(filter(data, data$supp == "VC"), len, dose), dose)
oj <- group_by(select(filter(data, data!$supp == "OJ"), len, dose), dose)
dose.small <- t.test(vc$len[vc$dose == 0.5], oj$len[oj$dose == 0.5])
dose.med <- t.test(vc$len[vc$dose == 1.0], oj$len[oj$dose == 1.0])
dose.large <- t.test(vc$len[vc$dose == 2.0], oj$len[oj$dose == 2.0])
The above tests are performed given unequal variances, unpaired data, and using a two-sided null hypothesis.
In comparing VC vs OJ tooth length at a dosage of 0.5, we ﬁnd a 95% conﬁdence interval of [-8.7809, -1.7191] with a p-value of 0.0064. Thus at a dosage of 0.5 we reject the null hypothesis because there is a statistically signiﬁcant diﬀerence in mean values between supplements, with OJ performing better.
At a dosage of 1.0, we ﬁnd a 95% conﬁdence interval of [-9.0579, -2.8021] with a p-value of 0.001. Once again, we reject the null hypothesis, as OJ’s increase in tooth length is statistically signiﬁcant given α = 0.05.
At a dosage of 1.0, we ﬁnd a 95% conﬁdence interval of [-3.6381, 3.7981] with a p-value of 0.9639. This conﬁdence interval includes 0, as well as has an enormous p-value, therefore we fail to reject the null hypothesis at this larger dosage.
Assuming a null hypothesis H 0 that the diﬀerence in means between the supplements at a given dose is 0, the OJ supplement increases tooth growth by a statistically signiﬁcant margin compared to the VC supplement when the dosage concerned is 0.5 or 1.0. At a dosage of 2.0 our conﬁdence interval includes our null hypothesis, so one cannot say that one is better than the other. It may be that the OJ supplement suﬀers diminishing returns, or that VC reaches a higher eﬃcacy at this higher dosage.