Synopsis

I have analyzed the ToothGrowth data in the R datasets package and carried following tasks as instructed

1.Load the ToothGrowth data and perform some basic exploratory data analyses

2.Provide a basic summary of the data.

3.Use confidence intervals and/or hypothesis tests to compare tooth growth by supp and dose. (Only use the techniques from class, even if there’s other approaches worth considering)

4.State your conclusions and the assumptions needed for your conclusions.

ToothGrowth data presents the response in 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).

Loading the ToothGrowth Data And Performing Some Basic Operations

data("ToothGrowth")
dim(ToothGrowth)
## [1] 60  3
head(ToothGrowth)
##    len supp dose
## 1  4.2   VC  0.5
## 2 11.5   VC  0.5
## 3  7.3   VC  0.5
## 4  5.8   VC  0.5
## 5  6.4   VC  0.5
## 6 10.0   VC  0.5
str(colnames(ToothGrowth))
##  chr [1:3] "len" "supp" "dose"

Installing necessary libraries

library(ggplot2)

Performing Some Basic Exploratory Data Analysis

mean(ToothGrowth$len)
## [1] 18.81333
sd(ToothGrowth$len)
## [1] 7.649315
coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth,main = "ToothGrowth Data: Length vs dose, given type of supplement", ylab = "Length of Tooth Growth",xlab = "Dose Levels of Vitamin C")

### The average guinea pig length is 18.813 units with a standard deviation of 7.649. However,we are more interested in finding differences in tooth length accross different groups of supplement types, dose levels and their respective combinations. ### I, therefore plotted the conditioning plot as above. Following inferences can be sighted from the above conditioning plot ### 1) For 0.5 mg/day dose of vitamin C, the tooth length has outgrown in Orange Juice (OJ) supplements in comparison with ascorbic acid (a form of vitamin C and coded as VC hereafter). ### 2) For 1 mg/day dose of vitamin C, the tooth length has also outgrown in Orange Juice (OJ) supplements in comparison with VC. ### 3) For 1.5 mg/day dose of vitamin C, the tooth length has grown virtually the same as in case of in Orange Juice (OJ) supplements. ### 4) As the dosage increases the tooth growth increases.

Basic Summary Of The Data

ToothGrowth data frame contains 60 observations on 3 variables.

[,1] len numeric Tooth length

[,2] supp factor Supplement type (VC or OJ).

[,3] dose numeric Dose in milligrams/day

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

Hypothesis Tests

Since we dealing with subsets of n <= 30 our standard error estimate will generally not be accurate. Therefore, we will use the t distribution for our hypothesis tests and when constructing confidence intervals.

Assumptions :

1) The variables (len, dose, supp) must be independent and identically distributed (i.i.d.).

2) Variances of tooth growth are different when using different supplement and dosage.

3) Tooth growth follows a normal distribution.

Comparing the tooth growth by supplement at 95% CL

Null Hypothesis : Observed difference in tooth length means between pigs who received their dose using orange juice and those who received their dose via VC is statistically different from 0.

t.test(len~supp,data = ToothGrowth,var.equal = FALSE)
## 
##  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 OJ mean in group VC 
##         20.66333         16.96333

Conclusion : As the p value is larger than 0.05, we fail to reject the null hypothesis.It means that the data doesnot show strong evidence to conclude that the observed difference in tooth length means between pigs who received their dose using orange juice and those who received their dose via VC is statistically different from 0.

Comparing the tooth growth by doses at 95% CL

Null Hypothesis : As we are dealing with 3 different dose levels we need to apply 3 t-tests to cover all factor level combinations. Again, our null hypothesis in all cases is that the average difference in tooth length is 0.

t.test(ToothGrowth$len[ToothGrowth$dose==1],ToothGrowth$len[ToothGrowth$dose== 0.5])
## 
##  Welch Two Sample t-test
## 
## data:  ToothGrowth$len[ToothGrowth$dose == 1] and ToothGrowth$len[ToothGrowth$dose == 0.5]
## 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:
##   6.276219 11.983781
## sample estimates:
## mean of x mean of y 
##    19.735    10.605
t.test(ToothGrowth$len[ToothGrowth$dose==2],ToothGrowth$len[ToothGrowth$dose== 0.5])
## 
##  Welch Two Sample t-test
## 
## data:  ToothGrowth$len[ToothGrowth$dose == 2] and ToothGrowth$len[ToothGrowth$dose == 0.5]
## 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:
##  12.83383 18.15617
## sample estimates:
## mean of x mean of y 
##    26.100    10.605
t.test(ToothGrowth$len[ToothGrowth$dose==2],ToothGrowth$len[ToothGrowth$dose== 1])
## 
##  Welch Two Sample t-test
## 
## data:  ToothGrowth$len[ToothGrowth$dose == 2] and ToothGrowth$len[ToothGrowth$dose == 1]
## 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:
##  3.733519 8.996481
## sample estimates:
## mean of x mean of y 
##    26.100    19.735

Conclusion : As the p value is much smaller than 0.05, we fail to accept the null hypothesis in each of the above 3 combinations.The data provides strong evidence that the average tooth length of guinea pigs is different for each dose level.

Conclusion For The Entire Analysis

We derived the conclusion that the observed difference of tooth length means across supplement types is statistically not different from 0.However, we also found that tooth length indeed varies across groups of dose levels and all the variations are statistically significant. In the light of these conclusions, I propose to undertake further studies for different supplement types and dose level combinations.