The ToothGrowth dataset shows the effect of vitamin C on tooth growth in guinea pigs. The response is the length of odontoblasts (cells responsible for tooth growth) in 60 guinea pigs. Each animal received one of three dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid (a form of vitamin C and coded as VC). This report will demonstrate that although orange juice is a more effective delivery method than ascorbic acid this result is not statistically significant at a dosage level of 2 mg/day.
Load the data set ToothGrowth and display the structure of the data.
library(datasets)
data(ToothGrowth) # Load the data
str(ToothGrowth) # and display the structure
## '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 ...
Reveals a dataset with 60 observations and 3 variables as follows:
len is the numeric tooth length measurement (unit of measurement is unknown)
supp is the delivery method of Vitamin C supplement - orange juice (OJ) or ascorbic acid (VC)
dose is the dosage of the supplement - 0.5, 1.0 or 2.0 mg/day
A plot of the data is shown in Figure 1 below.
library(ggplot2)
ggplot(ToothGrowth, aes(x=factor(dose), y=len, fill=factor(dose), color=factor(dose)))+
geom_point()+
stat_summary(geom = "point",
fun = "mean",
col = "black",
size = 3,
shape = 24,
fill = "red")+
facet_grid(.~supp)+
labs(x = "Dose", y = "Length")
Figure 1: A scatter plot of the ToothGrowth data: length vs dose, given type of supplement. The red triangles representing the average length at each dose for the given type of supplement.
A visual inspection of the plot would suggest that orange juice is a more effective delivery method because the mean response (represented by the red triangles) at each dosage level is greater than or equal to that of delivery by ascorbic acid. However, the significance of the dosage level is less clear at the upper level of 2 mg/day.
The first hypothesis to be tested is that delivering vitamin C via orange juice promotes more tooth growth in guinea pigs than ascorbic acid when the dosage level is disregarded.
To test this hypothesis we first need to separate the observed data by delivery method.
oj.H1 <- subset(ToothGrowth, supp == "OJ") # Delivery by Orange Juice (OJ)
vc.H1 <- subset(ToothGrowth, supp == "VC") # Delivery by Ascorbic acid (VC)
A one-sided hypothesis test will be conducted with unequal variances and a 95% confidence interval.
t.test(oj.H1$len, vc.H1$len, alternative = "greater", var.equal = FALSE, conf.level = 0.95)
##
## Welch Two Sample t-test
##
## data: oj.H1$len and vc.H1$len
## t = 1.9153, df = 55.309, p-value = 0.03032
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 0.4682687 Inf
## sample estimates:
## mean of x mean of y
## 20.66333 16.96333
The result has a t-statistic (1.91) that is statistically significant, meaning that the difference between the sample means of the delivery method is unlikely to have occurred by chance. A low P-value of 0.03 means that there is only a 3% chance of finding a difference as large as (or larger than) the result. Zero is not included in the 95% confidence level. This result confirms the hypothesis that orange juice is a more effective delivery method than ascorbic acid.
The second hypothesis to be tested is that there is no statistical difference in tooth growth using either orange juice or ascorbic acid at a dose level of 2 mg/day
To test this hypothesis we first need to separate the observed data by delivery method and dosage level.
oj.H2 <- subset(ToothGrowth, ToothGrowth$supp == "OJ" & ToothGrowth$dose == "2")
vc.H2 <- subset(ToothGrowth, ToothGrowth$supp == "VC" & ToothGrowth$dose == "2")
A two-sided hypothesis test will be conducted with unequal variances and a 95% confidence interval.
t.test(oj.H2$len, vc.H2$len, var.equal = FALSE, conf.level = 0.95)
##
## Welch Two Sample t-test
##
## data: oj.H2$len and vc.H2$len
## t = -0.046136, 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 of x mean of y
## 26.06 26.14
The result has a very high P-value of 0.96 meaning there is a 96% chance of finding a difference as large as (or larger than) the result. Zero is included in the 95% confidence level which implies that the dosage level could have a positive or negative effect on tooth growth. This result confirms the hypothesis that there does not seem to be a statistical difference in tooth growth at the dosage level of 2 mg/day for either delivery method.
The results show that delivery using orange juice seems to be statistically better than than delivery via ascorbic acid for tooth growth in guinea pigs and that there does not seem to be any statistical difference in tooth growth for either supplement at 2 mg/day.