Background

The ToothGrowth dataset refers to 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).

Question

Is orange juice more effective than ascorbic acid in producing odontoblasts of a minimum certain length?

Requirements

Procedure

  1. Load the ToothGrowth dataset.
  2. Create one data subset for ascorbic acid (VC) and one data subset for orange juice (OJ).
  3. Present a summary of the data.
    NOTE: The exploratory data plot shows that both delivery methods are effective at the higher doses (2 mg). However, at lower doses (<2 mg.), the orange juice seems to be more effetive. We want to determine the minimum odotoblast length at which the orange juice is more effective than VC, regardless of the dosage.
  4. Run a minimum hypothesized odontoblast length of 15 for VC.
  5. Run a minimum hypothesized odontoblast length of 15 for OJ.
  6. Compare and present the results.

R Code and Results

# Load libraries
require(graphics)

# Load the Tooth Growth data
data("ToothGrowth")
toothData <- as.data.frame(ToothGrowth)

# Present a summary of the data
str(toothData)
## '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 ...
summary(toothData)
##       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
coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth,
       xlab = "ToothGrowth data: length vs dose, given type of supplement")

# Create data subsets, one for VC and another one for OJ
vc <- toothData[toothData$supp == "VC",]
oj <- toothData[toothData$supp == "OJ",]

# Hypothesized minimum tooth growth length, using 0.05 significance level
mu0     <- 15
alpha   <- 0.05
z.alpha <- qnorm(1 - alpha)

# Hypothesis 1: Ascorbic Acid produces tooth growth of at least 15 units
mu    <- mean(vc$len)
sigma <- sd(vc$len)
n     <- nrow(vc)
zVC   <- (mu - mu0)/(sigma/sqrt(n))

# Test hypothesis 1
if (zVC >= z.alpha) {
  
  msgVC <- paste0("Result: The test statistic zVC = ", zVC, 
                " is greater than or equal to the critical value z.alpha = ", z.alpha, 
                ". Therefore, we fail to reject the hypothesis.")
} else {
  
  msgVC <- paste0("Result: The test statistic zVC = ", zVC, 
                " is less than the critical value z.alpha = ", z.alpha, 
                ". Therefore, we reject the hypothesis.")
  
}  # END if

# Hypothesis 2: Orange juice produces tooth growth of at least 15 units
mu    <- mean(oj$len)
sigma <- sd(oj$len)
n     <- nrow(oj)
zOJ   <- (mu - mu0)/(sigma/sqrt(n))

# Test hypothesis 2
if (zOJ >= z.alpha) {
  
  msgOJ <- paste0("Result: The test statistic zOJ = ", zOJ, 
                " is greater than or equal to the critical value z.alpha = ", z.alpha, 
                ". Therefore, we fail to reject the hypothesis.")
} else {
  
  msgOJ <- paste0("Result: The test statistic zOJ = ", zOJ, 
                " is less than the critical value z.alpha = ", z.alpha, 
                ". Therefore, we reject the hypothesis.")
  
}  # END if

# Display test results for Hypothesis 1 and 2
print("Hypothesis 1: Ascorbic Acid (VC) produces tooth growth of at least 15 units, regardless of the dosage."); print(msgVC)
## [1] "Hypothesis 1: Ascorbic Acid (VC) produces tooth growth of at least 15 units, regardless of the dosage."
## [1] "Result: The test statistic zVC = 1.30094147769581 is less than the critical value z.alpha = 1.64485362695147. Therefore, we reject the hypothesis."
print("Hypothesis 2: Orange juice (OJ) produces tooth growth of at least 15 units, regardless of the dosage.");  print(msgOJ)
## [1] "Hypothesis 2: Orange juice (OJ) produces tooth growth of at least 15 units, regardless of the dosage."
## [1] "Result: The test statistic zOJ = 4.69594542233164 is greater than or equal to the critical value z.alpha = 1.64485362695147. Therefore, we fail to reject the hypothesis."

Conclusions

  1. Rejected the hypothesis for VC.
  2. Failed to reject the hypothesis for OJ.

The orange juice is indeed more effective than ascorbic acid.

Appendix - Platform and Tools Used

sessionInfo()
## R version 3.2.2 (2015-08-14)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1
## 
## locale:
## [1] LC_COLLATE=English_United States.1252 
## [2] LC_CTYPE=English_United States.1252   
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C                          
## [5] LC_TIME=English_United States.1252    
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## loaded via a namespace (and not attached):
##  [1] magrittr_1.5    tools_3.2.2     htmltools_0.3   yaml_2.1.13    
##  [5] stringi_0.5-5   rmarkdown_0.9.2 knitr_1.12.3    stringr_1.0.0  
##  [9] digest_0.6.8    evaluate_0.8