Statistical Inference Course Project 2

Brandon Bartell

Part 2

Synopsis

We analyzed the ToothGrowth data set on the teeth length of 10 guinea pigs at each of three dose levels of Vitamin C and each of two delivery methods. For these 10 guinea pigs, we performed paired, two sided t-tests to understand the mean difference between experimental arms.

Data Processing

We loaded the data and split it into 6 subsets, for each dose/supplement combination that the 10 guinea pigs saw in order to describe the paired statistical differences between guinea pigs under each experimental condition.

data(ToothGrowth)
tg<-ToothGrowth
#tg

vc05<-tg$len[tg$supp=="VC" & tg$dose==0.5]
vc10<-tg$len[tg$supp=="VC" & tg$dose==1]
vc20<-tg$len[tg$supp=="VC" & tg$dose==2]

oj05<-tg$len[tg$supp=="OJ" & tg$dose==0.5]
oj10<-tg$len[tg$supp=="OJ" & tg$dose==1]
oj20<-tg$len[tg$supp=="OJ" & tg$dose==2]

par(mfrow=c(2,1))
plot(x=c(0.25,2.25),y=c(min(vc05,oj05),max(vc20,oj20)), type = "n", ylab="Length", xlab="Vitamin C Dose [mg]",main="Tooth Length vs. Dose for Orange Juice Supplement")
for (i in 1 : 10) lines(c(0.5,1, 2), c(oj05[i], oj10[i],oj20[i]), lwd = 2, col = "red")
for (i in 1 : 10) points(c(0.5,1, 2), c(oj05[i], oj10[i],oj20[i]), lwd=2, col = "black", bg = "salmon", pch = 21, cex = 3)

plot(x=c(0.25,2.25),y=c(min(vc05,oj05),max(vc20,oj20)), type = "n", xlab = "Vitamin C Dose [mg]", ylab = "Length", main="Tooth Length vs. Dose for Ascorbic Acid Supplement")
for (i in 1 : 10) lines(c(0.5,1, 2), c(vc05[i], vc10[i],vc20[i]), lwd = 2, col = "forestgreen")
for (i in 1 : 10) points(c(0.5,1, 2), c(vc05[i], vc10[i],vc20[i]), lwd=2, col = "black", bg = "green", pch = 21, cex = 3)

plot of chunk unnamed-chunk-1

To see the data, we plotted guinea pig tooth length vs. Vitamin C dose for both the ascorbic acid and orange juice supplements. Lines join the points because the same guinea pigs were measured under each supplement/dose condition.

We are interested in the mean difference between experimental conditions rather than the difference between the means of each condition, which means we need to perform paired t-tests. We performed 3 two-sided paired t-tests to describe the average difference in teeth growth by guinea pig for Vitamin C dose in each supplement and between supplements for the same Vitamin C dose.

vcttest<-t.test(vc20,vc10,paired=TRUE)

ojttest<-t.test(oj20,oj10,paired=TRUE)

vcojttest<-t.test(oj20,vc20,paired=TRUE)

Results

For the first t-test, we were interested in the paired average difference for each guinea pig between receiving 2 and 1 mg of Vitamin C via ascorbic acid. We found that the mean of the difference in teeth length between receiving 2 and 0.5 mg of Vitamin C is 9.37 with a 95% confidence interval of 5.41 - 13.33. Since this confidence interval did not include 0, we rejected the null hypothesis that the true mean difference is 0.

Following the same procedure for orange juice, we found the mean difference between 2 and 1 mg of Vitamin C to be 3.36 with a 95% confidence interval of -0.55 - 7.27. Since this confidence interval did include 0, we failed to reject the null hypothesis that the true mean difference is 0.

Finally, we performed a t-test on the guinea pig teeth length between when they received 2 mg of Vitamin C via orange juice and 2 mg of Vitamin C via ascorbic acid. Following the same procedure, we found that the mean difference between orange juice and ascorbic acid for 2 mg of Vitamin C was -0.08 with a 95% confidence interval of -4.33 - 4.17. Since this confidence interval includes 0, we failed to reject the null hypothesis that the true mean difference is 0.