0% found this document useful (0 votes)
38 views

Statistical Inference Part2

The document analyzes data from a study on the effect of vitamin C dose and type (orange juice vs. ascorbic acid) on tooth growth in guinea pigs. Exploratory data analyses were conducted, including summary statistics and plots of tooth length by supplement and dose. Hypothesis tests using t-tests found no significant difference in tooth growth between orange juice and vitamin C supplement groups, though tooth growth increased with higher vitamin C doses.

Uploaded by

briofons
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Statistical Inference Part2

The document analyzes data from a study on the effect of vitamin C dose and type (orange juice vs. ascorbic acid) on tooth growth in guinea pigs. Exploratory data analyses were conducted, including summary statistics and plots of tooth length by supplement and dose. Hypothesis tests using t-tests found no significant difference in tooth growth between orange juice and vitamin C supplement groups, though tooth growth increased with higher vitamin C doses.

Uploaded by

briofons
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

the Toothgrow data inference analysis

briofons
Saturday, January 24, 2015
The ToothGrowth dataset has information about the relation between the growth of teeth of guinea pigs at
each of three dose levels of Vitamin C from orange juice and ascorbic acid.
So we studied with supp and dose with confidence intervals
Question 1 Load the ToothGrowth data and perform some basic exploratory data analyses
library(datasets)
library(ggplot2)
data(ToothGrowth)
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 ...
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

Question 2
# Basic information about dataset
summary(ToothGrowth)
##
##
##
##
##
##
##

len
Min.
: 4.20
1st Qu.:13.07
Median :19.25
Mean
:18.81
3rd Qu.:25.27
Max.
:33.90

supp
OJ:30
VC:30

dose
Min.
:0.500
1st Qu.:0.500
Median :1.000
Mean
:1.167
3rd Qu.:2.000
Max.
:2.000

table (ToothGrowth$supp, ToothGrowth$dose)


##
##
##
##

OJ
VC

0.5 1 2
10 10 10
10 10 10

boxplot(ToothGrowth$len ~ ToothGrowth$supp *
ToothGrowth$dose, data=ToothGrowth,
ylab="Tooth Length", main="Tooth Growth Data")

25
20
15
5

10

Tooth Length

30

35

Tooth Growth Data

OJ.0.5

VC.0.5

OJ.1

VC.1

OJ.2

VC.2

#Another way to plot the data to see difference in orange juice vs ascorbic acid
plot <- ggplot(ToothGrowth,
aes(x=factor(dose),y=len,fill=factor(dose)))
plot + geom_boxplot(notch=F) + facet_grid(.~supp) +
scale_x_discrete("Doses (mg)") +
scale_y_continuous("Length of Teeth") +
ggtitle("ToothGrowth data analysis")

ToothGrowth data analysis


OJ

VC

Length of Teeth

30

factor(dose)
0.5

20

1
2

10

0.5

0.5

Doses (mg)
Question 3 Use confidence intervals and hypothesis tests to compare tooth growth by supp and dose. (Use
the techniques from class even if theres other approaches worth considering)
t.test(len~supp, 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

supp.t1 <- t.test(len~supp, paired=F, var.equal=T, data=ToothGrowth)


supp.t2 <- t.test(len~supp, paired=F, var.equal=F, data=ToothGrowth)
supp.result <- data.frame("p-value"=c(supp.t1$p.value, supp.t2$p.value),
"Conf-Low"=c(supp.t1$conf[1],supp.t2$conf[1]),
"Conf-High"=c(supp.t1$conf[2],supp.t2$conf[2]),
row.names=c("Equal Var","Unequal Var"))
supp.result
##

p.value

Conf.Low Conf.High
3

## Equal Var
0.06039337 -0.1670064
## Unequal Var 0.06063451 -0.1710156

7.567006
7.571016

Conclusions
With the t-test for compare growth and dose based in our analysis we can say:
While doses are more we have more growth of the tooth so 2 mg has more impact than the other. And orange
juice and vitamin C has no effect on tooth growth.

You might also like