[R] Model comparison with missing values
Sam.C
s.j.cartwright at reading.ac.uk
Mon Aug 17 13:43:32 CEST 2009
Hi,
I have created a global model using lmer knowing it contains at least one
fixed effect which has missing values. I add the term na.action=na.omit to
the model formula as shown below, and the summary output is produced fine,
until I wish to simplify the model and compare the resulting model with the
previous one using anova. As soon as the covariate containing the missing
values is removed, the number of observations in the new reduced model
increases and the two models become incomparable. I am using the update
function to sequentially remove fixed effects.
Is there a function, perhaps to increase the number of observations simply
to enable the comparison, and to avoid subsetting the data (by removing all
the NA values from all the variables before the analysis even begins) so
that the reduced model can then make use of all the available data for the
predictions?
The error example: (say 'pairexp' has 23 missing values)
lmm.1<-lmer(survival~Male+FemAge+pairexp+(1|ID),REML=FALSE,na.action=na.omit)
summary(lmm.1)
lmm.2<-update(lmm.1,.~.-pairexp)
summary(lmm.2)
anova(lmm.1,lmm.2)
lmm.2: survival ~ Male + FemAge + (1 | ID)
lmm.1: survival ~ Male + FemAge + pairexp + (1 | ID)
Df AIC BIC logLik Chisq Chi Df Pr(>Chisq)
lmm.1 4 -1006.41 -993.92 507.21
lmm.1 5 -934.88 -919.60 472.44 0 1 1
Apologies if there is a simple solution to this that I've missed. Any
suggestions on how to deal with this would be welcome. I have checked the R
help posts but not found anything alone these lines.
Thanks,
Sam
--
View this message in context: http://www.nabble.com/Model-comparison-with-missing-values-tp25005296p25005296.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list