-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToothStat.Rmd
More file actions
63 lines (46 loc) · 1.96 KB
/
ToothStat.Rmd
File metadata and controls
63 lines (46 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: "Statistical Inference Project - Tooth Growth"
author: "Scott Roberts"
date: "April 2, 2016"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Executive Summary
This report provides a comparison of the effect of Orange Juice and Vitamin C on tooth growth. The dosage levels for each supplement were .5, 1.0 and 2.0.
Exploratory Analysis
```{r tooth}
library(ggplot2)
data(ToothGrowth)
#Basic Information about the Tooth Growth Data
summary(ToothGrowth)
#
head(ToothGrowth)
#
table(ToothGrowth$dose)
####Plot of the two factors
qplot(dose, len, data=ToothGrowth, color=supp, facets=.~supp, geom=c("auto"))
```
Assumptions
We assume the dataset Toothgrowth is a from randomly sample, and that the variance amongst the means are similar. We also assume the population distribution must be close to normal.
t-Test for Supplement Type
```{r}
t.test(len ~ supp, data = ToothGrowth)
```
With a p-value of .06, we would fail to reject the null hypothesis that there is no difference between the two supplements for this test. Looking further into the data we can now explore dosage levels by supplement to see if there is a difference.
t-Test by Dose and by Supplement
```{r}
##Subset three dataframes by dosage
d1 <- subset(ToothGrowth, dose == .5)
d2 <- subset(ToothGrowth, dose == 1.0)
d3 <- subset(ToothGrowth, dose == 2.0)
##With Doasage of .5
t.test(len ~supp, var.equal = FALSE, data = d1)
##With Doasage of 1.0
t.test(len ~supp, var.equal = FALSE, data = d2)
##With Doasage of 2.0
t.test(len ~supp, var.equal = FALSE, data = d3)
```
Conclusion
First, the dosage levels of .5 and 1.0 for OJ and Vitamin C had t-test p-values of .001 and .006 respectively. We reject the hypothesis and can conclude that there is a difference at those dosage levels. At the 2.0 dosage, we see a p-value of .963, where we would fail to reject and conclude that with the means so close that there is no difference in supplements at this dosage level.