[R-sig-ME] Specifying random effects for multiple covariates via lmer
Andy Bush
ajbush at bellsouth.net
Thu Sep 6 13:36:26 CEST 2007
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.
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
In retrospect, I wonder if I should attempt to add an override for default
convergence control values in lmer for m3.
I'll be glad to email you the dataset and programs directly if you'd like.
Respectfully,
Andy
-----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