problem-11.26
problem-11.26
This can be carried out as follows:
> with(grip, interaction.plot(grip.type,person,UBP))
> res.int = lm(UBP ~ person * grip.type, data=grip)
> res.noint = lm(UBP ~ person + grip.type, data=grip)
> res.per = lm(UBP ~ person, data=grip)
> res.grip = lm(UBP ~ grip.type, data=grip)
> res.none = lm(UBP ~ 1, data=grip)
Now, we check to see what is statistically significant:
> anova(res.noint,res.int)
Analysis of Variance Table
Model 1: UBP ~ person + grip.type
Model 2: UBP ~ person * grip.type
Res.Df RSS Df Sum of Sq F Pr(>F)
1 30 509
2 24 484 6 25 0.21 0.97
This agrees with the interaction plot. No evidence of an
interaction is present.
> anova(res.none,res.per)
Analysis of Variance Table
Model 1: UBP ~ 1
Model 2: UBP ~ person
Res.Df RSS Df Sum of Sq F Pr(>F)
1 35 876
2 32 848 3 27 0.34 0.8
No evidence that the difference varies among subjects (recall that this
is simulated data).
> anova(res.none,res.grip)
Analysis of Variance Table
Model 1: UBP ~ 1
Model 2: UBP ~ grip.type
Res.Df RSS Df Sum of Sq F Pr(>F)
1 35 876
2 33 536 2 339 10.4 0.00031 ***
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
The effect of the grip seems significant.
Finally, we see that stepAIC() returns the same conclusion.
> library(MASS)
> stepAIC(res.int)
...
Call:
lm(formula = UBP ~ grip.type, data = grip)
...