HW Exercise 0316-1
A built-in demo for the data object ToothGrowth{datasets}. Replicate the analysis in the style of the headache study to investigate if type of vitamin supplement has an effect on teeth growth in guinea pigs. For this exercise, we shall ignore the dose variable.
Data dimensions and variable names
## [1] 60 3
## [1] "len" "supp" "dose"
ToothGrowth dataset has 60 columns, 3 rows and 3 variables: len, supp and dose.
## 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
## len supp dose
## 55 24.8 OJ 2
## 56 30.9 OJ 2
## 57 26.4 OJ 2
## 58 27.3 OJ 2
## 59 29.4 OJ 2
## 60 23.0 OJ 2
Summarize the data
## 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
Descriptive statistics and data visulization
Average length of two groups of supplement
## supp len
## 1 OJ 20.66333
## 2 VC 16.96333
Exploratory data analysis (EDA)
lattice::bwplot(len ~ supp, data=ToothGrowth,
main="Distribution of length at different supplements",
xlab="Supplement (OJ & VC)", ylab="Length")multicon::diffPlot(len~supp, data=ToothGrowth, grp.names=c("OJ", "VC"),
xlab="Supplement", ylab="Length")Checking Normality
##
## Shapiro-Wilk normality test
##
## data: TG_lm$residual
## W = 0.96949, p-value = 0.1378
Data fit the normal distrubution. Hence, the indepedent t test would be conducted.
Comparing two means
##
## 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:The p-value > 0.05. Hence, the test fails to reject the null hypothesis. Type of vitamin supplement did not has an significant effect on teeth growth in guinea pigs.