Library and data set used:

library(ggplot2)
data(ToothGrowth)

Load the ToothGrowth data

  1. The top 20 records of the ToothGrowth Data, shows three columns in data set, len is the length of the teeth, supp is the delivery method used, and lastly dose is the amount of treatment given to the teeth.
##    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
  1. The summary of the data shows len has value range between 4.2 to 33.9. The supp is either OJ (orange juice) or VC (vitamine C). And lastly, dose has value range between 0.5 to 2.0.
##       len       supp         dose     
##  Min.   : 4.2   OJ:30   Min.   :0.50  
##  1st Qu.:13.1   VC:30   1st Qu.:0.50  
##  Median :19.2           Median :1.00  
##  Mean   :18.8           Mean   :1.17  
##  3rd Qu.:25.3           3rd Qu.:2.00  
##  Max.   :33.9           Max.   :2.00
  1. Using boxplot, it shows that dosage increase does impact teeth growth and OJ has a overall better result than VC.

plot of chunk unnamed-chunk-4

Confidence intervals and hypothesis tests

  1. Examine the p-value at each fix dosage, and compare delivery method. Since all dosage tests have equals test sample, set pooled to False (var.equal), and all subject are random, set paired to False as well. From the reuslt, both 0.5 and 1.0 dosage tests can reject the null hypothesis and be confident that there is significant impact on the tooth length between OJ vs VC. For 2.0 dosage, the p-value suggests keeping the null hypothesis.
  1. Examine the p-value when delivery method are not considered. The p-value is calculated purely on different dosage. Reading the p-value from the result, all three dosage comparison can have their null hypothesis rejected.

Conclusion

  1. Looking at the boxplot, we see a clear impact on tooth length on both delivery method when the dosage increases, and this is also supported by the t-test.

  2. When fixing the dosage level and comparing the two delivery methods, boxplot again tells quickly that there is noticeable difference between dosage 0.5 and 1, but not much between 2.0. Again, this hunch is supported after running the t-test.

  3. t-test provides confidence on result without testing on so many guinea pigs.