[R] how to fit with "lme" function

From: Nantachai Kantanantha <kantanantha_at_hotmail.com>
Date: Wed 26 Jul 2006 - 07:44:57 EST

Hi everone,

I have a question on using lme on a mixed effects model.

The linear mixed model is in the form of:

y = bX +Zu + e

where "X" and "Z" are the matrices, "b" is the coefficient vector of fixed effects, "u" is the coefficient vector of random effects, and e is an error vector.

I would like to use "lme" function to fit the model and estimate "b" and "u".
However, there is an error when I call the lme function:

fit = lme(y ~ int + X1 + X2 + X3, data = data.fr, random = ~ Z1 + Z2 + Z3 + Z4 + Z5)

int is a vector of 1 in matrix X, used for the intercept term "b0", X1, X2, X3 are columns of matrix X,
Z1 to Z5 are columns of matrix Z,
data.fr = data.frame(y,X,Z).

I got the error message:

Error in getGroups.data.frame(dataMix, groups) :

        Invalid formula for groups

Could you please suggest me know to solve this problem? Do I use incorrect arguments?

Thank you very much.

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Jul 26 07:49:03 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 Wed 26 Jul 2006 - 11:19:45 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.