This study aims to determine if delivery method and/or dosage of vitamin C affect tooth growth in guinea pigs. The dataset comes from C. I. Bliss from The Statistics of Bioassay (1952). Where the dataset 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). We will use statistical inference to make conclusions about the data.
# Load Library Packages
library(datasets)
library(ggplot2)
library(dplyr)
library(knitr)
# Load the ToothGrowth data set from the package: "datasets"
data("ToothGrowth")
# Inspect the data
glimpse(ToothGrowth)
## Observations: 60
## Variables: 3
## $ len (dbl) 4.2, 11.5, 7.3, 5.8, 6.4, 10.0, 11.2, 11.2, 5.2, 7.0, 16....
## $ supp (fctr) VC, VC, VC, VC, VC, VC, VC, VC, VC, VC, VC, VC, VC, VC, ...
## $ dose (dbl) 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 1....
# It has 60 rows and 3 columns
# The first column "len" records the length of the tooth.
# The second column "supp" records whether the delivery method of
# Vitamin C: orange juice (OJ) or asorbic acid (VC)
# The third column "dose" records the dose of vitamin C in milligrams.
# Is there any missing data?
sum(!complete.cases(ToothGrowth))
## [1] 0
# No
# Find the length, mean, standard deviation and standard
# error for each group of supplement and dose
tg <- ToothGrowth %>% group_by(supp, dose) %>% summarize(n = length(len),
mean = mean(len),
sd = sd(len),
se = sd / sqrt(n))
kable(tg, digits = 3)
| supp | dose | n | mean | sd | se |
|---|---|---|---|---|---|
| OJ | 0.5 | 10 | 13.23 | 4.460 | 1.410 |
| OJ | 1.0 | 10 | 22.70 | 3.911 | 1.237 |
| OJ | 2.0 | 10 | 26.06 | 2.655 | 0.840 |
| VC | 0.5 | 10 | 7.98 | 2.747 | 0.869 |
| VC | 1.0 | 10 | 16.77 | 2.515 | 0.795 |
| VC | 2.0 | 10 | 26.14 | 4.798 | 1.517 |
# Graph the standard error of the mean
s <- ggplot(tg, aes(x = dose, y = mean, color = supp))
s + geom_errorbar(aes(ymin = mean - se, ymax = mean + se), width = .1) +
geom_line(size = 1.25) +
geom_point(size = 2, shape = 21, fill = "black") +
xlab("Dose (mg)") + ylab("Tooth Length") +
ggtitle("Tooth Length in Guinea Pigs") +
theme(legend.justification = c(1,0),
legend.position = c(1,0))
Analysis:
After inspecting the data and chart it appears that dosage has some effect on the length of teeth. Lower dosages (0.5 and 1.0) appear to effect the length of teeth more than the 2.0 dose. For the supplement type it is hard to determine what is going on just by observing the data.
There is very little information on how this study was constructed. I could find no additional data on the study online. The R Documentation for the ToothGrowth dataset only says the length of the teeth “in each of 10 guinea pigs.”
Key Assumptions:
* The population was comprised of similar guinea pigs
* The population is independent with different variances
* Because the sample size is small (60) use a T distribution
We will use hypothesis testing to test whether we can or cannot reject our null hypothesis.
# Filter ToothGrowth data by supplement and dose for use in confidence intervals
# supplement
vc <- ToothGrowth %>% filter(supp == "VC")
oj <- ToothGrowth %>% filter(supp == "OJ")
# dose
dose.5 <- ToothGrowth %>% filter(dose == 0.5)
dose1 <- ToothGrowth %>% filter(dose == 1.0)
dose2 <- ToothGrowth %>% filter(dose == 2.0)
Null hypothesis H0: dose does not have an impact on tooth growth.
# 95% t confidence interval by dose: 0.5, 1.0, 2.0
# dose 0.5 vs dose 1.0
t.test(dose.5$len, dose1$len, paired = FALSE, var.equal = FALSE)$conf
## [1] -11.983781 -6.276219
## attr(,"conf.level")
## [1] 0.95
t.test(dose.5$len, dose1$len, paired = FALSE, var.equal = FALSE)$p.value
## [1] 1.268301e-07
# dose 0.5 vs dose 2.0
t.test(dose.5$len, dose2$len, paired = FALSE, var.equal = FALSE)$conf
## [1] -18.15617 -12.83383
## attr(,"conf.level")
## [1] 0.95
t.test(dose.5$len, dose2$len, paired = FALSE, var.equal = FALSE)$p.value
## [1] 4.397525e-14
# dose 1.0 vs dose 2.0
t.test(dose1$len, dose2$len, paired = FALSE, var.equal = FALSE)$conf
## [1] -8.996481 -3.733519
## attr(,"conf.level")
## [1] 0.95
t.test(dose1$len, dose2$len, paired = FALSE, var.equal = FALSE)$p.value
## [1] 1.90643e-05
Analysis: The p-values for all of the dosage intervals are less than alpha at 0.05 and none of the confidence intervals contain zero, so we can reject the null hypothesis. Therefore, increased levels of vitamin C increase the tooth length in guinea pigs.
Null hypothesis H0: different supplement types (orange juice and ascorbic acid) have no effect on tooth growth.
# 95% t Confidence Interval by supplement: orange juice and ascorbic acid
t.test(oj$len, vc$len, paired = FALSE, var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: oj$len and vc$len
## 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 of x mean of y
## 20.66333 16.96333
Analysis: The confidence interval contains zero and the p-value is greater than alpha at 0.05. So, we cannot reject the null hypothesis that supplements have no effect on tooth growth in guinea pigs.
Do delivery method and/or dosage affect tooth growth in guinea pigs?
After inspecting the data and performing hypothesis testing on the data, increasing the dose levels of vitamin C leads to increased tooth growth guinea pigs.
However, supplement type has no effect on tooth growth in guinea pigs.