1. Overview

The purpose of the this data analysis is to analyze the ToothGrowth data set by comparing the guinea tooth growth by supplement and dose.

2. Loading the data and performing basic exploratory data analysis

How the data looks like

library(datasets)
library(ggplot2)
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)

Plot the data

plot <- ggplot(ToothGrowth, 
               aes(x=factor(dose),y=len,fill=factor(dose)))
plot + geom_boxplot(notch=F) + facet_grid(.~supp) + scale_x_discrete("Dose (Mg)") +   
     scale_y_continuous("Toothlength") +  
     ggtitle("Guinea pig length of teeth by dosage by type of supplement")

The plots demonstrate that increasing dosage increases teethlength and orange juice is more effective for small dosage, while when dosage is higher (2mg) both types of supplements are equally effective.

Basic summary of the data

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
table(ToothGrowth$supp, ToothGrowth$dose)
##     
##      0.5  1  2
##   OJ  10 10 10
##   VC  10 10 10

Comparison of tooth growth by supp and dose by using confidence intervals

Hypothesis 1: “Orange juice & ascorbic acid deliver the same tooth growth across the data set”

h1<-t.test(len ~ supp, paired=F, var.equal=T, data=ToothGrowth)
h1$conf.int
## [1] -0.1670064  7.5670064
## attr(,"conf.level")
## [1] 0.95
h1$p.value
## [1] 0.06039337

The confidence intervals includes 0 and the p-value is greater than the threshold of 0.05. The null hypothesis cannot be rejected.

Hypothesis 2: “For the dosage of 0.5 Mg/day, the two supps deliver the same tooth growth”

h2<-t.test(len ~ supp, paired=F, var.equal=T, data= subset(ToothGrowth, dose == 0.5))
h2$conf.int
## [1] 1.770262 8.729738
## attr(,"conf.level")
## [1] 0.95
h2$p.value
## [1] 0.005303661

The confidence interval does not include 0 and the p-value is below the 0.05 threshold. The null hypothesis can be rejected. The alternative hypothesis that 0.5 mg/day dosage of orange juice delivers more tooth growth than ascorbic acid is accepted.

Hypothesis 3: “For the dosage of 1 mg/day, the two supps deliver the same tooth growth”

h3<-t.test(len ~ supp, paired=F, var.equal=T, data= subset(ToothGrowth, dose == 1))
h3$conf.int
## [1] 2.840692 9.019308
## attr(,"conf.level")
## [1] 0.95
h3$p.value
## [1] 0.0007807262

The confidence interval does not include 0 and the p-value is smaller than the 0.05 threshold. The null hypothesis can be rejected. The alternative hypothesis that 1 mg/day dosage of orange juice delivers more tooth growth than ascorbic acid is accepted.

Hypothesis 4: “For the dosage of 2 mg/day, the two supps deliver the same tooth growth”

h4<-t.test(len ~ supp, paired=F, var.equal=T, data= subset(ToothGrowth, dose == 2))
h4$conf.int
## [1] -3.722999  3.562999
## attr(,"conf.level")
## [1] 0.95
h4$p.value
## [1] 0.9637098

The confidence interval does include 0 and the p-value is larger than the 0.05 threshold. The null hypothesis cannot be rejected.

Conclusions and the assumptions applied

Conclusions

Orange juice is more effective supplement for tooth growth than ascorbic acid for dosages 0.5 Mg and 1.0 Mg per day. Orange juice and ascorbic acid are the same effective supplements when applied with dosage of 2.0 Mg per day. In general, however, based on the data provided we cannot conclude tha orange juice is more effective that ascorbic acid as a supplement for toogth growth.

Assumptions

  1. Toothlength data are normally distributed
  2. No other factors affected tooth length