[R] different DF in package nlme and lme4

Douglas Bates bates at stat.wisc.edu
Mon Jan 3 18:14:02 CET 2005


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.




More information about the R-help mailing list