We will analyse the effect of vitamin C on tooth growth in guinea pigs using the data collected in ToothGrowth data set. Let’s load the data set:
library(datasets)
data(ToothGrowth)
XX=ToothGrowth
head(XX)
## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 4 5.8 VC 0.5
## 5 6.4 VC 0.5
## 6 10.0 VC 0.5
Guinea pigs were fed with vitamin C at three dose levels (dose): 0.5, 1, and 2 mg with two delivery methods (supp): orange juice (OJ) or ascorbic acid (VC). There were 10 animals in each group and the teeth length (len) was measured.
Let’s have a look on the mean length in each of the groups:
xx=aggregate(XX[,1], XX[,2:3], mean)
colnames(xx)[3]="len"
xx
## supp dose len
## 1 OJ 0.5 13.23
## 2 VC 0.5 7.98
## 3 OJ 1.0 22.70
## 4 VC 1.0 16.77
## 5 OJ 2.0 26.06
## 6 VC 2.0 26.14
barplot(xx$len, names.arg=paste(xx$sup, xx$dose, sep=": "))
At first glance we can anticipate that the guinea pigs that receive higher dose of vitamin C have longer teeth. To verify this hypothesis, let’s compare the guinea pigs that received ascorbic acid at dose 2 and 0.5 mg.
Null hypothesis: The dose of ascorbic acid (2 vs 0.5 mg) has no effect on the tooth length and the observed difference is just by chance.
Alternative hypothesis: Guinea pigs that receive 2 mg dose of ascorbic acid have longer teeth than those receiving 0.5 mg.
gr1=XX$len[XX$supp=="VC" & XX$dose==2]
gr2=XX$len[XX$supp=="VC" & XX$dose==0.5]
Let’s assume that the tooth length is distributes normally in the population and that variance is not the same between the two groups and use Welch’s t-test. Regarding the alternative hypothesis we have just formulated, the test is one tailed.
t.test(gr1, gr2, alt = "g", paired = F, var.equal = F)
##
## Welch Two Sample t-test
##
## data: gr1 and gr2
## t = 10.3878, df = 14.327, p-value = 2.341e-08
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 15.08583 Inf
## sample estimates:
## mean of x mean of y
## 26.14 7.98
The obtained p-value is 2.341e-08, which means that the experiment result we obtained in highly unlikely under the null hypothesis. Therefore, rejecting the null hypothesis is justified and it can be concluded that indeed guinea pigs consuming higher amounts of vitamin C tend to have longer teeth.
Another interesting observation is that for dose 0.5 and 1 teeth were on average longer in guinea pigs that received orange juice rather than ascorbic acid. This effect seems to no take place with the highest dose (2 mg). Let’s test the following hypothesis:
Null hypothesis: With the same dose of ascorbic acid tooth length of guinea pigs consuming orange juice or ascorbic acid is the same and the observed difference is just by chance.
Alternative hypothesis: With the same dose of ascorbic acid guinea pigs consuming orange juice have longer teeth than those consuming ascorbic acid.
As above, let’s assume that the tooth length is distributes normally in the population and that variance is not the same between the two groups. Let’s perform the one tailed Welch’s t-test for each of the 3 doses:
gr1=XX$len[XX$supp=="OJ" & XX$dose==0.5]
gr2=XX$len[XX$supp=="VC" & XX$dose==0.5]
t.test(gr1, gr2, alt = "g", paired = F, var.equal = F)
##
## Welch Two Sample t-test
##
## data: gr1 and gr2
## t = 3.1697, df = 14.969, p-value = 0.003179
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 2.34604 Inf
## sample estimates:
## mean of x mean of y
## 13.23 7.98
gr1=XX$len[XX$supp=="OJ" & XX$dose==1]
gr2=XX$len[XX$supp=="VC" & XX$dose==1]
t.test(gr1, gr2, alt = "g", paired = F, var.equal = F)
##
## Welch Two Sample t-test
##
## data: gr1 and gr2
## t = 4.0328, df = 15.358, p-value = 0.0005192
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 3.356158 Inf
## sample estimates:
## mean of x mean of y
## 22.70 16.77
gr1=XX$len[XX$supp=="OJ" & XX$dose==2]
gr2=XX$len[XX$supp=="VC" & XX$dose==2]
t.test(gr1, gr2, alt = "g", paired = F, var.equal = F)
##
## Welch Two Sample t-test
##
## data: gr1 and gr2
## t = -0.0461, df = 14.04, p-value = 0.5181
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -3.1335 Inf
## sample estimates:
## mean of x mean of y
## 26.06 26.14
Consistent with our initial observation, p-values of the tests performed for 0.5 and 1 mg justify rejection of the null hypothesis. In the case of 2 mg dose, there is no ground to reject the hypothesis. Therefore it can be concluded that for the lower doses of vitamin C, teeth length in guinea pigs consuming orange juice is greater than in those consuming ascorbic acid. While the dose gets higher, there is no difference between the orange juice and ascorbic acid groups.
It could be further hypothesised that ascorbic acid is better absorbed from orange juice than from synthetic supplements, but this would require further investigation.