In: Statistics and Probability
USE R AND SHOW CODES!!
1.a. An investigator is interested in comparing the cardiovascular fitness of elite runners on three different training courses. course one is at, course 2 has graded inclines, and
course three includes steep inclines, Ten runners were involved for each course. Heart rates measured on each course are as the following table
Course 1 Course 2 Course 3
132 135 138
143 148 148
135 138 141
128 131 139
141 141 150
150 156 161
131 134 138
150 156 162
142 145 151
139 165 160
Is there a significant difference in the mean heart rates of runners on three courses? alpha= 0:05
1.b. The following data is collected on the enzyme activity of MPI (mannose-6-phosphate isomerase) and MPI genotypes separated for male and female.
a. Is there any significant difference between male and female?
b. Is there any significant difference between genotypes?
c. Is there any interaction between sex and genotypes?
DATA
Genotype Female Male
FF 2.838 1.884
4.216 2.889
4.198 2.283
4.939 3.486
FS 3.55 2.396
4.556 2.956
3.087 3.105
1.943 2.649
SS 3.620 2.801
3.079 3.421
3.586 4.275
2.669 3.110
1.a.
One-way ANOVA is used to compare means from more than two groups of one variable. The null hypothesis states all the group means are equal vs the alternative hypothesis that at least one of the group means is different from the others.
Rcode :
X <- c('Course 1','Course 1','Course 1','Course 1','Course
1','Course 1','Course 1','Course 1','Course 1','Course 1','Course
2','Course 2','Course 2','Course 2','Course 2','Course 2','Course
2','Course 2','Course 2','Course 2','Course 3','Course 3','Course
3','Course 3','Course 3','Course 3','Course 3','Course 3','Course
3','Course 3')
Y <-
c(132,143,135,128,141,150,131,150,142,139,135,148,138,131,141,156,134,156,145,165,138,148,141,139,150,161,138,162,151,160)
data.df <- data.frame(X,Y)
anova_one_way <- aov(Y ~ X, data = data.df)
summary(anova_one_way)
Note : In the screenshot below , p value is greater than 0.05 as per the alpha chosen therefore we fail to reject the null hypothesis of non-significance between the groups.
Therefore, there seems to be no statistically significant difference in the mean heart rates of runners on three courses.
1.b.
This part can be solved by using two way anova. It is used to analyze the effect of two grouping variables on a response variable simultaneously. Here the response variable is Enzyme Activity recorded and grouping variables are Genotype and Sex. Two way anova models the main effects for both the group variables and also estimates the interaction effect of the two group variables.
Rcode:
####### two way anova ###################
library(Rmisc)
Genotype <-
c('FF','FF','FF','FF','FF','FF','FF','FF','FS','FS','FS','FS','FS','FS','FS','FS','SS','SS','SS','SS','SS','SS','SS','SS')
Sex <-
c('Female','Female','Female','Female','Male','Male','Male','Male','Female','Female','Female','Female','Male','Male','Male','Male','Female','Female','Female','Female','Male','Male','Male','Male')
Act <-
c(2.838,4.216,4.198,4.939,1.884,2.889,2.283,3.486,3.55,4.556,3.087,1.943,2.396,2.956,3.105,2.649,3.62,3.079,3.586,2.669,2.801,3.421,4.275,3.11)
data.df <- data.frame(Genotype,Sex,Act)
aov2way <-
aov(Act~as.factor(Genotype)*as.factor(Sex),data=
data.df)
summary(aov2way)
TukeyHSD(aov2way)
Note : As per the output below, only sex came out as a significant variable (pvalue < 0.05) whereas interaction also is insignificant.
so for a) Yes
b) No
c) No
To further evaluate the differences between multiple values of these groups, TukeyHSD test can be used and the output is shown below to the summary ouput and it can be seen that none of the multiple comparisons come as significant other tan the sex variable since the pvalue for only sex variable is less than 0.05.
Output :