In this report we will do some exploratory analysis on the TootGrowth dataset in the R datasets package.
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).
A data frame with 60 observations on 3 variables.
[,1] len numeric Tooth length
[,2] supp factor Supplement type (VC or OJ).
[,3] dose numeric Dose in milligrams.
library(ggplot2)
#import the dataset
data("ToothGrowth")
#show summary info
summary(ToothGrowth)
## len supp dose
## Min. : 4.20 OJ:30 Min. :0.500
## 1st Qu.:13.07 VC:30 1st Qu.:0.500
## Median :19.25 Median :1.000
## Mean :18.81 Mean :1.167
## 3rd Qu.:25.27 3rd Qu.:2.000
## Max. :33.90 Max. :2.000
ggplot(ToothGrowth, aes(x=dose, y=len, color=dose)) +
geom_point() +
labs(title="Tooth Growth by Supplement Type and Dose") +
xlab("Dose") +
ylab("Length") + facet_wrap(~ supp, ncol=2) +
theme(plot.title = element_text(face="bold"))
In order to compare tooth growth, we will do two-sample t-tests, (Orange Juice and Ascorbic Acid) at each dosage level (0.5mg, 1mg, 2mg).
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == .5, ])
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 3.1697, df = 14.969, p-value = 0.006359
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.719057 8.780943
## sample estimates:
## mean in group OJ mean in group VC
## 13.23 7.98
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == 1, ])
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 4.0328, df = 15.358, p-value = 0.001038
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 2.802148 9.057852
## sample estimates:
## mean in group OJ mean in group VC
## 22.70 16.77
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == 2, ])
##
## Welch Two Sample t-test
##
## data: len by supp
## t = -0.0461, df = 14.04, p-value = 0.9639
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.79807 3.63807
## sample estimates:
## mean in group OJ mean in group VC
## 26.06 26.14
Based on the assumption that the data is representative of the population of guinea pigs and that the dosage and supplement were randomly assigned we can conclude that the vitamin c supplements have a positive effect on tooth growth for guinea pigs and that at 05.mg and 1mg dosages orange juice is more effective than ascorbic acid. For a dosage of 2mg we cannot conclude that orange juice is more effective than ascorbic acid.