[R-sig-ME] NAs in fixed effects

Henrik Thurfjell Henrik.Thurfjell at slu.se
Wed Jan 5 14:18:24 CET 2011


Dear listmembers

I have a rather large dataset which needs one random effect to be analysed properly (group). I also have many explanatory variables, each with a few NAs at different places.
I can easily enough fit a model with 2 fixed effects, but as the number of fixed effects increase so does tha NAs as they are not in the same rows. I am no statistician, and this may be a naive question, but is there a way to fit each fixed efefct with its full data?
My first ide was to use lme, where na.pass works, but I found this comment by Bates;

"I don't think you want to use na.pass here.  The underlying C code for
fitting lme or lmer models doesn't take kindly to finding NA's in the
data."

I couldnt make na.pass work in any other package dealing with mixed models.

there are a few NAs in the data scattered throughout, eliminating the data severly (although each single variable only have 0-10%NA)

This may illustrate what my problem is;

x<-c(1:10)
y<-c(1:10)
pa<-c(NA,2:10)
pb<-c(1,NA,3:10)
pc<-c(1:2,NA,4:10)
pd<-c(1:3,NA,5:10)
pe<-c(1:4,NA,6:10)
pf<-c(1:5,NA,7:10)
group<-factor(rep(c("A","B"), each=5))

Ignore that the data is not enough to analyse and only has two levels of the random effect, that is not the important bit. I want my model (x~y+pa+pb+pc+pd+pe+pf+(1|group)) 
to use 10 values on y and 9 values on the p variables. not 4 values on all. 
 
Is that even possible? 

Regards Henrik Thurfjell



More information about the R-sig-mixed-models mailing list