# [R] nlme vs gls

Raubertas, Richard richard_raubertas at merck.com
Fri Oct 8 22:02:34 CEST 2004

One thing to be aware of (as Pinheiro and Bates point out on
the same page) is that the general random effects and gls
models are not nested.  This means that the general covariance
matrix you estimate with gls may not correspond to *any*
random effects model.  In that case there are no subject-
specific coefficients (e.g. slopes), in the random effects sense.

Rich Raubertas

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Doran, Harold
> Sent: Friday, October 08, 2004 1:27 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] nlme vs gls
>
>
> Dear List:
>
> My question is more statistical than R oriented (although it
> originates
> from my work with nlme). I know statistical questions are occasionally
> posted, so I hope my question is relevant to the list as I cannot turn
> up a solution anywhere else. I will frame it in the context of an R
> related issue.
>
> To illustrate the problem, consider student achievement test
> score data
> with multiple observations available for each student. One way of
> modeling these data might be
>
> Y_{ti} = (\mu + \mu_{i} ) + (\beta_0 + \beta_{i} )*(time) +
> \epsilon_{ti} ; t indexes time and i indexes student
>
> The nlme code is
>
> tt<-lme(reponse~time, data, random=~time|ID)
>
> With this, I can extract the growth rate for each individual
> in the data
> set. Conceptually this is the sum of the main effect for time plus the
> empirical bayes estimate for each individual:
>
> \beta_0 + \beta_{i}
>
> I can use the coef(tt, ...) to extract these coefficients.
>
> Now, assume that I do not want to include random effects
> associated with
> the slope and intercept, but instead use a gls to account for the
> variances and covariances through an unstructured covariance matrix.
>
> For example, assume the following model fit to the same data
>
> Y_{ti} = \mu  + \beta_0 * (time) + \epsilon_{ti}; where
> e~N(0, \Sigma)
>
> With Sigma forming a more complex covariance matrix. We can
> use the gls
> option as follows for example,
>
> tt1<-gls(response~time, data, correlation=corSymm(form=~1|ID),
> weights=varIdent(form=~1|time))
>
> On p. 254 of P&B, they note that the mixed model "gives as a
> by-product,
> estimates for the random effects, which may be of interest in
> themselves". And in my situation they are. Specifically, I want to
> estimate the growth rate for each individual student.
>
> My questions boils down to:
>
> 1) Is there any way possible to extract or to compute (estimate) the
> growth rate of individual i when the data have been modeled
> using gls?
>
> 2) Can anyone point me to an example or reference where this has been
> done? I have searched but have really turned up empty handed.
>
> It seems that there must be a methodology for doing so as we are
> accomplishing a similar task. Would there be information in the new
> covariance matrix, Sigma, that would help play this role?
>
> These only illustrate the issue, the actual model I am dealing with is
> more complex, but the issue generalizes. Fitting random effects in the
> current model I am dealing with is not a particularly attractive
> solution.  I actually have the issue layed out in more detail
> in a paper
> I am working on and would be happy to share if requested.
>
> I would appreciate any thoughts you might have on this problem.
>
> Harold
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help