[R] different DF in package nlme and lme4

Spencer Graves spencer.graves at pdf.com
Tue Jan 4 01:31:53 CET 2005


Hi, Christoph: 

      As documented in Pinheiro and Bates (2000) Mixed-Effects Models 
for S and S-Plus (Springer), the nlme package includes a function 
"simulate.lme".  They used that function to study the performance of the 
likelihood ratio statistic under the null hypothesis of no effect.  The 
case they considered has a parameter at a boundary, which violates one 
of the assumptions of the standard 2*log(likelihood ratio) being 
approximately chi-square.  Their results appear in sec. 2.4 of that 
book.  I don't know who were the first to investigate cases like this, 
but Pinheiro and Bates are, as far as I know, among the leaders in this 
area.  I found their discussion understandable, useful, even profound. 

         If your question has not been answered by the discussion so 
far, I suspect that you should be able to conduct an appropriate 
simulation, perhaps using "simulate.lme" or building your own.  From 
Doug's and Frank's comments, it sounds like there are still open 
questions here, and others might be interested in your simulation 
results if you have the need and the time to pursue it. 

      hope this helps.  spencer graves

Douglas Bates wrote:

> Frank E Harrell Jr wrote:
>
>> Douglas Bates wrote:
>>
>>> Christoph Buser wrote:
>>>
>>>> Hi all
>>>>
>>>> I tried to reproduce an example with lme and used the Orthodont
>>>> dataset.
>>>>
>>>> library(nlme)
>>>> fm2a.1 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1 
>>>> | Subject)
>>>> anova(fm2a.1)
>>>
>>
>> ...
>>
>>>> Regards,
>>>> Christoph Buser
>>>>
>>>
>>> No.  The calculation of denominator degrees of freedom in lme4 is 
>>> bogus and I believe this is documented.  Note that for all practical 
>>> purposes there is very little difference between 25 and 100 
>>> denominator degrees of freedom.
>>>
>>> lme4 is under development (and has been for a seemingly interminable 
>>> period of time).  Getting the denominator degrees of freedom 
>>> calculation "right" is way down the list of priorities.
>>>
>>> Many people express dismay about the calculation of denominator 
>>> degrees of freedom in all versions of lme4.  IIRC Frank Harrell 
>>> characterizes this as one of the foremost deficiencies in R relative 
>>> to SAS.  I don't agree that this is a glaring deficiency.  In fact I 
>>> believe that there is no "correct" answer.  The F statistics in a 
>>> mixed model do not have an F distribution under the null 
>>> hypothesis.  It's all an approximation, which is why I don't stay up 
>>> nights worrying about the exact details of the approximation.
>>
>>
>>
>> Doug - the main concern is accurate P-values; I don't really care 
>> which approximations are best, just that the ones used are at least 
>> as good as those in SAS.  Without being an expert, I have come to 
>> believe that at the moment SAS is better than R in 2 areas: accurate 
>> P-values from mixed models and handling massive databases.  On the 
>> former point I could easily be swayed by some type I error simulations.
>>
>>>
>>> My plan for lme4 is that one slot in the summary object for an lme 
>>> model will be an incidence table of terms in the fixed effects 
>>> versus grouping factors for the random effects.  This table will 
>>> indicate whether a given term varies within groups defined by the 
>>> grouping factor.  Anyone who wants to implement their personal 
>>> favorite calculation of denominator degrees of freedom based on this 
>>> table will be welcome to do so.
>>
>>
>>
>> I will be interested also to see timings of lme4 (using S4) vs nlme 
>> (using S3) for the same model.
>
>
> Such comparisons would be more heavily influenced by the different 
> algorithms used in the two packages than by S3 versus S4.  The lme4 
> package is not just a translation of the lme part of nlme into S4 
> classes and methods.  It is a complete reimplementation from scratch.
> It indeed faster than the code in nlme but more important is the fact 
> that it will handle models/data sets that simply could not be fit in 
> nlme.
>
> ______________________________________________
> 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