This document aims at performing a statistical inference analysis on the ToothGrowth dataset in order to assess Vitamine C effect on Tooth Growth in 60 Guinea pigs that have received Vitamin C in different doses and through different delivery methods.
data("ToothGrowth")
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
dim(ToothGrowth)
## [1] 60 3
The dataset is composed of 60 rows and 3 columns. Each row refers to a different Guinea pig. The first column “len” refers to the Tooth Length, in odontoblasts, of a Guinea pig. The second colum “supp” refers to the way by which the Vitamine C was delivered to the Guinea pig. Two supplement methods exist: Orange Juice (OJ) and Ascorbic acid (VC). The third column refers to the dose in mg of vitamine C injected to the guinea pig, available doses being 0.5, 1 or 2 mg. Each group of 10 Guinea pigs in the dataset are subject to a similar treatment in terms of Vitamine C supplement method and dose.
In order to get a better overview of the dataset, we plot below the evolution of the tooth length of Guinea pigs per supplement type and Vitamine C dose.
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.4
g <- ggplot(ToothGrowth, aes(supp, len)) + geom_boxplot(aes(fill=factor(dose)))+
xlab("Supplement type (VC or OJ)") + ylab("Tooth Length") +
ggtitle("Effect of Vitamin C on Tooth Growth")
g
##Calculating the confidence Intervals
In order to compare tooth growth per supplement type and dose, we subset our dataset into 6 different subsets, each referring to a supplement type and a Vitamine C dose. We then calculate the confidence interval for each of the obtained subsets.
set1 <- subset(ToothGrowth,supp=="OJ"& dose==0.5,len)
confInter1 <- mean(set1$len)+c(-1,1)*qnorm(0.975)*sd(set1$len)/sqrt(10)
set2 <- subset(ToothGrowth,supp=="OJ"& dose==1,len)
confInter2 <- mean(set2$len)+c(-1,1)*qnorm(0.975)*sd(set2$len)/sqrt(10)
set3 <- subset(ToothGrowth,supp=="OJ"& dose==2,len)
confInter3 <- mean(set3$len)+c(-1,1)*qnorm(0.975)*sd(set3$len)/sqrt(10)
set4 <- subset(ToothGrowth,supp=="VC"& dose==0.5,len)
confInter4 <- mean(set4$len)+c(-1,1)*qnorm(0.975)*sd(set4$len)/sqrt(10)
set5 <- subset(ToothGrowth,supp=="VC"& dose==1,len)
confInter5 <- mean(set5$len)+c(-1,1)*qnorm(0.975)*sd(set5$len)/sqrt(10)
set6 <- subset(ToothGrowth,supp=="VC"& dose==2,len)
confInter6 <- mean(set6$len)+c(-1,1)*qnorm(0.975)*sd(set6$len)/sqrt(10)
Result of the calculation is in table below:
row1 <- c("OJ",0.5,round(confInter1[1],2),round(confInter1[2],2))
row2 <- c("OJ",1,round(confInter2[1],2),round(confInter2[2],2))
row3 <- c("OJ",2,round(confInter3[1],2),round(confInter3[2],2))
row4 <- c("VC",0.5,round(confInter4[1],2),round(confInter4[2],2))
row5 <- c("VC",1,round(confInter5[1],2),round(confInter5[2],2))
row6 <- c("VC",2,round(confInter6[1],2),round(confInter6[2],2))
m <- rbind(row1,row2,row3,row4,row5,row6)
rownames(m) <- c('','','','','','')
colnames(m) <- c('Supp Type', 'Dose','Tooth Len lower end', 'Tooth Len Higher end')
library(gridExtra)
grid.table(m)
From the results above, and assuming that all acceptable tooth growth values are within the confidence intervals of different pigs groups, the following conclusions can be reached:
For both supplement types (OJ and VC), an increase of the dose of delivered vitamine C results in a better tooth growth of guinea pigs.
For the pigs receiving a 0.5 mg and a 1 mg doses of Vitamine C, we note that those that had these doses supplemented through Orange Juice (OJ) present a better tooth growth than those who has it supplemented through ascorbic acid (VC).
For the pigs receiving a 2 mg dose of Vitamine C, we note that the same average tooth growth is observed for both pigs groups receiving this dose through VC or OJ supplement methods. As the confidence interval of the group receiving this dose through VC is wider, we can state that the highest tooth growth is witnessed for guinea pigs within this group.