[R-sig-ME] Summarizing the fitted model takes more RAM than
Douglas Bates
bates at stat.wisc.edu
Mon Dec 15 17:35:45 CET 2008
On Mon, Dec 15, 2008 at 10:16 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> Note that the fitted method in lme had a level= argument that is no
> longer available in lmer presumably because lmer does not assume
> a hierarchy -- but do we have or will we have an easy way to get the
> same effect as fitted(..., level=) in lmer?
One would need to define such a method carefully. If the factors
defining random effects form a strictly nested sequence then there is
an interpretation of level. If you do not have a strictly nested
sequence then I can only make sense of having all the random effects
defining fitted values (which is what the method for fitted returns
now) or having none of them. The second is using the fixed-effects
coefficients only.
> library(nlme)
> # example from plot.lme
> fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)
>
> fit0 <- fitted(fm1, level = 0)
> fit1 <- fitted(fm1, level = 1)
>
> (Maybe this is a bad example since its actually not so hard:
> fitted(lmer(distance ~ age + (age|Subject), Orthodont))
> gives level 1 and
> fitted(lm(distance ~ age, Orthodont))
> gives level 0 but even here it involved the complexity of using different
> approaches to get them whereas with lme one could do it in a
> unified manner.)
I don't know if fitted(lm(distance ~ age, Orthodont)) produces the
desired result. Removing the random effects from the prediction is not
always the same as removing the random effects from the fit. I would
get the fitted values for the fixed effects only using
as.vector(model.matrix(fm1) %*% fixef(fm1))
> On Mon, Dec 15, 2008 at 10:19 AM, Douglas Bates <bates at stat.wisc.edu> wrote:
>> I believe you are using the terminology of multilevel modeling where
>> one characterizes factors as being at the first level, the second
>> level, etc. One can fit multilevel models using lmer but one can also
>
More information about the R-sig-mixed-models
mailing list