[R-sig-ME] Fwd: Problems withestimationg model in lmer

Douglas Bates bates at stat.wisc.edu
Thu Feb 14 18:55:57 CET 2008


I meant to send a copy of this reply to the list.


---------- Forwarded message ----------
From: Douglas Bates <bates at stat.wisc.edu>
Date: Thu, Feb 14, 2008 at 11:41 AM
Subject: Re: [R-sig-ME] Problems withestimationg model in lmer
To: Nicholas Lewin-Koh <lewin-koh.nicholas at gene.com>
Cc: Bert Gunter <gunter.berton at gene.com>


On Thu, Feb 14, 2008 at 11:14 AM, Nicholas Lewin-Koh
 <lewin-koh.nicholas at gene.com> wrote:
 > Hi,
 >  Yes, and to follow up further, if I do
 >  > fit2<-lmer(tVol~Dose*(Day + I(Day^2))+(1|ID),dat,na.action=na.exclude)
 >  the coef(fit2) works, as your reply suggests.

 Thanks for checking that (and thanks for quietly correcting my writing
 Day^2 when I should have written I(Day^2)).  You have switched the
 random effect specification in this case from (Day|ID) to (1|ID).  The
 problem in the previous specification was that there isn't a
 fixed-effect coefficient named 'Day' when you specify the model as


 tVol ~ Dose*poly(Day, 2) + (Day|ID)

 The two columns in the matrix of random effects for the ID factor (the
 first, and only, component of the list returned by ranef) are labelled
 '(Intercept)' and 'Day'.  To calculate the linear coefficients for
 each group these must be aligned with elements of the fixed-effects
 vector.  It works for '(Intercept)' but not for 'Day' when you use
 poly(Day, 2).


 > But I still get the same error from
 >  > mcmcsamp(fit2)
 >
 > Error: no positive eigenvalues!
 >  Error in t(.Call(mer_MCMCsamp, object, saveb, n, trans, verbose, deviance))
 >  :
 >   error in evaluating the argument 'x' in selecting a method for function
 >  't'
 >  The first error comes from the check for a positive definite covariance,

 That is a check on the positive definite covariance matrix within the
 MCMC sampling scheme and is indeed a bug.  Thanks for the report.  I
 will disable mcmcsamp in the alpha test version until I can fix that
 bug.

 By the way, in your sessionInfo() output I see that you have both the
 nlme and lme4 packages loaded at the same time.  That is not a good
 idea.  They interfere with each other's definitions of some of
 accessor functions like VarCorr.



 >  But I don't think that is the source of the problem. Let me know if there is
 >  any other information I can send.
 >
 >  Nicholas
 >
 >
 >
 >  -----Original Message-----
 >  From: Bert Gunter [mailto:gunter.berton at gene.com]
 >  Sent: Thursday, February 14, 2008 8:50 AM
 >  To: 'Nicholas Lewin-Koh'; 'Douglas Bates'
 >  Subject: RE: [R-sig-ME] Problems withestimationg model in lmer
 >
 >  Doug. Note that mcmcsamp() generated .Call(mer_MCMCsamp), not coef().
 >
 >  -- Bert
 >
 >  -------Original Message-----
 >  From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas
 >  Bates
 >  Sent: Thursday, February 14, 2008 7:20 AM
 >  To: Nicholas Lewin-Koh
 >  Cc: r-sig-mixed-models at r-project.org; Bert Gunter
 >  Subject: Re: [R-sig-ME] Problems withestimationg model in lmer
 >
 >  2008/2/13 Nicholas Lewin-Koh <lewin-koh.nicholas at gene.com>:
 >  > Consider the attached tumor growth data:
 >  >  dat<-read.table("ListDat.txt",header=TRUE)
 >  >  library(lme4)
 >  >  fit<-lmer(tVol~Dose*poly(Day,2)+(Day|ID),dat)
 >  >  coef(fit)
 >  >  Error in coef(fit) : unable to align random and fixed effects
 >  >  mcmcsamp(fit)
 >  >  Error: no positive eigenvalues!
 >  >  Error in t(.Call(mer_MCMCsamp, object, saveb, n, trans, verbose,
 >  deviance))
 >  >  :
 >  >   error in evaluating the argument 'x' in selecting a method for function
 >  >  't'
 >
 >  Could you send us the output of sessionInfo() please?  A call to coef
 >  should not generate .Call(mer_MCMCsamp, ...)
 >
 >  The error message about "unable to align" will go away if you use
 >
 >  tVol ~ Dose*(Day + Day^2) + (Day|ID)
 >
 >  >  detach(package:lme4)
 >  >  library(nlme)
 >  >  fit.lme<-lme(tVol~Dose*poly(Day,2),dat,random=~1+Day|ID)
 >  >  coef(fit.lme)
 >  >  summary(fit.lme)
 >  >
 >  >  works fine in lme. I think this model should be identified, is there an
 >  >  estimation instability I am unaware of? My interest is in prediction not
 >  >  inference, so I am not too concerned about the large number of
 >  parameters. I
 >  >  am using the current R-forge version of lme4.
 >  >
 >  >  Thanks
 >  >
 >  >  Nicholas
 >  >  Statistician, Genentech Inc.
 >  >
 >  >
 >  >
 >  >
 >  >   "Seek the company of those who seek the truth, and run away from those
 >  who
 >  >  have found it." - Vaclav Havel
 >  >
 >  > _______________________________________________
 >  >  R-sig-mixed-models at 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