[R] question about lmer--different answers from different versions of R?

Spencer Graves spencer.graves at pdf.com
Wed Mar 1 19:31:52 CET 2006


	  Yes, I believe that "lmer" has been under active development during 
the past several months, and an intentional change in the code might 
have produced change you reported.  In particular "lmer" was changed to 
use "nlminb" instead of "optim" last year, and this could easily 
generate the difference you saw.

	  If you wanted to know for sure, you would have to know which version 
of "lme4" was being used in both cases.  For future reference, you might 
consider using "sessionInfo()" routinely with your archives as this 
gives the versions of all packages in the search path as well as the 
version of R.

	  Question:  Have you tried using method="Laplace" or "AGQ"?  The 
function "lmer" actually has three approximate maximum likelihood 
methods.  The default is penalized quasi-likelihood (PQL), which is what 
you get when you don't specify a method or when you request method="ML". 
  The second method "Laplace" is more accurate but requires more compute 
time.  The best known method is Adaptive Gaussian Quadrature (AGQ), 
which unfortunately is only available for some models and often takes 
substantially longer that the other methods when it is available.  In 
case you haven't already, I encourage you to study the vignettes 
"Implementation", "MlmSoftRev" and "StarData" supplied with the "lme4" 
and "mlmRev" packages.  [With vignettes, you can get the R code in a 
seperate script file to make it easy to walk through the code line by 
line while you are reading the *.PDF file.  To do this, you might write 
(Impl <- vignette("Implementation")), which will open 
"Implementation.PDF" in Adobe Acrobat Reader if you have a standard 
installation.  Then edit(Impl) will open the script file for you -- 
unless you use Emacs, and then you need to request Stangle(Impl$file).]

	  hope this helps,
	  spencer graves

Feldman, Tracy wrote:

> To whom it may concern:
> 
> I am using lmer for a statistical model that includes non-normally
> distributed data and random effects.  I used this same function in the
> most recent version of R as of fall 2005, and have re-done some of the
> same analyses using all of the same files, but with the newest version
> of R (2.2.1).  I get answers that are not exactly the same (although I
> do get the same general patterns of significance).  Is there any reason
> why an updated version of lmer in R would give different answers than
> the same function in a previous version?  See example below.  
> 
> I appreciate your help.  Please direct answers to tsfeldman at noble.org
> 
> Sincerely,
> Tracy S. Feldman
> Postdoc, The Samuel Roberts Noble Foundation
> 
> Example:
> The model formulas (same in both):
> 
> fitvisit1.1<-lmer(visitsR~dist + ctrt + (1|rep) + (1|field), family =
> poisson, method = "ML")
> 
> fitvisit1.3<-lmer(visitsR~dist + (1|rep) + (1|field), family = poisson,
> method = "ML")
> 
> Done in fall 2005 (I forget the most recent version then):
>>anova(fitvisit1.1, fitvisit1.3, test = "Chisq")
> Data: 
> Models:
> fitvisit1.3: visitsR ~ dist + (1 | rep) + (1 | field)
> fitvisit1.1: visitsR ~ dist + ctrt + (1 | rep) + (1 | field)
>             Df     AIC     BIC  logLik  Chisq Chi Df Pr(>Chisq)
> fitvisit1.3  7  855.11  878.74 -420.56                         
> fitvisit1.1  8  856.63  883.63 -420.31 0.4856      1     0.4859
> 
> Done in Feb 2006 (in R 2.2.1):
>>anova(fitvisit1.1, fitvisit1.3, test = "Chisq")
> Data: 
> Models:
> fitvisit1.3: visitsR ~ dist + (1 | rep) + (1 | field)
> fitvisit1.1: visitsR ~ dist + ctrt + (1 | rep) + (1 | field)
>             Df     AIC     BIC  logLik  Chisq Chi Df Pr(>Chisq)
> fitvisit1.3  6  875.04  895.29 -431.52                         
> fitvisit1.1  7  876.69  900.32 -431.35 0.3487      1     0.5549
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list