library(knitr)
library(ggplot2)
opts_chunk$set(echo=TRUE, results='markup')

Load the ToothGrowth data and perform some basic exploratory data analyses

data(ToothGrowth)
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
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: Factor w/ 3 levels "0.5","1","2": 1 1 1 1 1 1 1 1 1 1 ...

The number of variables is 3:

  1. Numeric Tooth lenght
  2. Supplement type (VC or OJ)
  3. Dose in miligrams

and are 60 observation on the set.

Provide a basic summary of the data.

summary(ToothGrowth)
##       len       supp     dose   
##  Min.   : 4.2   OJ:30   0.5:20  
##  1st Qu.:13.1   VC:30   1  :20  
##  Median :19.2           2  :20  
##  Mean   :18.8                   
##  3rd Qu.:25.3                   
##  Max.   :33.9
ggplot(data = ToothGrowth, aes(x = dose, y = len, fill = supp)) + geom_bar(stat = "identity") + facet_grid(. ~ supp) + xlab("Dose in miligrams") + ylab("Numeric Tooth lenght")

plot of chunk unnamed-chunk-3

Use confidence intervals and/or hypothesis tests to compare tooth growth by supp and dose.

t.test(len ~ supp, paired = F, var.equal = F, data = ToothGrowth)
## 
##  Welch Two Sample t-test
## 
## data:  len by supp
## t = 1.915, df = 55.31, p-value = 0.06063
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.171  7.571
## sample estimates:
## mean in group OJ mean in group VC 
##            20.66            16.96

State your conclusions and the assumptions needed for your conclusions.

  1. The delivery method doesn’t matter. We can’t reject the null hypothesis that the difference of the means by delvery method is 0. The p-value is 0.06. The delivery method does not affect the Tooth lenght.
  2. The more vitamin C the guinea pigs get, the more bigger their tooths are.
  3. No matter if it ingested via orange juice or ascorbic acid.