[R] mgcv: inclusion of random intercept in model - based on p-value of smooth or anova?
Martijn Wieling
wieling at gmail.com
Tue May 8 16:01:50 CEST 2012
Dear useRs,
I am using mgcv version 1.7-16. When I create a model with a few
non-linear terms and a random intercept for (in my case) country using
s(Country,bs="re"), the representative line in my model (i.e.
approximate significance of smooth terms) for the random intercept
reads:
edf Ref.df F p-value
s(Country) 36.127 58.551 0.644 0.982
Can I interpret this as there being no support for a random intercept
for country? However, when I compare the simpler model to the model
including the random intercept, the latter appears to be a significant
improvement.
> anova(gam1,gam2,test="F")
Model 1: ....
Model 2: .... + s(BirthNation, bs="re")
Resid. Df Resid. Dev Df Deviance F Pr(>F)
1 789.44 416.54
2 753.15 373.54 36.292 43.003 2.3891 1.225e-05 ***
I hope somebody could help me in how I should proceed in these
situations. Do I include the random intercept or not?
I also have a related question. When I used to create a mixed-effects
regression model using lmer and included e.g., an interaction in the
fixed-effects structure, I would test if the inclusion of this
interaction was warranted using anova(lmer1,lmer2). It then would show
me that I invested 1 additional df and the resulting (possibly
significant) improvement in fit of my model.
This approach does not seem to work when using gam. In this case an
apparent investment of 1 degree of freedom for the interaction, might
result in an actual decrease of the degrees of freedom invested by the
total model (caused by a decrease of the edf's of splines in the model
with the interaction). In this case, how would I proceed in
determining if the model including the interaction term is better?
With kind regards,
Martijn Wieling
--
*******************************************
Martijn Wieling
http://www.martijnwieling.nl
wieling at gmail.com
+31(0)614108622
*******************************************
University of Groningen
http://www.rug.nl/staff/m.b.wieling
More information about the R-help
mailing list