\(H_0\) states that neither the delivery method of vitamin C, nor the dose level of vitamin C affects tooth growth in guinea pigs.
The data set, “ToothGrowth” is loaded from the data package in R. and includes the following:
Description
The response is the length of odontoblasts (teeth) in each of 10 guinea pigs at each of three dose levels of Vitamin C (0.5, 1, and 2 mg) with each of two delivery methods (orange juice or ascorbic acid).
Source
C. I. Bliss (1952) The Statistics of Bioassay. Academic Press.
References
McNeil, D. R. (1977) Interactive Data Analysis. New York: Wiley.
The data set has 60 observations with 3 variables, but further inpections shows us that dose should be a factor, not numeric, as there are only three discrete options.
## '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 ...
unique(d$dose)
[1] 0.5 1.0 2.0
By creating individual factors for each of the six supplement~dose combinations, we can easily plot the data for initial exploration.
d2<-mutate(d, dosexsupp=factor(paste(supp, dose,"_")))
A violin plot, similar to a box plot, offers visually striking and intuitive way to see distributions of factor.
Visual inspections suggests that there may not be a significant difference between supplement types in and of themselves, but perhaps when broken down by dose and type there is.
We’ll confirm with a t.test comparing our variables. since each of the 60 subjects in our study are independent, we’ll do an unpaired t-test. Additionally, since we’re only concerned with the greatest amount of growth difference, we’ll set var.equal to false.
Null hypothesis \(H_0\) is that there is no difference in effect on tooth growth that can be attributed to supplement type in and of itself.
suppstest <- t.test(len ~ supp, data = d, paired = FALSE, var.equal = FALSE)
Since our p-value = 0.0606345 is above .05 and the confidence interval is -0.1710156, 7.5710156 which includes 0, we cannot reject the null hypothesis.
##
## 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 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
Null hypothesis \(H_0\) is that there is no difference in effect on tooth growth that can be attributed to dose level and supplement type. The alternative hypothesis \(H_a\) states that dose level and supplement type have a positive effect on tooth growth.
We’ll create three subsets of data in order to compare them
In the comparison between .5 and 1.0 mg, the p-value is quite low 0.0061813 and the confidence interval 2.5849559 to 13.4150441 does not encompass 0, so we can reject the \(H_0\) in this case.
For the comparisons between OJ and VC with 2.0 mg, the p-value is above 0.05 (0.312588 and 0.3891927) and the confidence intervals both include zero (-4.3800688 to 12.8400688 and -3.0026138 to 7.3226138), therefore we do not reject \(H_0\) for the 2.0 dose group. There does not appear to be a significant difference in results between the two delivery methods at this level.
kable(tall)
p | CiMin | CiMax | OJMean | VCMean | |
---|---|---|---|---|---|
0.5 vs 1.0 mg | 0.0061813 | 2.584956 | 13.415044 | 19.54 | 11.54 |
0.5 vs 2.0 mg | 0.3125880 | -4.380069 | 12.840069 | 20.41 | 16.18 |
1.0 vs 2.0 mg | 0.3891927 | -3.002614 | 7.322614 | 23.57 | 21.41 |
Since we cannot reject \(H_0\) for the 2.0 dose level, the next exploration will be between OJ and VC at the .5 and 1.0 level.
This test confirms that at the both the 0.5 and 1.0 dose levels, Orange Juice (OJ), appears to have a significantly greater positive effect on tooth growth in Guinea Pigs than Ascorbic Acid.
p | CiMin | CiMax | OJMean | VCMean | |
---|---|---|---|---|---|
.5 mg | 0.0063586 | 1.719057 | 8.780943 | 13.23 | 7.98 |
1.0 mg | 0.0010384 | 2.802148 | 9.057852 | 22.70 | 16.77 |
A violin plot of the two lower doses shows us that OJ is “top-heavy” in the 0.5 dose level and has a greater but more evenly distributed spread at the 1.0 dose. VC, on the other hand, is “bottom-heavy” at the 0.5 dose level and more narrowly distributed with regards to length, slightly skewed toward greater length at the 1.0 dose.
A t-test confirms that there is significant difference, with higher doses resulting in greater tooth growth, in both nutrient delivery modalities.
tOJ<-t.test(len~dose, data = dOJ, paired = FALSE, var.equal = FALSE)
tVC<-t.test(len~dose, data = dVC, paired = FALSE, var.equal = FALSE)
compareall<-data.frame()
tOJ<-c("p"=tOJ$p.value, "CIMIN"=tOJ$conf.int[1],"CIMAX"=tOJ$conf.int[2], "0.5"=tOJ$estimate[1], "1.0"=tOJ$estimate[2])
tVC<-c("p"=tVC$p.value, "CIMIN"=tVC$conf.int[1],"CIMAX"=tVC$conf.int[2], "0.5"=tVC$estimate[1], "1.0"=tVC$estimate[2])
tOJVC<-data.frame(rbind(tOJ, tVC ))
names(tOJVC)<-c("p", "CiMin", "CiMax", "0.5_mean", "1.0_mean")
rownames(tOJVC)<-c("OJ", "VC")
kable(tOJVC)
p | CiMin | CiMax | 0.5_mean | 1.0_mean | |
---|---|---|---|---|---|
OJ | 0.0012455 | -14.94689 | -5.613114 | 14.40 | 24.68 |
VC | 0.0005573 | -12.65876 | -6.061241 | 6.86 | 16.22 |
Dose level appears to have a positive effect on tooth growth at every dose level, however we can reject the null hypothesis that dose and delivery type have no effect on tooth growth in guinea pigs and suggest that at lower doses, Orange Juice has a greater positive effect.
It appears that at levels below 2.0 mg, Vitamin C delivered via Orange Juice has a greater positive effect on Guinea Pig tooth growth than when delivered as an isolated supplement in the form of Ascorbic Acid.
The 2.0 dose level has the greatest positive effect on tooth growth, but the distinction between Ascorbic Acid (VC) and Orange Juice (OJ) disappears.
This is based on the assumption that:
The R libraries used in this analysis inlude:
library(datasets)
library(knitr)
library(dplyr)
library(reshape2)
library(ggplot2)
library(data.table)
library(gridExtra)
data(ToothGrowth)
The data was subsetted with the following code:
d0510<-filter(d, dose==c(.5, 1))
d0520<-filter(d, dose==c(.5, 2))
d1020<-filter(d, dose==c(1,2))
t0510<-t.test(len~supp, data = d0510, paired = FALSE, var.equal = FALSE)
t0520<-t.test(len~supp, data = d0520, paired = FALSE, var.equal = FALSE)
t1020<-t.test(len~supp, data = d1020, paired = FALSE, var.equal = FALSE)
compareall<-data.frame()
t0510<-c("p"=t0510$p.value, "CIMIN"=t0510$conf.int[1],"CIMAX"=t0510$conf.int[2], "OJ"=t0510$estimate[1], "VC"=t0510$estimate[2])
t0520<-c("p"=t0520$p.value, "CIMIN"=t0520$conf.int[1],"CIMAX"=t0520$conf.int[2], "OJ"=t0520$estimate[1], "VC"=t0520$estimate[2])
t1020<-c("p"=t1020$p.value, "CIMIN"=t1020$conf.int[1],"CIMAX"=t1020$conf.int[2], "OJ"=t1020$estimate[1], "VC"=t1020$estimate[2])
tall<-data.frame(rbind(t0510, t0520, t1020 ))
names(tall)<-c("p", "CiMin", "CiMax", "OJMean", "VCMean")
rownames(tall)<-c("0.5 vs 1.0 mg", "0.5 vs 2.0 mg", "1.0 vs 2.0 mg")
final5<-filter(d, dose==0.5)
final10<-filter(d, dose==1.0)
tfinal5<-t.test(len~supp, data = final5, paired = FALSE, var.equal = FALSE)
tfinal10<-t.test(len~supp, data=final10, paired=F, var.equal=F)
tfinal5<-c("p"=tfinal5$p.value, "CIMIN"=tfinal5$conf.int[1],"CIMAX"=tfinal5$conf.int[2], "OJ"=tfinal5$estimate[1], "VC"=tfinal5$estimate[2])
tfinal10<-c("p"=tfinal10$p.value, "CIMIN"=tfinal10$conf.int[1],"CIMAX"=tfinal10$conf.int[2], "OJ"=tfinal10$estimate[1], "VC"=tfinal10$estimate[2])
tfinalall<-data.frame(rbind(tfinal5, tfinal10))
names(tfinalall)<-c("p", "CiMin", "CiMax", "OJMean", "VCMean")
rownames(tfinalall)<-c(".5 mg", "1.0 mg")