[R] lmList and missing values

From: Henrik Parn <henrik.parn_at_bio.ntnu.no>
Date: Sat 19 Aug 2006 - 00:27:25 EST

Dear all,

I have a question on handling of missing values in lmList. My data set have continuous predictor and response, x and y, and a grouping variable group.id. All these variables have NAs and the data set also has several other variables that also contains NAs.

To create the lmList-object seems to work fine: y.list <- lmList(y ~ x | group.id, data=mydata, na.action=na.omit)

However, when I try to apply functions on the object such as coef or intervals it fails:

> coef(y.list)

Error in !unlist(lapply(coefs, is.null)) :

        invalid argument type

If I beforehand select only the variables (still including missing values) used as arguments in lmList...  

mydata2 <- mydata[ , c("x", "y", "group")]

...and use mydata2 in lmList as above, coef and intervals works fine.

In order to provide a reproducible example, I made a small test data set. This data set contained the same pattern of NAs as in my real data set, i.e. NAs in both used and unused variables. The example turned out to be not very illustrative though, because strange enough 'na.action=na.omit' works just fine on the small test data set so I don't bother to include it here...

I have not encountered any problems to apply other functions, such as lm or lme, to my data set.

Any idea what causes the error?

A related problem seems to have occured before, although it is not clear if different na.action options was tried in this case: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14293.html

Thanks in advance for any help!

Best regards,


Henrik Pärn
Department of Biology
7491 Trondheim

+47 735 96282 (office)
+47 909 89 255 (mobile)
+47 735 96100 (fax)

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat Aug 19 00:47:21 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 19 Aug 2006 - 02:22:04 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.