This analysis represents the use of two treatments in three different dosses, and observe their effect on tooth growth.
The two medicaments are OJ and VC, with dosses of 0.5, 1 and 2.
For this inference analysis we will assume “iid”" meaning they were different individuals, divided ramdonly in 6 different groups.
Here is a summary of the data base ToothGrowth.
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
rbind(head(ToothGrowth, n=3L), tail(ToothGrowth, n=3L))
## len supp dose
## 1 4.2 VC 0.5
## 2 11.5 VC 0.5
## 3 7.3 VC 0.5
## 58 27.3 OJ 2.0
## 59 29.4 OJ 2.0
## 60 23.0 OJ 2.0
For the exploratory analysis will check the Lenght of the Tooth Growth (len) distribution and identify the behavior of lenght by Treatment (sup) and Dose (dose).
dataOJ <- subset(ToothGrowth, supp = "OJ")
dataVC <- subset(ToothGrowth, supp = "VC")
par(mfrow = c(2,2))
hist(dataOJ$len, main = "Histogram of lenght - OJ", xlab = "lenght", ylab = "frecuency")
hist(dataVC$len, main = "Histogram of lenght - VC", xlab = "lenght", ylab = "frecuency")
boxplot(dataOJ$len ~ dataOJ$dose, main = "OJ Treatment length by dose")
boxplot(dataVC$len ~ dataVC$dose, main = "VC Treatment lenght by dose")
Means for the boxplots groups:
## [1] 10.605
## [1] 19.735
## [1] 26.1
## [1] 10.605
## [1] 19.735
## [1] 26.1
The dose of either treatment appears to be a cause for the lenght of the tooth growth.
The next figure represents the effectiveness by treatment.
boxplot(ToothGrowth$len ~ ToothGrowth$supp, main = "Lenght by Treatment")
mean(ToothGrowth$len[ToothGrowth$supp == "OJ"])
## [1] 20.66333
mean(ToothGrowth$len[ToothGrowth$supp == "VC"])
## [1] 16.96333
The OJ treatment appears to be more effective than VC treatment.
Because the dose seems to be a cause of the lenght of the tooth growth, we make a hypothesis test for each treatment based on the dose.
T Test for the OJ treatment. We will compare low dose 0.5 and 1 vs. a high dose 2
dataOJ$Hdose <- dataOJ$dose == 2
t.test(dataOJ$len~dataOJ$Hdose)
##
## Welch Two Sample t-test
##
## data: dataOJ$len by dataOJ$Hdose
## t = -8.3085, df = 56.202, p-value = 2.347e-11
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -13.565108 -8.294892
## sample estimates:
## mean in group FALSE mean in group TRUE
## 15.17 26.10
For the OJ treatment with a 95% confidence the high dose (2) increments the lenght of the tooth growth by
## [1] 10.93
T Test for the VC treatment. We will compare low dose 0.5 and 1 vs. a high dose 2
dataVC$Hdose <- dataVC$dose == 2
t.test(dataVC$len~dataVC$Hdose)
##
## Welch Two Sample t-test
##
## data: dataVC$len by dataVC$Hdose
## t = -8.3085, df = 56.202, p-value = 2.347e-11
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -13.565108 -8.294892
## sample estimates:
## mean in group FALSE mean in group TRUE
## 15.17 26.10
For the VC treatment with a 95% confidence the high dose (2) increments the lenght of the tooth growth by
## [1] 10.93
T Test for the type of treatment. We will compare OJ treatment vs. VC treatment
t.test(ToothGrowth$len~ToothGrowth$supp)
##
## Welch Two Sample t-test
##
## data: ToothGrowth$len by ToothGrowth$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
With a 95% CI, there is no statistical difference for lenght tooth growth between treatment OJ and VC.