The response is the length of odontoblasts (cells responsible for tooth growth) in 60 guinea pigs. Each animal received one of three dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid (a form of vitamin C and coded as VC).
## '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 0.5:20
## 1st Qu.:13.07 VC:30 1 :20
## Median :19.25 2 :20
## Mean :18.81
## 3rd Qu.:25.27
## Max. :33.90
We can infer that for dose levels of 0.5 and 1, Orange Juice (OJ) delivery resulted in longer tooth lengths that VC except for dose level 2 where VC delivery had both extreme tooth lengths.
library(ggplot2)
ggplot(ToothGrowth) +
aes(x = "", y = len, fill = supp) +
geom_boxplot() +
scale_fill_hue() +
labs(x = "Dose levels", y = "Tooth Lenght", title = "Boxplot of Dose Levls") +
theme_linedraw() +
facet_wrap(vars(dose))Check how many Dose were delivery via each method
Equal number of dose were delivered in each case as shown below
##
## 0.5 1 2
## OJ 10 10 10
## VC 10 10 10
paired = F##
## 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
Here H0: There's no difference in average tooth-length of supplemetary delivery. Since the CI -0.1710156 7.5710156 contains zero and also the p-value: .006 is greater that alpha of .5, we fail to reject the null hypothesis in favor of H0
I will create a utility function to subset data
tooth_sub <- function(sub){
return(subset(ToothGrowth, dose %in% sub))
}
Dose_05_10 <- tooth_sub(c(0.5, 1))
Dose_05_20 <- tooth_sub(c(0.5, 2))
Dose_10_20 <- tooth_sub(c(1, 2))
Dose_05 <- tooth_sub(c(0.5))
Dose_10 <- tooth_sub(c(1))
Dose_20 <- tooth_sub(c( 2)).5 and 1##
## Welch Two Sample t-test
##
## data: len by dose
## t = -6.4766, df = 37.986, p-value = 1.268e-07
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -11.983781 -6.276219
## sample estimates:
## mean in group 0.5 mean in group 1
## 10.605 19.735
Here H0: There's no difference between dose level .5 average tooth-length and dose level 1. Since the CI does not contain zero and also the p-value is less than alpha of .5, we reject the null hypothesis in favor of Ha and conclude average Tooth-growth differ
.5 and 2##
## Welch Two Sample t-test
##
## data: len by dose
## t = -11.799, df = 36.883, p-value = 4.398e-14
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -18.15617 -12.83383
## sample estimates:
## mean in group 0.5 mean in group 2
## 10.605 26.100
Here H0: There's no difference between dose level .5 average tooth-length and dose level 2. Since the CI does not contain zero and also the p-value is less than alpha of .5, we again reject the null hypothesis in favor of Ha and conclude average Tooth-growth differ
.5 and 1##
## Welch Two Sample t-test
##
## data: len by dose
## t = -4.9005, df = 37.101, p-value = 1.906e-05
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -8.996481 -3.733519
## sample estimates:
## mean in group 1 mean in group 2
## 19.735 26.100
Here H0: There's no difference between dose level 1 average tooth-length and dose level 2. Since the CI does not contain zero and also the p-value is less than alpha of .5, we reject the null hypothesis in favor of Ha and conclude average Tooth-growth differ
Here H0: There's no difference in average tooth-length of supplemetary delivery for all 3 cases
.5##
## Welch Two Sample t-test
##
## data: len by supp
## t = 3.1697, df = 14.969, p-value = 0.006359
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.719057 8.780943
## sample estimates:
## mean in group OJ mean in group VC
## 13.23 7.98
1##
## 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
2.5, we fail to reject the null hypothesis conclude average Tooth-growth does not differ##
## 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 sample, in particular guinea pigs is a representative of the population of guinea pigs. This assumption allows us to generalize results
Guinea pigs were randomly assigned to different levels of dose levels and delivery methods to take care of noise
Supplementary delivery alone has no effect on the average tooth growth
For dose levels of 0.5 and 1, Orange Juice (OJ) delivery resulted in longer tooth lengths that VC except for dose level 2 where VC delivery had both extreme tooth lengths.
Tooth growth differ between each two dose levels, thus increase in dose level results in increased tooth length