In: Statistics and Probability
Problem 1. A drug company tested three formulations of a pain relief medicine for migraine headache sufferers. For the experiment 27 volunteers were selected and 9 were randomly assigned to one of three drug formulations. The subjects were instructed to take the drug during their next migraine headache episode and to report their pain on a scale of 1 to 10 (10 being most pain).
Drug A 4 5 4 3 2 4 3 4 4
Drug B 6 8 4 5 4 6 5 8 6
Drug C 6 7 6 6 7 5 6 5 5
You can read in data into R by the following R code.
pain = c(4, 5, 4, 3, 2, 4, 3, 4, 4, 6, 8, 4, 5, 4, 6, 5, 8, 6, 6, 7, 6, 6, 7, 5, 6, 5, 5)
drug = c(rep("A",9), rep("B",9), rep("C",9))
migraine = data.frame(pain,drug)
a). Make a boxplot to have a visual check.
b). Compute SST, SSG. SSE directly by definition
c). Compute F value directly by definition
d). Find p-value directly by definition
e). Conduct ANOVA test by R function aov.
f). Make your conclusion.
Applied stats 2 r code questions
a). Make a boxplot to have a visual check.
b). Compute SST, SSG. SSE directly by definition
SST = 56.66
SSG = 28.22
SSE = 28.44
c). Compute F value directly by definition
F = 11.91
d). Find p-value directly by definition
p-value = 0.000256
e). Conduct ANOVA test by R function aov.
The R output is:
The R code is:
pain = c(4, 5, 4, 3, 2, 4, 3, 4, 4, 6, 8, 4, 5, 4, 6, 5, 8, 6,
6, 7, 6, 6, 7, 5, 6, 5, 5)
drug = c(rep("A",9), rep("B",9), rep("C",9))
migraine = data.frame(pain,drug)
boxplot(pain)
aov(pain~drug)
ANOVA1 = aov(pain~drug)
summary(ANOVA1)
f). Make your conclusion.
Since the p-value (0.000256) is less than the significance level (0.05), we can reject the null hypothesis.
Therefore, we can conclude that there is a significant difference between the groups.