[Rd] Another wishlist for R

Douglas Bates bates at stat.wisc.edu
Fri Jan 16 20:19:38 MET 2004

Kevin Wright <kwright at eskimo.com> writes:

> 12. Wanted: General-purpose mixed-models function/package
>     The nlme library is very nice for mixed-effects models with nested
>     effects, but it is not very general-purpose.  Even Bates/Pinheiro have said
>     several times in posts to R-help/S-news that nlme was designed for nested
>     models and using other models can be hard.
>       Bates: "highly unintuitive" (crossed effects model)
>       Bates: "algorithms for lme are tuned for nested random effects"
>     For example, in nlme,
>       The syntax for crossed random effects is quite intimidating
>       Try removing the variance component for Rep in: random=~1|Rep/WholePlot.
>       Try changing an nested effect from random to fixed (or vice-versa).
>       Try to extract lsmeans for fixed-effects in a model.
>       Try to do a multiple-comparison of fixed-effects estimates.
>       Try using AR1xAR1 error structure.  The nlme library appears to have 
>         tools for this, but again is syntactically difficult.  I can find no
>         examples.
>     Most of these tasks would ideally be straightforward in a general-purpose
>     mixed-models function (as they are in SAS, Genstat, etc.)

The crossed random effects problem is also in the process of being fixed.
Our recent work on computational methods for mixed-effects models
shows how to structure the calculations but it takes a long time to
get the code designed, implemented, debugged, debugged again, debugged
again, ..., documented, documented some more, documented some more,
debugged again, ...

I am hopeful that I will be able to come up with a single, unified
data structure, based on sparse matrices, that can be used for nested,
crossed, and partically crossed random effects.

At present I am doing a major redesign of the Matrix package to change
to S4 classes and methods and to incorporate sparse matrices.  Once
that is more-or-less stable (I expect a preliminary release by the end
of January) I will work on the implementation of the lme structures.

>     The ASREML software is available in S-Plus (and soon R, I'm told) via
>     the proprietary 'samm' library.  Whereas lme seems excellent for basic
>     nested-effects models and difficult for other models, samm excels at
>     crossed-effects models, but doesn't have the plethora of useful 
>     print, plot, extractor, and summary methods that are found in nlme.

It is interesting that ASREML will be available for R.

More information about the R-devel mailing list