This is the second part the statistical inference project which involves basic inferential data analysis of the toothgrowth data set in R.
We load the ToothGrowth data with:
library(datasets)
data(ToothGrowth)
str(ToothGrowth)
## '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 response is the length of odontoblasts (teeth) in each of 10 guinea pigs at each of three dose levels of Vitamin C (0.5, 1, and 2 mg) with each of two delivery methods (orange juice or ascorbic acid). ## Format A data frame with 60 observations on 3 variables namely:
len (numeric)-> Tooth length supp (factor)-> Supplement type (VC (ascorbic acid) or OJ (orange juice)) dose (numeric)-> Dose in milligrams
library(graphics)
coplot(len ~ dose | supp, ToothGrowth, panel = panel.smooth,
show.given = FALSE, ylab = "Length (units?)",
xlab = c("Dose (mg)",
"Tooth Growth given Orange Juice (Left) or Ascorbic Acid (Right)"))
To analyze tooth growth, we carry out two-sample (orange juice vs. ascorbic acid) T-tests at each dosage level.
The T-test at 0.5 mg yields:
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == .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
The T-test at 1 mg yields:
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == 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
The T-test at 2 mg yields:
t.test(len ~ supp, ToothGrowth[ToothGrowth$dose == 2, ])
##
## 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 dataset as presented in R has little supporting documentation, but it was assumed that the data is not paired data i.e (paired=FALSE).It was also assumed there’s a no common variance in the guinea pigs population i.e. (var.equal=FALSE).
From the exploratory data analysis, it is observed that increased vitamin C dosages in either form (i.e. orange juice or pure ascorbic acid) is an effective catalyst for tooth growth.
From the T-test analysis above, we conclude from the statistically significant p-values that for dosages of 0.5 mg and 1 mg, orange juice is more effective at promoting tooth growth than just ascorbic acid. From the p-value for the 2 mg, we cannot conclude that orange juice promotes tooth growth more effectively than just ascorbic acid.