[R-sig-ME] Specifying random effects for multiple covariates via lmer

Douglas Bates bates at stat.wisc.edu
Thu Sep 6 14:31:01 CEST 2007


On 9/6/07, Andy Bush <ajbush at bellsouth.net> wrote:
> Thank you for taking the time to try to help me, Douglas. I had already
> formulated the suggested model as model m3 shown below.  Please note that id
> is defined as "ordered" and all other variables are defined as "numeric".
> Here are the models I've tried:
>
> m1=lmer(LFEV1~Age+loght+InitAge+logbht+(1+Age|id),data=fev,
>        na.action=na.omit,
>        method="REML")
> m2=lmer(LFEV1~Age+loght+InitAge+logbht+
>        (1+loght|id),data=fev,
>        na.action=na.omit,
>        method="REML")
> m3=lmer(LFEV1~Age+loght+InitAge+logbht+
>        (Age+loght|id),
>        data=fev,
>        na.action=na.omit,
>        method="REML")
>
> lmer handles models m1 and m2 with no difficulty (and the results agree
> quite closely with SAS Proc Mixed returns). However, lmer generates the
> following warning messages for m3 and lead me to wonder if I'd mispecified
> the model:
>
> 1: Estimated variance-covariance for factor 'id' is singular
>  in: `LMEoptimize<-`(`*tmp*`, value = list(maxIter = 200L, tolerance =
> 1.49011611938477e-08,
> 2: nlminb returned message false convergence (8)
>  in: `LMEoptimize<-`(`*tmp*`, value = list(maxIter = 200L, tolerance =
> 1.49011611938477e-08,
>
> Please note that when I run this model through SAS Proc Mixed, I get quite
> different results for the random effects without apparent convergence
> problems.

Thanks for checking further on this.  I would appreciate it if you
could email the data.  One  way to do this so that it retains all the
attributes is to create an R Data save file

save(fev, file = "fev.rda")

and email that file.  The representation in such a file is independent
of the hardware and operating system.

By the way, when you get such results it is a good idea to rerun the
model fitting process with the "verbose" option set.  In the currently
released version of the lme4 package this is done with the rather
wordy argument specification

control = list(msVerbose = 1)

In the development version of the lme4 package this specification
still works or it can be shortened to

verbose = 1

> Following is the lmer summary of random effects for m3:
>
> Linear mixed-effects model fit by REML
> Formula: LFEV1 ~ Age + loght + InitAge + logbht + (Age + loght | id)
>    Data: fev
>    AIC   BIC logLik MLdeviance REMLdeviance
>  -4511 -4449   2266      -4570        -4533
> Random effects:
>  Groups   Name Variance   Std.Dev.  Corr
>  id            3.1748e-03 0.0563455
>                7.4210e-06 0.0027241 0.064
>                9.4341e-03 0.0971292 0.064 1.000
>  Residual      3.9789e-03 0.0630788
> number of obs: 1993, groups: id, 299

Notice that one of the correlations is effectively 1.00.  This
indicates a singular variance-covariance matrix for the random
effects.  The maximum likelihood estimates or the REML estimates can
correspond to a singular matrix.  In this case none of the variances
are zero, it is a variance of a linear combination of the random
effects that has been driven to zero.   SAS PROC MIXED doesn't handle
this situation well.

> In retrospect, I wonder if I should attempt to add an override for default
> convergence control values in lmer for m3.

Typically that doesn't improve the situation.  If the REML estimates
are singular no amount of tweaking of the optimization procedure will
improve the situation.

> I'll be glad to email you the dataset and programs directly if you'd like.

I appreciate the offer and look forward to examining the data and models.

> -----Original Message-----
> From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas
> Bates
> Sent: Wednesday, September 05, 2007 9:22 PM
> To: ajbush at bellsouth.net
> Cc: r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Specifying random effects for multiple covariates
> via lmer
>
> On 9/5/07, Andy Bush <ajbush at bellsouth.net> wrote:
> > While working through the text "Applied Longitudinal Analysis" by
> > Fitzmaurice, Laird and Ware, I encountered a fairly simple case study (pp
> > 210-7) in which a longitudinal model specifies three random effects: (1)
> > random intercepts for id, (2) random slopes for covariate1 (Age | id), and
> > (3) random slopes for covariate2 (log(ht) | id).  I've had no difficulty
> > formulating lmer models with correlated random intercepts and slopes for
> > either of the covariates individually but have not succeeded when I try to
> > compose a model with correlated random intercepts and slopes for two
> > covariates.
>
> > Following is code that works well with the individual covariates
> separately:
>
> > m1=lmer(LFEV1~Age + loght + InitAge + logbht + (1 + Age | id),data=fev,
> >        na.action=na.omit, method="REML")
>
> > m2=lmer(LFEV1~Age + loght + InitAge + logbht+(1 + loght | id),data=fev,
> >        na.action=na.omit, method="REML")
>
> Maybe I am missing the point but wouldn't the model you are
> considering be written as
>
> lmer(LFEV1 ~ Age + loght + InitAge + logbht + (loght + Age|id), data =
> fev, na.action = na.omit, method = "REML")
>
> That provides correlated random effects for the intercept, the
> coefficient for loght and the coefficient for Age at each level of the
> id factor.
>
>




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