Project - Statistical Inference - part 2 - The Effect of Vitamin C on Tooth Growth in Guinea Pigs
Sergio Vicente Simioni
May, 18, 2015
SYNOPSIS
This second portion of the class, we’re going to analyze the ToothGrowth data in the R datasets package.
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).
Load the ToothGrowth data and perform some basic exploratory data analyses Provide a basic summary of the data. Use confidence intervals and/or hypothesis tests to compare tooth growth by supp and dose.
DATA PROCESSING
library(ggplot2)
ToothGrowth$supp<- gsub("VC", "Vitamin C" ,ToothGrowth$supp)
ToothGrowth$supp<- gsub("OJ", "Orange Juice" ,ToothGrowth$supp)
head(ToothGrowth)
## len supp dose
## 1 4.2 Vitamin C 0.5
## 2 11.5 Vitamin C 0.5
## 3 7.3 Vitamin C 0.5
## 4 5.8 Vitamin C 0.5
## 5 6.4 Vitamin C 0.5
## 6 10.0 Vitamin C 0.5
summary(ToothGrowth,supp)
## len supp dose
## Min. : 4.20 Length:60 Min. :0.500
## 1st Qu.:13.07 Class :character 1st Qu.:0.500
## Median :19.25 Mode :character Median :1.000
## Mean :18.81 Mean :1.167
## 3rd Qu.:25.27 3rd Qu.:2.000
## Max. :33.90 Max. :2.000
A) COMPARISON BETWEEN TOOTH LENGTH AND ASCORBIC ACID SUPPLEMENT TYPE
g<- ggplot(ToothGrowth, aes(supp, len, fill =factor(supp)))+
labs(title = "Supplement Type Effect")+ ylab("Tooth Length")
plot1<- g + geom_boxplot(notch = F)
print(plot1)
T.TEST ANALYSIS: Null Hypotesys ( Ho): States that supplement Type ( Orange Juice or Vitamin C ) has no influence on tooth length
t.test(len~supp, ToothGrowth, 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 Orange Juice mean in group Vitamin C
## 20.66333 16.96333
RESULT
Based on the results of the T.Test, as p-value is higher than 0.05, we have not enough evidence to reject the Null Hypothesis
B) COMPARISON BETWEEN TOOTH LENGTH AND ACID ASCORBIC DOSAGE
g<- ggplot(ToothGrowth, aes(dose, len, fill =factor(dose)))+
labs(title = "Dosage Effect")+ ylab("Tooth Length")
plot2<- g + geom_boxplot(notch = F)
print(plot2)
dosage1<- subset(ToothGrowth, dose == 0.5)
dosage2<- subset(ToothGrowth, dose == 1.0)
dosage3<- subset(ToothGrowth, dose == 2.0)
dosage12<- rbind(dosage1,dosage2)
dosage13<- rbind(dosage1,dosage3)
dosage23<- rbind(dosage2,dosage3)
T.TEST ANALYSIS:Null Hypotesys ( Ho): States that different dosage of the acid arcorbic ( 0.5 mg, 1.0 mg or 2.0 mg ) has no influence on tooth length
t.test(len~dose, dosage12, paired=F)
##
## 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
t.test(len~dose, dosage13, paired=F)
##
## 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
t.test(len~dose, dosage23, paired=F)
##
## 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
RESULT
As p-value is lower than 0.05 for all three analysis ,we can reject the null hypothesis
SUMMARY
Based on the analysis performed using the t.test is possible to affirm that the dosage of the acid ascorbic has influence in the tooth growth while there is no evidence to conclude that the delivery method has influence on the tooth growth.
Sergio Vicente Simioni May/23/2015