[R] no predict function in lme4 ?

Ben Bolker bolker at ufl.edu
Wed Mar 24 02:15:32 CET 2010


Douglas Bates <bates <at> stat.wisc.edu> writes:

> It is not easy to decide what "predict" should return for a linear
> mixed model, let alone the more complicated cases.  Do you want
> predictions based on the fixed-effects only or based on a combination
> of the fixed-effects and the random-effects?  For the lme function in
> the nlme package we allowed "levels" of predictions but that won't
> work for all models that can be fit with lme4.

  I do actually think there's a reasonable way to specify this --
an indicator specifying which random effects should have their
conditional modes included in the prediction (the default could
be either 'none' or 'all').

  Further discussion should presumably move to r-sig-mixed-models.
> 
> On Tue, Mar 23, 2010 at 9:18 AM, Markus Loecher wrote:
> > Dear mixed effects modelers,
> > I seem unable to find a predict method for mer objects in the package lme4.
> > Am I not seeing the forest for the trees ?

  In the meantime you can construct your own model matrices
and use them to generate the predictions by hand -- see

http://glmm.wikidot.com/local--files/examples/Owls.pdf
http://glmm.wikidot.com/local--files/examples/Owls.Rnw

  for a bit of a worked example.

  Ben Bolker



More information about the R-help mailing list