In: Statistics and Probability
The times (in seconds) for a sample of New York Marathon runners were as follows:
Gender |
Age Class |
||
Male |
20-29 |
30-39 |
40+ |
13615 |
14677 |
14528 |
|
18784 |
16090 |
17034 |
|
14256 |
14086 |
14935 |
|
10905 |
16461 |
14996 |
|
12077 |
20808 |
22146 |
|
Female |
16401 |
15357 |
17260 |
14216 |
16771 |
25399 |
|
15402 |
15036 |
18647 |
|
15326 |
16297 |
15077 |
|
12047 |
17636 |
25898 |
Conduct a two-way analysis of variance including interactions to examine these data. Perform model criticism. What do you conclude? Note that R users do not need to invoke the “car” package since the equal replication means that Type I = Type III SS (using car package can be tricky when fitting models with interactions since the contrasts also need to be altered to make them comparable).
R code:
Input =("
AgeClass Gender Time
20-29 Male 13615
20-29 Male 18784
20-29 Male 14256
20-29 Male 10905
20-29 Male 12077
30-39 Male 14677
30-39 Male 16090
30-39 Male 14086
30-39 Male 16461
30-39 Male 20808
40+ Male 14528
40+ Male 17034
40+ Male 14935
40+ Male 14996
40+ Male 22146
20-29 Female 16401
20-29 Female 14216
20-29 Female 15402
20-29 Female 15326
20-29 Female 12047
30-39 Female 15357
30-39 Female 16771
30-39 Female 15036
30-39 Female 16297
30-39 Female 17636
40+ Female 17260
40+ Female 25399
40+ Female 18647
40+ Female 15077
40+ Female 25898
")
if(!require(psych)){install.packages("car")}
library(car)
Data = read.table(textConnection(Input),header=TRUE)
model = lm(Time ~ AgeClass + Gender + AgeClass:Gender,
data=Data)
Anova(model, type="II")
Output:
Anova Table (Type II tests)
Response: Time
Sum Sq Df F value Pr(>F)
AgeClass 92086979 2 5.0998 0.01427 *
Gender 15225413 1 1.6864 0.20642
AgeClass:Gender 21042069 2 1.1653 0.32885
Residuals 216683456 24
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Since p-value for interaction=0.32885>0.05 so interaction effect is not significantly present. Moreover p-value for gender=0.20642>0.05 so Gender is not significantly present. But Age Classes are not all same since P-value=0.01427<0.05.