[R] lmList - strange problem

Michael Jerosch-Herold jeroschh at ohsu.edu
Mon Oct 11 21:41:35 CEST 2004


I am using lmList, which takes 'Data' partitioned according to the
levels of a grouping factor (gf) and individual 'lm' fits are obtained
for each 'data'partition, using a model defined as in "lm". So my call
to lmList looks something like:

> mg.lis <- lmList(strmbf ~ age1c + gender1 +  sysbp.clinic +
+           diabp.clinic + ldl1 + mets.total + bmi1c | gf,
+           data = Data, subset= avblock=="normal");

but I get a strange error message: 

"Error in model.frame.default(formula = form, data = dat, na.action =
na.action,  : object is not a matrix"

If I remove either mets.total or bmi1c from my model, then the routine
works fine, i.e. it works when either of the two variables are in the
model, but not when I add one both variables to the model. Similarly I
can remove any other variable and put both mets.total and bmi1c back
into the model, and it works. It seems like the number of model
variables can not exceed 7 for some reason I fail to understand. 

I have 1809 cases and the gf factor subdivides this into 3 about
equally sized groups. Therefore the model could have much more than 8
degrees of freedom. Also I removed all cases from the dataframe with
"NA", so NA's can not explain the problem either.
Any suggestions of what could have gone wrong?

As further information I also add that I used "lme" in the same "nlme"
package to perform multi-level regression modeling (linear mixed
effects) and do not have any similar problems. Also I can "manually"
perform the analysis with "lm" for the data subsets corresponding to
each of the 3 levels of the grouping factor (gf is the grouping
variable), without any problem.

thanks in advance for help!

Michael Jerosch-Herold




More information about the R-help mailing list