Overview

The ToothGrowth dataset contains 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).

Load needed libraries
## Load needed libraries
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)
library(datasets)
library(RColorBrewer)

Data Load

Below, the tooth data is loaded and an exploratory info is displayed

#loading data
data(ToothGrowth)
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
a <- ggplot(ToothGrowth, aes(x = factor(dose), y = len, fill=factor(dose)))
a + geom_boxplot() + 
  scale_x_discrete(name = "Dosage") + 
  scale_y_continuous(name = "Length of Tooth growth") + 
  ggtitle("Effect of Supplement by Dosage on Tooth Growth") +
  facet_grid(. ~ supp) +
  labs(fill = "Dosage") +
  scale_fill_brewer(palette = "Accent")

Data Summary

Basic summary info of the ToothGrowth Data

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
str(ToothGrowth)
## 'data.frame':    60 obs. of  3 variables:
##  $ len : num  4.2 11.5 7.3 5.8 6.4 10 11.2 11.2 5.2 7 ...
##  $ supp: Factor w/ 2 levels "OJ","VC": 2 2 2 2 2 2 2 2 2 2 ...
##  $ dose: num  0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...

Confidence Testing

Compares the effect of VC Vs OJ based on dosage

t.test(len ~ supp, paired=FALSE, var.equal=TRUE, data=ToothGrowth)
## 
##  Two Sample t-test
## 
## data:  len by supp
## t = 1.9153, df = 58, p-value = 0.06039
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.1670064  7.5670064
## sample estimates:
## mean in group OJ mean in group VC 
##         20.66333         16.96333
t.test(len ~ supp, paired=FALSE, var.equal=FALSE, data=ToothGrowth)
## 
##  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-values and the confidence intervals don’t seem to be different between equal and unequal variances. The mean seems to be higher in Orange Juice (OJ’s mean is 20.66333) compared to the mean of Vitamin C (VC’s mean is 16.96333). This could signify that the length of growth for tooth when given OJ is longer than those when given VC