[R-pkgs] Release candidate 1 of lme4_0.6-1

Douglas Bates bates at stat.wisc.edu
Wed Apr 28 20:16:04 CEST 2004

Deepayan Sarkar and I have a source package of release candidate 1 of
the 0.6 series of the lme4 package available at
This package requires Matrix_0.8-6 which has been uploaded to CRAN and
should be available in a few days.  A copy of the source package is
available as

Although this version of lme4 passes "R CMD check" on our GNU/Linux
systems we have not uploaded it to CRAN because it still lacks
capabilities that are available in lme4_0.5-2, which is currently on
CRAN.  As soon as we have all the capabilities of the 0.5 series
available in the 0.6 series we will release lme4_0.6-1.tar.gz to CRAN.

This version of lme4 is a complete rewrite of the data structures and
algorithms for fitting linear mixed models.  An incomplete draft
version of a paper describing the methods is available as a vignette.
Subsequent releases will contain a more polished version of this

The big change relative to earlier versions is that you can fit models
with crossed random effects quickly and easily.  For example, using
the data on Scottish secondary school students achievement scores
(from http://multilevel.ioe.ac.uk/softrev/) we can fit a model with
random effects for both the secondary and the primary school attended

> library(lme4)
 This package is in development.  For production work use
 lme from package nlme or glmmPQL from package MASS.
> data(ScotsSec)
> fm1 = lme(attain ~ verbal*sex, ScotsSec, random=list(primary=~1,second=~1))
> gc();system.time(lme(attain ~ verbal*sex, ScotsSec, random=list(primary=~1,second=~1)))
         used (Mb) gc trigger (Mb)
Ncells 701438 18.8    1166886 31.2
Vcells 267929  2.1     786432  6.0
[1] 0.1 0.0 0.1 0.0 0.0
> summary(fm1)
Linear mixed-effects model fit by REML
Fixed: formula 
      AIC      BIC    logLik
 14882.32 14925.32 -7434.162

Random effects:
 Groups   Name        Variance Std.Dev.
 primary  (Intercept) 0.275458 0.52484 
 second   (Intercept) 0.014748 0.12144 
 Residual             4.2531   2.0623  

Fixed effects:
              Estimate Std. Error   DF t value Pr(>|t|)    
(Intercept) 5.9147e+00 7.6795e-02 3431 77.0197  < 2e-16 ***
verbal      1.5836e-01 3.7872e-03 3431 41.8136  < 2e-16 ***
sexF        1.2155e-01 7.2413e-02 3431  1.6786  0.09332 .  
verbal:sexF 2.5929e-03 5.3885e-03 3431  0.4812  0.63041    
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 

Correlation of Fixed Effects:
            (Intr) verbal sexF  
verbal       0.177              
sexF        -0.482 -0.178       
verbal:sexF -0.122 -0.680  0.161

Number of Observations: 3435
Number of Groups: 
primary  second 
    148      19 

There are other examples in the tests subdirectory.  

The lme function behaves as previously *with one exception*.  In the
model specification there is no longer any distinction between crossed
or nested or partially crossed random effects.  This means that for
nested random effects you must ensure that every inner grouping
corresponds to a unique level of the inner grouping factor.  For
example, in the Pixel data there are two grouping factors, Dog and
Side with Side nested within Dog.  You must create a new grouping
factor, say DS, with unique levels for each Dog/Side combination to be
able to specify a model of "Side within Dog".

More information about the R-packages mailing list