[R] fitted values in LMER for the fixed-effects only

Douglas Bates bates at stat.wisc.edu
Fri Sep 28 23:00:50 CEST 2007


On 9/28/07, Anouk Simard <Anouk.Simard at bio.ulaval.ca> wrote:
> Hi,
>
> I would like to extract the fitted values from a model using LMER but
> only for the fix portion of the model and not for the fix and random
> portion (e.g it is the procedure outpm or outp in SAS). I am aware of
> the procedure fitted() but I not sure it give the fitted values both for
> the fixed and random or only the fixed. I looked in the r help and the r
> list and I haven't not found much details about it excepted this
> comments from Douglas Bates in January 2006 :
>
> "Would it help if there were an option in the fitted method to allow for
> fixed-effects only versus fixed- and random-effects? As you say, because
> lmer models do not need to be hierarchical it is not obvious what it
> would mean to include some but not all of the random effects terms in
> the "fitted values". However, it is easy and unambiguous to define
> fitted values for the fixed-effects only.
>
> Up until a few days ago there was an option to do this but then I
> changed the calculation of the fitted values in an attempt to clean up
> the code. The calculation of the level = 0 fitted values in the new
> representation of the fitted model is quite easy. It is
>
> fm1 at X %*% fixef(fm1)"
>
> I tried the last formula, but I want to confirm that this is still the
> proper and best way to get fitted values for the fix effects using lmer.

Yes.



More information about the R-help mailing list