ToothGrowth data in the R datasets package

Info

File Name: tooth_growth.Rmd
Date: 2014.11.22
Author: Luis Jaraquemada S.

Data loading

Abstract

In this article we analyze the dataset ToothGrowth from Dataset package in R. A general data exploration is conducted in order to realize the impact Vitamin C on Tooh Growth in Guinea Pigs.

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).

Our comparison is made based on t-test and confidence intervals, to reject or keep a Null Hypotesis.

Summary of the Data

The dataset ToothGrowth provides data frame with 60 observations on 3 variables.

  • [,1] len numeric Tooth length
  • [,2] supp factor Supplement type (VC or OJ).
  • [,3] dose numeric Dose in milligrams.

Note: The original dataset refers to Ascorbic Acid as VC. In the section: Manipulating Data we have renamed this to AscA.

head(ToothGrowth,3)
##    len supp dose
## 1  4.2   VC  0.5
## 2 11.5   VC  0.5
## 3  7.3   VC  0.5
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 ...
summary(ToothGrowth)
##       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

As seen in the next plot, qualitatively speaking, Orange Juice seems to be more effective in tooth growth, when the provision of Vitamin C to the guinea pigs is performed in lower doses: 0.5mg and 1mg.

For the case of higher doses: 2mg, it is seen from the same figure that there is no important difference in terms of the mean value of tooth length, however Ascorbic Acid (tagged as VC) shows higher variability, which can make us believe that Orange Juice is more accurate in the final effect on length that we can expect for a give dose (2mg).

Data for higher is not available at the moment of this report.

boxplot(len~supp*dose, data=ToothGrowth, notch=FALSE, col=(c("lightgray","beige")), main="Tooth Growth", xlab="Suppliment and Dose") 

The following is a simplified view of the same behavior as explained for the previous plot, but only focusing on mean values.

interaction.plot(ToothGrowth$dose, ToothGrowth$supp, ToothGrowth$len)

Manipulating data

In order to perform a comparison of the different Supplement Types in this study, we are here reshaping the data to a more convenient way. We are keeping 10 columns corresponding to one measurement of a Guinea Pigw which we assumes as correspondent to the same Guinea Pig per row.

ascA <- ToothGrowth[ToothGrowth$supp == 'VC',]
ascA.doses <- as.data.frame(with(ascA,split(len,dose)))
names(ascA.doses) <- c('ascA_0.5','ascA_1','ascA_1.5')

oraJ <- ToothGrowth[ToothGrowth$supp == 'OJ',]
oraJ.doses <- as.data.frame(with(oraJ,split(len,dose)))
names(oraJ.doses) <- c('oraJ_0.5','oraJ_1','oraJ_1.5')

toothGrowth.reshaped <- cbind(ascA.doses,oraJ.doses)
toothGrowth.reshaped
##    ascA_0.5 ascA_1 ascA_1.5 oraJ_0.5 oraJ_1 oraJ_1.5
## 1       4.2   16.5     23.6     15.2   19.7     25.5
## 2      11.5   16.5     18.5     21.5   23.3     26.4
## 3       7.3   15.2     33.9     17.6   23.6     22.4
## 4       5.8   17.3     25.5      9.7   26.4     24.5
## 5       6.4   22.5     26.4     14.5   20.0     24.8
## 6      10.0   17.3     32.5     10.0   25.2     30.9
## 7      11.2   13.6     26.7      8.2   25.8     26.4
## 8      11.2   14.5     21.5      9.4   21.2     27.3
## 9       5.2   18.8     23.3     16.5   14.5     29.4
## 10      7.0   15.5     29.5      9.7   27.3     23.0
summary(toothGrowth.reshaped)
##     ascA_0.5         ascA_1         ascA_1.5        oraJ_0.5    
##  Min.   : 4.20   Min.   :13.60   Min.   :18.50   Min.   : 8.20  
##  1st Qu.: 5.95   1st Qu.:15.28   1st Qu.:23.38   1st Qu.: 9.70  
##  Median : 7.15   Median :16.50   Median :25.95   Median :12.25  
##  Mean   : 7.98   Mean   :16.77   Mean   :26.14   Mean   :13.23  
##  3rd Qu.:10.90   3rd Qu.:17.30   3rd Qu.:28.80   3rd Qu.:16.18  
##  Max.   :11.50   Max.   :22.50   Max.   :33.90   Max.   :21.50  
##      oraJ_1         oraJ_1.5    
##  Min.   :14.50   Min.   :22.40  
##  1st Qu.:20.30   1st Qu.:24.57  
##  Median :23.45   Median :25.95  
##  Mean   :22.70   Mean   :26.06  
##  3rd Qu.:25.65   3rd Qu.:27.07  
##  Max.   :27.30   Max.   :30.90

