Dear Andy,
You are correct. One more question, if I may, because I am not familiar with
SAS Proc Mix.
Is it correct that the SAS Proc Mix example on the webpage specified random
effects only for intercept and slope of age, but not for slope of loght?
Both lmer and lmer2 converged for this model (and if I read you correctly
also for you). Did you run the equivalent SAS Proc Mix script, too? Could
you tell me the logLik, AIC, and BIC values for this run?
Independent of the convergence issue, I wanted to highlight the large
differences in estimates of random-effect covariances for lmer and lmer2
when both converged.
Best
Reinhold
using:
lme4 Matrix
"0.99875-7" "0.999375-2"
On 9/13/07, Bush, Andrew J wrote:
>
> Dear Reinhold,
>
>
>
> Thank you for forwarding your message.
>
>
>
> For clarification, I had removed case 197 (sorry I left that unstated in
> my query) and was trying to be faithful to the Fitzmaurice, et al., text
> example by using the natural log of height and base height.
>
>
>
> You are absolutely correct, both lmer and lmer2 converge for the model in
> question using height and base height in their raw metric.
>
>
>
> However, I think you will find that if you run the model after logging
> those two variables, both lmer2 and SAS Proc Mixed converge but the current
> version of lmer does not. At least that is what happens on my machine.
>
>
>
> Also, I agree with the positive comments about this text and I plan to
> adopt it for a course I'm teaching soon.
>
>
>
> Regards,
>
> Andy
>
>
> ------------------------------
>
> *From:* Reinhold Kliegl [mailto:reinhold.kliegl@gmail.com]
> *Sent:* Thursday, September 13, 2007 6:05 AM
> *To:* Bush, Andrew J
> *Subject:* Fwd: [R-sig-ME] lmer vs lmer2
>
>
>
> Dear Andrew,
>
>
>
> I guess, you should have been a direct receiver of these emails, too.
>
>
>
> Best
>
> Reinhold
>
>
>
>
>
> Begin forwarded message:
>
> Hi,
>
>
>
> Actually, I just took a look at the SAS code. They also removed ID=197!
>
>
>
> They also included InitHeight and InitAge as subject-level predictors. If
> one runs the following model
>
>
>
> lmer(LogFEV1 ~ Height + Age + InitHeight + InitAge +
> (Height+Age|ID),data=a, subset=ID != 197)
>
> or
>
> lmer2(LogFEV1 ~ Height + Age + InitHeight + InitAge +
> (Height+Age|ID),data=a, subset=ID != 197),
>
>
>
> one can compare AIC and BIC values for SAS and lmer.
>
>
>
> Interestingly, lmer and lmer2 yield smaller AIC (-4632) and BIC (-4570)
> values than what is listed as SAS output (-4576; -4550).
>
> Smaller ist better. Does this also mean that lmer estimates are "better"?
>
>
>
> Best
>
> Reinhold
>
>
>
>
>
> Begin forwarded message:
>
>
>
> *From: *Reinhold Kliegl
>
> *Date: *September 13, 2007 11:13:54 AM GMT+02:00
>
> *To: *Henric Nilsson (Private)
>
> *Cc: *R-sig-mixed-models@r-project.org
>
> *Subject: **Re: [R-sig-ME] lmer vs lmer2*
>
>
>
> Hi,
>
>
>
> There appears to be one very striking outlier on logFEV1. If one removes
> this observation, both lmer and lmer2 converge to almost identical
> fixed-effect estimates. There are, however, substantial differences in the
> random-effect estimates, in particular in the covariances. I suspect this
> reflects instability due to the high correlation between Age and Height (
> 0.89).
>
>
>
> I was also wondering why you included inital age and initial height as
> separate predictors? As far as I could see, these values are always
> identical with the first measure of Height and Age within each subject.
>
>
>
> Best
>
> Reinhold
>
>
>
> > a <- a[a$LogFEV1>-0.5,]
>
> > lmer2(LogFEV1 ~ Height + Age + (Height+Age|ID),data=a)
>
> Linear mixed-effects model fit by REML
>
> Formula: LogFEV1 ~ Height + Age + (Height + Age | ID)
>
> Data: a
>
> AIC BIC logLik MLdeviance REMLdeviance
>
> -4644 -4593 2331 -4688 -4662
>
> Random effects:
>
> Groups Name Variance Std.Dev. Corr
>
> ID (Intercept) 6.3740e-02 0.2524674
>
> Height 3.4275e-02 0.1851349 -0.919
>
> Age 1.1319e-05 0.0033643 -0.011 -0.176
>
> Residual 3.3700e-03 0.0580516
>
> Number of obs: 1993, groups: ID, 299
>
>
>
> Fixed effects:
>
> Estimate Std. Error t value
>
> (Intercept) -1.887924 0.033637 -56.13
>
> Height 1.646210 0.031535 52.20
>
> Age 0.019062 0.001273 14.98
>
>
>
> Correlation of Fixed Effects:
>
> (Intr) Height
>
> Height -0.965
>
> Age 0.722 -0.855
>
> > lmer(LogFEV1 ~ Height + Age + (Height+Age|ID),data=a)
>
> Linear mixed-effects model fit by REML
>
> Formula: LogFEV1 ~ Height + Age + (Height + Age | ID)
>
> Data: a
>
> AIC BIC logLik MLdeviance REMLdeviance
>
> -4643 -4593 2331 -4688 -4661
>
> Random effects:
>
> Groups Name Variance Std.Dev. Corr
>
> ID (Intercept) 6.1270e-02 0.247527
>
> Height 2.8940e-02 0.170117 -0.931
>
> Age 5.6101e-07 0.000749 -0.931 0.999
>
> Residual 3.3849e-03 0.058180
>
> number of obs: 1993, groups: ID, 299
>
>
>
> Fixed effects:
>
> Estimate Std. Error t value
>
> (Intercept) -1.890317 0.033351 -56.68
>
> Height 1.649108 0.031003 53.19
>
> Age 0.018908 0.001244 15.19
>
>
>
> Correlation of Fixed Effects:
>
> (Intr) Height
>
> Height -0.965
>
> Age 0.716 -0.850
>
> > sessionInfo()
>
> R version 2.5.1 Patched (2007-07-14 r42258)
>
> i386-apple-darwin8.10.1
>
>
>
> locale:
>
> C
>
>
>
> attached base packages:
>
> [1] "splines" "grid" "stats" "graphics" "grDevices" "utils"
> "datasets"
>
> [8] "methods" "base"
>
>
>
> other attached packages:
>
> ggplot2 colorspace MASS proto ggplot
> RColorBrewer reshape
>
> "0.5.4" "0.95" "7.2-35" "0.3-7" "0.4.2" "
> 0.2-3" "0.8.0"
>
> lme4 Matrix lattice
>
> "0.99875-6" "0.999375-0" "0.16-2"
>
>
>
> On Sep 13, 2007, at 9:51 AM, Henric Nilsson (Private) wrote:
>
>
>
> Quoting Martin Maechler :
>
>
>
> "DB" == Douglas Bates
>
> on Thu, 6 Sep 2007 11:17:17 -0500 writes:
>
>
>
> DB> On 9/6/07, Bush, Andrew J wrote:
>
> Dear Douglas,
>
>
>
> In frustration, I invoked lmer2 this morning and I'm pleased
>
> to be able
>
> to tell you that lmer2 copes well and quickly with the model having a
>
> random intercept and two random covariate slopes. I have not
>
> been able
>
> to get lmer to converge for the model on the same data.
>
>
>
> DB> Thanks for the information.
>
>
>
> DB> I expect to remove the confusion between lmer and lmer2 in the
> near
>
> DB> future. The development version of the lme4 package has an lmer
>
> DB> function that is close to the current lmer2 in design. It should
>
> DB> exhibit the same convergence behavior and be slightly faster
>
> on models
>
> DB> fit to large data sets than is the current lmer2.
>
>
>
> DB> This version has been in development for longer than I had
> expected.
>
> DB> I still have a few "infelicities" to resolve in the Laplace
>
> method for
>
> DB> generalized linear mixed models before I make test versions
>
> available.
>
>
>
> DB> I would be interested in the data set if you would be willing to
>
> DB> provide it. I could perhaps incorporate it in the lme4 package so
>
> DB> others would have access to it.
>
>
>
> Yes, indeed.
>
> The example might be particularly interesting as test case, not
>
> only because some software implementations "converge" with
>
> singular covariance matrix, but also because it
>
> differs from other examples in having "many" fixed effects and
>
> just one level random effects.
>
>
>
> The data set in question, and, I belive, most others from Fitzmaurice,
>
> Laird and Ware's (2004) book on longitudinal data analysis, is
>
> available along with accompanying SAS programs at
>
>
>
> http://biosun1.harvard.edu/~fitzmaur/ala/
>
>
>
> In particular, the data used above is here
>
>
>
> http://biosun1.harvard.edu/~fitzmaur/ala/fev1.txt
>
>
>
> and the SAS code is here
>
>
>
> http://biosun1.harvard.edu/~fitzmaur/ala/prog8_8.html
>
>
>
>
>
> HTH,
>
> Henric
>
>
>
>
>
>
>
>
>
> Martin
>
>
>
> -----Original Message-----
>
> From: dmbates@gmail.com [mailto:dmbates@gmail.com ] On
> Behalf
>
> Of Douglas
>
> Bates
>
> Sent: Wednesday, September 05, 2007 9:22 PM
>
> To: ajbush@bellsouth.net
>
> Cc: r-sig-mixed-models@r-project.org
>
> Subject: Re: [R-sig-ME] Specifying random effects for multiple
>
> covariates via lmer
>
>
>
> On 9/5/07, Andy Bush 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.
>
>
>
>
>
> DB> _______________________________________________
>
> DB> R-sig-mixed-models@r-project.org mailing list
>
> DB> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
> _______________________________________________
>
> R-sig-mixed-models@r-project.org mailing list
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
>
>
>
>
> _______________________________________________
>
> R-sig-mixed-models@r-project.org mailing list
>
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
>
>
>
>
> ----
>
> Reinhold Kliegl, Dept. of Psychology, University of Potsdam,
>
> Karl-Liebknecht-Strasse 24-25, 14476 Potsdam, Germany
>
> phone: +493319772868, fax: +493319772793
>
> http://www.psych.uni-potsdam.de/people/kliegl/
>
>
>
>
>
>
>
[[alternative HTML version deleted]]