Professional Documents
Culture Documents
Part 2: Basic Inferential Data Analysis: Synopsis
Part 2: Basic Inferential Data Analysis: Synopsis
4/19/2020
Synopsis
in this second portion of the project, we’re going to analyze the ToothGrowth data in the R datasets package.
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.
4. conclusions
1. ToothGrowth data
data("ToothGrowth")
working <- ToothGrowth
dim(working)
## [1] 60 3
Testing the relationship between supplements and the growth of tooth Each study subject received one of
three dose levels of supplement (0.5, 1, and 2 mg/day) by one of two delivery methods, OG or VC.
str(working)
summary(working)
1
working$dose <- as.factor(working$dose)
table(working$supp, working$dose)
##
## 0.5 1 2
## OJ 10 10 10
## VC 10 10 10
sd(working$len)
## [1] 7.649315
## # A tibble: 6 x 3
## # Groups: supp [2]
## supp dose len
## <fct> <fct> <dbl>
## 1 OJ 0.5 13.2
## 2 OJ 1 22.7
## 3 OJ 2 26.1
## 4 VC 0.5 7.98
## 5 VC 1 16.8
## 6 VC 2 26.1
2
Dosage and Supplement
OJ VC
30
factor(dose)
Teeth Growth
20 0.5
1
2
10
0.5 1 2 0.5 1 2
Dosage
testing relation between the supplement and the length of the tooth
##
## 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
null hypotheses rejected as there’s a relationship between the supplement and the length of the teeth of p
value = 3%
3
testing the relation between the dose and the length of the tooth
##
## Welch Two Sample t-test
##
## data: working$len[working$dose == 0.5] and working$len[working$dose == 1]
## 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 of x mean of y
## 10.605 19.735
##
## Welch Two Sample t-test
##
## data: working$len[working$dose == 1] and working$len[working$dose == 2]
## 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 of x mean of y
## 19.735 26.100
##
## Welch Two Sample t-test
##
## data: working$len[working$dose == 0.5] and working$len[working$dose == 2]
## 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 of x mean of y
## 10.605 26.100
4. conclusions
the tooth growth for the OJ supplements at the lowest dose is statistically significant than the VC. as the
higher dosage contains zero in the confidence intervals giving OJ at 0.5 and 1.0 dosages is siginifcant than
VC