Comparing Tooth Growth by Supplement Type and Dosage

by Davin Kaing

Description

As part of the Coursera’s Data Science Specialization course, “Statistical Inference,” this project explores the tooth growth from supplement type and dosage.

Coding and Analysis

Loading and Summary of Data

The data is loaded in R and a summary is provided.

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

Exploratory Plot of Data

The following plot is an exploratory data analyses of the data.

boxplot(len~dose + supp, data = ToothGrowth, main = "Comparing Tooth Growth by Supplements and Dose", xlab = "Supplement Type and Dose", ylab = "Tooth Growth")

Assigning Data According to Dosage and Supplement

The appropriate were separated according to dosage and supplement type.

VC05 <- ToothGrowth[1:10,]
VC1 <- ToothGrowth[11:20,]
VC2 <- ToothGrowth[21:30,]
OJ05 <- ToothGrowth[31:40,]
OJ1 <- ToothGrowth[41:50,]
OJ2 <- ToothGrowth[51:60,]

ToothGrowth Affected by Dosage

The following t-test summarizes the toothgrowth affected by the dosage level.

t.test(OJ1$len, OJ05$len)
## 
##  Welch Two Sample t-test
## 
## data:  OJ1$len and OJ05$len
## t = 5.0486, df = 17.698, p-value = 8.785e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   5.524366 13.415634
## sample estimates:
## mean of x mean of y 
##     22.70     13.23
t.test(OJ2$len, OJ1$len)
## 
##  Welch Two Sample t-test
## 
## data:  OJ2$len and OJ1$len
## t = 2.2478, df = 15.842, p-value = 0.0392
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.1885575 6.5314425
## sample estimates:
## mean of x mean of y 
##     26.06     22.70
t.test(VC1$len, VC05$len)
## 
##  Welch Two Sample t-test
## 
## data:  VC1$len and VC05$len
## t = 7.4634, df = 17.862, p-value = 6.811e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   6.314288 11.265712
## sample estimates:
## mean of x mean of y 
##     16.77      7.98
t.test(VC2$len, VC1$len)
## 
##  Welch Two Sample t-test
## 
## data:  VC2$len and VC1$len
## t = 5.4698, df = 13.6, p-value = 9.156e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   5.685733 13.054267
## sample estimates:
## mean of x mean of y 
##     26.14     16.77

ToothGrowth Affected by Supplement Type

t.test(ToothGrowth$len[1:30], ToothGrowth$len[31:60])
## 
##  Welch Two Sample t-test
## 
## data:  ToothGrowth$len[1:30] and ToothGrowth$len[31:60]
## 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:
##  -7.5710156  0.1710156
## sample estimates:
## mean of x mean of y 
##  16.96333  20.66333
t.test(VC05$len, OJ05$len)
## 
##  Welch Two Sample t-test
## 
## data:  VC05$len and OJ05$len
## 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:
##  -8.780943 -1.719057
## sample estimates:
## mean of x mean of y 
##      7.98     13.23
t.test(VC1$len, OJ1$len)
## 
##  Welch Two Sample t-test
## 
## data:  VC1$len and OJ1$len
## 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:
##  -9.057852 -2.802148
## sample estimates:
## mean of x mean of y 
##     16.77     22.70
t.test(VC2$len, OJ2$len)
## 
##  Welch Two Sample t-test
## 
## data:  VC2$len and OJ2$len
## 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.63807  3.79807
## sample estimates:
## mean of x mean of y 
##     26.14     26.06

Conclusion

From the t-test analyses, the tooth growth is affected by the dosage level. Higer dosage leads to higher growth. This is concluded from the positive confidence interval of the t-test data comparing the different dosage level. For the supplement type, there is no significant changes between the supplement type and toothgrowth. As evident in the analyses above, when comparing 0.5 and 1 dosage of VC and OJ, the 95% confidence interval include negative values indicating a decrease in growth; however, when VC2 is compared with OJ2, there is a negative and positive value in the confidence interval. This information indicate that there isn’t a significant difference in the tooth growth and supplement type.