Statistical Inference Project Part 2 - ToothGrowth Study with Vitamin Taken

Introduction

ToothGrowth data in the R datasets package is used for For this inferential data analysis. The data collected the length of odontoblasts in 60 guinea pigs. They are split equally to two groups, each with one of two delivery methods (orange juice or ascorbic acid which contains Vitamin C). Each group is equally split to 3 subgroups with three dose levels of Vitamin C (0.5, 1, and 2 mg).

R setup

Set to show R code.

library(knitr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
opts_chunk$set(echo=TRUE, cache=TRUE)

Data exporation, and then seperate the two groups.

Load dataset

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 ...
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
require(graphics)
coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth,
       xlab = "ToothGrowth data: length vs dose, given type of supplement")

The basic plot shows that the mean using OJ at lower doasage is higher than using VC at lower dosage. When the dosage reches 2mg, the difference between the two suppliments is much smaller.

Data preparation for the test.

df_1<-ToothGrowth%>%filter(dose==0.5)
df_2<-ToothGrowth%>%filter(dose==1)
df_3<-ToothGrowth%>%filter(dose==2)
df_12<-rbind(df_1,df_2)
df_13<-rbind(df_1,df_3)
df_23<-rbind(df_2,df_3)

Get the confidence level of the difference of the 2 supplements.

t.test(len ~ supp, paired = F, var.equal = F, data = ToothGrowth)
## 
##  Welch Two Sample t-test
## 
## data:  len by supp
## t = 1.9153, df = 55.309, p-value = 0.06063
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1710156  7.5710156
## sample estimates:
## mean in group OJ mean in group VC 
##         20.66333         16.96333

By comparing the intakes of OJ and VC, we find out that OJ has more impact on the teeth growth than VC.

Get the confidence level of the difference of the doses

Comapare 0.5mg and 1mg

t.test(len ~ dose, paired = F, var.equal = F, data = df_12)
## 
##  Welch Two Sample t-test
## 
## data:  len by dose
## t = -6.4766, df = 37.986, p-value = 1.268e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -11.983781  -6.276219
## sample estimates:
## mean in group 0.5   mean in group 1 
##            10.605            19.735

Compare the dose of 0.5mg with 1mg, 1mg dosage is more effective on the teeth growth.

Comapare 0.5mg and 2mg

t.test(len ~ dose, paired = F, var.equal = F, data = df_13)
## 
##  Welch Two Sample t-test
## 
## data:  len by dose
## t = -11.799, df = 36.883, p-value = 4.398e-14
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -18.15617 -12.83383
## sample estimates:
## mean in group 0.5   mean in group 2 
##            10.605            26.100

Compare the dose of 0.5mg with 2mg, 2mg dosage is much more effective on the teeth growth.

Comapare 1mg and 2mg

t.test(len ~ dose, paired = F, var.equal = F, data = df_23)
## 
##  Welch Two Sample t-test
## 
## data:  len by dose
## t = -4.9005, df = 37.101, p-value = 1.906e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -8.996481 -3.733519
## sample estimates:
## mean in group 1 mean in group 2 
##          19.735          26.100

Compare the dose of 2mg with 1mg, 2mg dosage is more effective on the teeth growth.
We can conclude that more dosage within 0.5mg-2mg range, the higher dosage, the more impact the vitamin C is on the teeth growth.

Get the confidence level of the difference of the 2 supplements with different doses

Get the confidence level of the difference of the 2 supplements with dose of 0.5mg.

t.test(len ~ supp, paired = F, var.equal = F, data = df_1)
## 
##  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

When the dosage is 0.5mg, OJ is more effective than VC.

Get the confidence level of the difference of the 2 supplements with dose of 1mg.

t.test(len ~ supp, paired = F, var.equal = F, data = df_2)
## 
##  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

When the dosage is 1mg, OJ is more effective than VC.

Get the confidence level of the difference of the 2 supplements with dose of 2mg.

t.test(len ~ supp, paired = F, var.equal = F, data = df_3)
## 
##  Welch Two Sample t-test
## 
## data:  len by supp
## 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 in group OJ mean in group VC 
##            26.06            26.14

When the dosage is 2mg, OJ is about the same effective as VC.

Assumptions

The experiment is based on the following assumptions: Guinea pigs are picked randomly that can represent the population. Two kinds of sumplements are given with different doses to ramdomly chosen amimals. The variances are assumed different for all the groups being compared for the t_tests.

Conclusion

Through the study of the dataset ToothGrowth, we made the following conclusions:

  1. Within the intake dosage range of 0.5mg-2mg, the more doses the animal take, the more the teeth grow.

  2. When the intake dosage is lower than 2mg, OJ is more efective on the teeth growth.

  3. When the intake dosage is about 2mg, OJ and VC are about the same.

The animal should take 2mg vitamin C each day to get high teeth growth. Either VC or OJ is fine.