This is part two to the two part projects (1. A simulation excercise, 2. Basic inferential data analysis). Here, I will investigate the sample dataset about ToothGrowth. This dataset contains observations of the effect of vitamin C on tooth growth in Guinea Pigs. The response variable is the length of teeth in each of 10 guinea pigs at three differnt doses (0.5, 1, 2mg) of Vitamin C with each of the two delivery methods (orange juice, ascorbic acid)
Loading the data set, and examining the overall structure.
## '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 ...
## 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
From the summary and the basic exploratory data analysis, we can determine that 30 observations are related to Orange Juice, and the other 30 with ascorbic acid. Looking at the overall length, we can also see that the teeth lengths vary from 4.20 to 33.90, and have a mean of 28.81 and median of 19.25.
We can also use a boxplot:
## Warning: package 'ggplot2' was built under R version 4.1.2
Based on the boxplot, at doses of 0.5 to 1.0, the OJ has a positive
correlation compred to with VC. However, at 2.0 mg, tooth growth is
relatively similar.
Let H0 = Orange Juice has an impact on tooth growing compared to ascorbic acid. Let H1 = Orange Juice does not have an impact on tooth growing compared to ascorbic acid.
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 1.9153, df = 55.309, p-value = 0.06063
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## -0.1710156 7.5710156
## sample estimates:
## mean in group OJ mean in group VC
## 20.66333 16.96333
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 3.0503, df = 36.553, p-value = 0.004239
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## 1.875234 9.304766
## sample estimates:
## mean in group OJ mean in group VC
## 17.965 12.375
##
## Welch Two Sample t-test
##
## data: len by supp
## t = -0.046136, df = 14.04, p-value = 0.9639
## alternative hypothesis: true difference in means between group OJ and group VC is not equal to 0
## 95 percent confidence interval:
## -3.79807 3.63807
## sample estimates:
## mean in group OJ mean in group VC
## 26.06 26.14
On a 95% CI, the first two tests do not include 0, and reveals that there is a statistically significant difference between OJ and CV. The impact decreases at higher levels, or 2mg as predicted in the boxplot.
Assuming the supplements (OJ and CV) were independently and identically distributed among subjects, we can conclude that orange juice would have a significant impact on tooth growth in Guinea Pigs as long as the dosage is not too high (above 2 mg).