[R] the function lme in package nlme

Thomas Lumley thomas at biostat.washington.edu
Tue Mar 28 19:39:53 CEST 2000


On Tue, 28 Mar 2000, Faheem Mitha wrote:

> 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.

This is only a temporary difference.  The nlme library underwent a major
revision between versions 2 and 3.  R has version 3 but many current
versions of S-PLUS still use version 2. I believe you can obtain version 3
for S-PLUS from nlme.stat.wisc.edu.

Mathsoft has slower release cycles with more detailed planning, so it
will take them longer to incorporate the new nlme.
 

> 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} 

<snip> 

> 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)
> 

You trying to fit a random intercept _and_ compound symmetric
correlation of the residuals. This is not a good idea.

I think you want

  lme(y~x,random=~x|clus,data=labor.df)

that is, a random intercept and random slope within each cluster, and
independent residuals epsilon_ij

The example in help(lme) is of this type.

	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list