We can see a quantification of some data provided visaully by the box plot from previous section.

t-test Based Comparison

We perform comparison based on T.Test Confidence intervals. Our assumptions as stated before consider the presence of a paired data of Guinea Pigs. Another consideration is that variance are considered to be different and therefore we set var.equal = F.

The comparison is conducted Dose-Wise, thus we provide a comparison for 0.5mg, 1mg and 2mg separately as follows.

We will analyze the difference of OrangeJuice effect in tooth length vs Ascorbic Acid effect in tooth length, considering that our null hypotesis (Ho) is that both supplements provide the same result in mean, it is : Mean of Tooth Length for Orange Juice is equal to Mean of Tooth Length for Ascorbic Acid.

Dose 0.5mg:

We conducted t.test for the lowest dose administration the Orange Juice and for Ascorbic Acid supplements:

t.test(toothGrowth.reshaped['oraJ_0.5'] - toothGrowth.reshaped['ascA_0.5'],var.equal = F)
## 
##  One Sample t-test
## 
## data:  toothGrowth.reshaped["oraJ_0.5"] - toothGrowth.reshaped["ascA_0.5"]
## t = 2.9791, df = 9, p-value = 0.01547
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  1.263458 9.236542
## sample estimates:
## mean of x 
##      5.25

We see from this test that we have 95% of probability that the confidence interval does not include our null hypotesis condition Mean OraJ - Mean AscA = 0, so we can reject the null hypotesis and conclude that Orange Juice has a higher effect on tooth growth than Ascorbic Acid for dose of 0.5mg.

Case of Dose = 1mg:

t.test(toothGrowth.reshaped['oraJ_1'] - toothGrowth.reshaped['ascA_1'],var.equal = F)
## 
##  One Sample t-test
## 
## data:  toothGrowth.reshaped["oraJ_1"] - toothGrowth.reshaped["ascA_1"]
## t = 3.3721, df = 9, p-value = 0.008229
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  1.951911 9.908089
## sample estimates:
## mean of x 
##      5.93

We see from this test that we have 95% of probability that the confidence interval does not include our null hypotesis condition Mean OraJ - Mean AscA = 0, so we can reject the null hypotesis and conclude that Orange Juice has a higher effect on tooth growth than Ascorbic Acid for dose of 1mg.

Case of Dose = 2mg:

t.test(toothGrowth.reshaped['oraJ_1.5'] - toothGrowth.reshaped['ascA_1.5'],var.equal = F)
## 
##  One Sample t-test
## 
## data:  toothGrowth.reshaped["oraJ_1.5"] - toothGrowth.reshaped["ascA_1.5"]
## t = -0.0426, df = 9, p-value = 0.967
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  -4.328976  4.168976
## sample estimates:
## mean of x 
##     -0.08

In this case we see from the test that we have 95% of probability that the confidence interval does include our null hypotesis condition Mean OraJ - Mean AscA = 0, so we have no evidence to reject the null hypotesis and we should consider that both supplements have similar effect on tooth growth for Dose of 2mg.

Conclusions

Based on our analysis of the ToothGrowth dataset, we conclude that provision of Vitamin C though administration of Orange Juice is more effective than Ascorbic Acid for low dose levels: 0.5mg and 1mg.
For high dose level 2mg, we have concluded that Orange Juice and Ascorbic Acid provide similar effects in Tooth Length Growth and there is no evidence to reject the null hypotesis, which states that both methods provide the equal mean effect.