This dataset comprises of the data that shows the effect of Vitamin C on Tooth Growth in Guinea Pigs.The response is 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).
Followings steps will be performed as a part of this exploratory data analysis:
scatterplot based on supp,dose and len
library(ggplot2)
plot <- ggplot(aes(x = ToothGrowth$dose, y = ToothGrowth$len),
data = ToothGrowth) + geom_point(aes(color=supp))+labs(x = "Dose", y = "Tooth Growth")
print(plot)
barplot based on supp,dose and len
library(ggplot2)
ggplot(data=ToothGrowth, aes(x=as.factor(dose), y=len, fill=supp)) +
geom_bar(stat="identity") +
facet_grid(. ~ supp) +
guides(fill=guide_legend(title="Supplement Type"))+ labs(x = "Dose", y = "Tooth Growth")
Here we are going to run T-test between different variablities of the dataset
#Categorize based on suppliments
supp_t1 <- ToothGrowth$len[ToothGrowth$supp == "OJ"]
supp_t2 <- ToothGrowth$len[ToothGrowth$supp == "VC"]
dose_t1 <- ToothGrowth$len[ToothGrowth$dose == 0.5]
dose_t2 <- ToothGrowth$len[ToothGrowth$dose == 1]
dose_t3 <- ToothGrowth$len[ToothGrowth$dose == 2]
t.test(x = supp_t1,y = supp_t2,paired = FALSE, var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: supp_t1 and supp_t2
## 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 of x mean of y
## 20.66333 16.96333
t.test(x = dose_t1,y = dose_t2,paired = FALSE, var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: dose_t1 and dose_t2
## 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
Based on the t-test results we can make an assumption that OJ and VC produces different results in terms of Tooth growth.
We can conclude the followings: