[R] Using na.action = na.pass with lmer() function

Yao Yao yaoyaorocks at gmail.com
Fri Oct 15 06:24:51 CEST 2010


Dear everyone,

I'm trying to figure out how to use the na.pass option for na.action
when building a lmer object. Basically there are NA values in some
observations of the data set, and I want the model to retain these
observations instead of tossing them out, so that the size of the data
set will not be reduced.  I think the default na.action in lmer() is
na.omit, which will just omit all observations with NA values.  I was
able to build a lmer model with na.action = na.pass, using a command
in the following form:

> mod = lmer(y~a+b+(1|item) + (1|subj), data=data1, na.action=na.pass)

No error message is returned after this line. However, when I called
the model using print(mod, corr=F), an error message showed up:

> Error in asMethod(object) : matrix is not symmetric [1,2]

So my question are the following: (1) am I right in using na.pass in
order to maintain the size of the data set the model is based on?  (2)
how does lmer() function handle the option na.pass? Is there something
else I need to set other than na.action?

I've spent quite some time with this problem already. Anyone who has
any idea on this would make my day!

Thanks!

Best,
Yao



More information about the R-help mailing list