Below is a datagram showing The Effect of Vitamin C on Tooth Growth in Guinea Pigs
## '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 ...
The Plots below show a comparison between delivery method and dosage.
We can observe the trend where Orange Juice as a supplement has makes the Guinea Pig’s tooth longer, except when a the Dose is 2 milligrams/day. Making ascorbic acid more effective in higher dosage.
I created sample means of the amount of growth expected for the two options:
Guinea pigs who receive a supplement as ascorbic acid (any dosage)
Guinea pigs who receive 2 mg of the supplement, delivered via orange juice
t.test(S1$len, conf.level = .95)
##
## One Sample t-test
##
## data: S1$len
## t = 11.24, df = 29, p-value = 4.363e-12
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 13.87675 20.04992
## sample estimates:
## mean of x
## 16.96333
t.test(S3$len, conf.level = .95)
##
## One Sample t-test
##
## data: S3$len
## t = 31.038, df = 9, p-value = 1.833e-10
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 24.16069 27.95931
## sample estimates:
## mean of x
## 26.06
I conducted hypothesis tests to compare mean growth between several different pairs.
I test the hypotheses \(H_0 : \mu _{VC} = \mu _{OJ}\) versus \(H_a : \mu _{VC} \ne \mu _{OJ}\)
t <- t.test(len~supp,ToothGrowth)
##
## 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 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
The t-statistic of the test was 1.9152683 and the p-value was 0.0606345
The result shows that in this test we fail to reject the null hypothesis, meaning that it is not significant at a standard significance level of 0.5. The Orange Juice and Abscorbic acid mean populations do not show a big difference between them.
I test the hypotheses \(H_0 : \mu _{1mg} = \mu _{2mg}\) versus \(H_a : \mu _{1mg} < \mu _{2mg}\)
S4<- filter(S2, dose == 1.0 | dose == 2.0)
t <- t.test(len~dose, S4,alternative = "less")
##
## Welch Two Sample t-test
##
## data: len by dose
## t = -2.2478, df = 15.842, p-value = 0.0196
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -0.7486236
## sample estimates:
## mean in group 1 mean in group 2
## 22.70 26.06
The t-statistic of the test was -2.2477612 and the p-value was 0.0195976
The result shows that in this test we reject the null hypothesis, meaning that it is significant at a standard significance level of 0.5. 1mg from Orange Juice and 2mg of Orange Juice populations show a notable difference between them, the 1mg population mean being less than the 2mg population.
I test the hypotheses \(H_0 : \mu _{1mg} = \mu _{2mg}\) versus \(H_a : \mu _{1mg} < \mu _{2mg}\)
S5<- filter(S1, dose == 1.0 | dose == 2.0)
t <- t.test(len~dose, S5,alternative= "less")
##
## Welch Two Sample t-test
##
## data: len by dose
## t = -5.4698, df = 13.6, p-value = 4.578e-05
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -6.346525
## sample estimates:
## mean in group 1 mean in group 2
## 16.77 26.14
The t-statistic of the test was -5.4698137 and the p-value was 4.577801510^{-5}
The result shows that in test this we reject the null hypothesis, meaning that it is significant at a standard significance level of 0.5. 1mg from Abscorbic acid and 2mg of Abscorbic acid populations show a notable difference between them, the 1mg population mean being less than the 2mg population.
I test the hypotheses \(H_0 : \mu _{1mg VC} = \mu _{1mg OJ}\) versus \(H_a : \mu _{1mg VC} \ne \mu _{1mg OJ}\)
Both <- filter(ToothGrowth, dose == 1.0)
t <- t.test(len~supp, Both)
##
## Welch Two Sample t-test
##
## data: len by supp
## t = 4.0328, df = 15.358, p-value = 0.001038
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 2.802148 9.057852
## sample estimates:
## mean in group OJ mean in group VC
## 22.70 16.77
The t-statistic of the test was 4.0327696 and the p-value was 0.0010384
The result shows that in this test we reject the null hypothesis, meaning that it is significant at a standard significance level of 0.5. The 1mg from Orange Juice and 1mg from Abscorbic acid mean populations show a notable difference between them.
I test the hypotheses \(H_0 : \mu _{2mg VC} = \mu _{2mg OJ}\) versus \(H_a : \mu _{2mg VC} \ne \mu _{2mg OJ}\)
Both <- filter(ToothGrowth, dose == 2.0)
t <- t.test(len~supp, Both)
##
## 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 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
The t-statistic of the test was -0.0461361 and the p-value was 0.9638516
The result shows that in this test we fail to reject the null hypothesis, meaning that it is not significant at a standard significance level of 0.5. The Orange Juice and Abscorbic acid mean populations do not show a big difference between them.