# [R] the function lme in package nlme

Faheem Mitha faheem at email.unc.edu
Tue Mar 28 18:48:37 CEST 2000

Dear people,

A somewhat clueless question follows:

I just discovered that the lme function in contrib package nlme for R,
while similar to the lme function in Splus, does not use the cluster
function option. This difference does not appear to be documented in the
V&R `R Complements' file.

I have data which is divided into 6 groups
The lme model is of the form (simplified from the actual model a bit)

y  = a + b x_{ij} + \alpha_i + \beta_i x_{ij} + \epsilon_{ij}

i = 1,...,6.

where a and b are fixed effects and \alpha and \beta are random effects.

I have a vector of the form

clus = (1,1,1,2,5,6,4,4,4,3,...)'

where the 1, 2 3 are all factors corresponding to different groups (or
clusters in Splus terminology).

In Splus I would use the argument

(...,cluster = clus,...)

I thought that the equivalent thing to do in R is to use a argument of the
form

(...,correlation = groups,...)

where groups is a CorStruct object of the class corSymm, where groups is
obtained by

groups <- corSymm(form = ~ 1 | clus)
groups <- initialize(groups, data = labor.df)

Unfortunately this appears to be wrong, since I get the error

**********************************************************************
Error in lme.formula(fixed = earning ~ edu + job.pres + age, random = ~1 +
:
Incompatible formulas for groups in "random" and "correlation"
***********************************************************************

I also don't quite understand what the time covariate in the corSymm
documentation means.

*****************************************************************
form
a one sided formula of the form ~ t, or ~ t | g, specifying a time
covariate t
******************************************************************

I am also wondering why the cluster argument was not retained for
compatibility with Splus. Was there a problem with this?

Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._