[R-sig-ME] lme4 versus nlme

Simon Blomberg s.blomberg1 at uq.edu.au
Fri Mar 14 05:25:55 CET 2008

lmer is really good for crossed random effects models. They are easy to
fit and fast, as Harold said. However, lmer still (? Doug?) lacks the
ability to incorporate complex covariance structures for the random
effects and the residuals. I find I need that facility a lot, so I
generally stick with the nlme package. You should only trust the F tests
for the fixed effects for nested, balanced designs. lme is set up to
make nested designs easy to code, and crossed random designs a lot more
difficult to code. So including p-values for the fixed effects in lme
seems reasonable.



On Thu, 2008-03-13 at 15:02 -0400, Doran, Harold wrote:
> Kevin:
> lmer is a bit more general, and a heck of a lot faster. The nlme
> function is designed for cases where there is a strict nesting structure
> to the data. You can code for situations in which there are crossed
> random effects, but it is clunky and slooooooow. lmer, on the other
> hand, is specifically optimized for fully crossed or partially crossed
> data and is very fast. It also works for data that are strictly nested.
> There are some vignettes in the lme4 package that you can read to see
> examples of how to use the lmer function. There are also some nifty
> functions that go along with lmer that do not exists for nlme like
> mcmcsamp.
> Harold
> > -----Original Message-----
> > From: r-sig-mixed-models-bounces at r-project.org 
> > [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf 
> > Of Kevin E. Thorpe
> > Sent: Thursday, March 13, 2008 1:54 PM
> > To: r-sig-mixed-models at r-project.org
> > Subject: [R-sig-ME] lme4 versus nlme
> > 
> > I'm a bit confused.
> > 
> > I have started reading Pinheiro and Bates, which is 
> > excellent.  I am trying to rationalize when one would use 
> > lmer() and when one would use
> > lme() (I know lmer() is not covered in the book).
> > 
> > I have read a number of the treads about why p-values have 
> > been taken out of lmer() stuff.  Naturally, they still exist 
> > in nlme.  Presumably, I should not trust those p-values either.
> > 
> > The problem still remains that I am encountered more and more 
> > situations where it seems I need a mixed model.  The 
> > investigator wants to know if the groups differ.  What is the 
> > recommended approach to answering those kinds of questions?
> > 
> > Thank you,
> > 
> > Kevin
> > 
> > --
> > Kevin E. Thorpe
> > Biostatistician/Trialist, Knowledge Translation Program 
> > Assistant Professor, Department of Public Health Sciences 
> > Faculty of Medicine, University of Toronto
> > email: kevin.thorpe at utoronto.ca  Tel: 416.864.5776  Fax: 416.864.6057
> > 
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list 
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> > 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Room 320 Goddard Building (8)
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au

1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

The combination of some data and an aching desire for 
an answer does not ensure that a reasonable answer can 
be extracted from a given body of data. - John Tukey.

More information about the R-sig-mixed-models mailing list