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).
library(datasets);data("ToothGrowth")
str(ToothGrowth)
## '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 ...
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
head(ToothGrowth)
## 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
library(ggplot2)
ggplot(ToothGrowth, aes(x = dose, y = len, color = supp)) + geom_point()
Each guinea pig received both orange juice and ascorbic acid in all doses, however, the datapoints are not labeled, so it is unknown which guinea pig had which response. Therefore I will have to treat the samples as independent. I can assume that tooth length is normally distributed, so I will use Student’s t-test with unpaired samples and equal variance.
CI_supp <- t.test(ToothGrowth$len[ToothGrowth$supp == "OJ"], ToothGrowth$len[ToothGrowth$supp == "VC"], paired = FALSE, equal.var = TRUE)$conf
CI_dose <- t.test(ToothGrowth$len[ToothGrowth$dose == 2], ToothGrowth$len[ToothGrowth$dose == 0.5], paired = FALSE, equal.var = TRUE)$conf
The difference in tooth length between using orange juice as a supplement and using ascorbic acid lies in the range -0.17, 7.57 (units not given). Since this range includes zero, it is possible that there is no difference between the two supplements. Orange juice does not appear to be more effective than ascorbic acid as a vitamin C supplement.
The difference in tooth length produced by 2.0 mg dose of Vitamin C versus a 0.5 dose lies in the range 12.83, 18.16. This range is completely above zero, so increasing the dose of vitamin C does appear to be effective at increasing tooth growth.