[R-sig-ME] group-specific model slopes differ from the global slope: random slopes in lme?

Ben Bolker bbolker @ending from gm@il@com
Fri Aug 3 16:14:37 CEST 2018


On Fri, Aug 3, 2018 at 8:44 AM Tim Richter-Heitmann
<trichter using uni-bremen.de> wrote:
>
> Dear List,
>
> i am running lme with spatial correlation structures for a dataset of
> ~180 observations across six groups:
>
> fit <- lme(outcome~var1+var2+var3, random=1|group, correlation=cor....,
> data, method="ML").
>
> For some models, this works well; plotting the data reveals a nice
> agreement within the six groups in regards of the slope of the model.
>
> However, for other models, plotting the data reveals that the global
> slope is clearly differing from a group-specific slope (interestingly,
> the global model explains the data fairly well, when plotted without
> facetting by group, also the qqplots look nice).
>
> I found some references in the net that lme can incorporate random
> slopes, but i have not found tutorials how to do this. Advice would be
> well appreciated

  A random-slope model is specified in general by ~1+x|group ; using
the Orthodont
data that comes with nlme, for example,

lme(distance~age*Sex,random=~1+age|Subject,Orthodont)

 Furthermore, the notation for the random-effects formula is shared
across many of the mixed-model
packages in R (with the exception of MCMCglmm: e.g. lme4, glmmTMB,
brms, ...), so that most any tutorial on random-slopes model that
you find will be adaptable to lme. There is a (very brief) section in
the GLMM FAQ, with additional links:
<http://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#model-specification>
. Or you could do something drastic :-) and get a copy of Pinheiro and
Bates 2000 (Springer), which is the canonical documentation for lme.



> Also, philosophically, isnt a random slope, random intercept-model
> equivalent to modelling the six groups independently? Also, how to
> report this in a manuscript? Or better not use random intercept models
> at all?

  No; it assumes that (1) the residual variance is the same across all
groups (unless you go out of your way to specify otherwise) and (2)
the group-level intercepts and slopes are drawn from a bivariate
normal distribution.

  Six groups is perhaps too small for fitting a random-slopes model,
but you might succeed.
>
> --
> Dr. Tim Richter-Heitmann
>
> University of Bremen
> Microbial Ecophysiology Group (AG Friedrich)
> FB02 - Biologie/Chemie
> Leobener Straße (NW2 A2130)
> D-28359 Bremen
> Tel.: 0049(0)421 218-63062
> Fax: 0049(0)421 218-63069
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list