Library and data set used:
library(ggplot2)
data(ToothGrowth)
Load the ToothGrowth data
- 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
- 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
- Using boxplot, it shows that dosage increase does impact teeth growth and OJ has a overall better result than VC.

Confidence intervals and hypothesis tests
- 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.
- P-value comparing delivery method with dosage fixed at 0.5 is 0.0064
- P-value comparing delivery method with dosage fixed at 1.0 is 0.001
- P-value comparing delivery method with dosage fixed at 2.0 is 0.9639
- 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.
- P-value comparing dosage 0.5 to 1.0 is 1.2683 × 10-7
- P-value comparing dosage 1.0 to 2.0 is 1.9064 × 10-5
- P-value comparing dosage 0.5 to 2.0 is 4.3975 × 10-14
Conclusion
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.
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.
t-test provides confidence on result without testing on so many guinea pigs.