[R-sig-ME] lmer, intercepts and offsets
Douglas Bates
bates at stat.wisc.edu
Tue Mar 27 19:28:32 CEST 2007
On 3/27/07, Daniel Farewell <farewelld at cf.ac.uk> wrote:
> I've run into difficulties trying to completely specify the fixed effects part of an lmer model. For instance,
>
> fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
>
> gives fixed effects estimates of around 250 (intercept) and 10 (slope). Suppose that you wanted to evaluate the likelihood (or some other function of the parameters) at specific parameter values. For instance, you might be interested in a profile likelihood holding the fixed effects at _exactly_ 250 and 10.
>
> It is reasonably straightforward to specify variance components via the "start" argument, and to ask lmer not to update these estimates via the various "control" arguments. This kind of profiling, holding the variance components fixed, is not too tricky.
>
> The reverse is harder, but one possibility would be to use an offset.
>
> lmer(Reaction ~ 0 + (1|Subject) + (0+Days|Subject), sleepstudy, offset = fm2 at X %*% c(250, 10))
I'll need to look at what happens inside of lmer to an offset.
Motivated by your example I looked at the code for handling an offset
in lmer2 and found 2 errors, which I have fixed.
However, this doesn't solve your original problem of how you can
profile the log-likelihood or, equivalently, the deviance. The lmer
and lmer2 structures are constructed to allow for simple evaluation of
the profiled deviance. This is a function of the relative
variance-covariance of the random effects only. (See the
"Implementation" vignette.) The contribution of the fixed-effects
parameters and, if used, the scale parameter in the distribution of
the response given the linear predictor has been removed.
It would be possible to reintroduce these parameters and evaluate the
deviance but it isn't trivial. First you need to write out the
explicit expression for the deviance and then decide how to evaluate
all the terms in that expression. Especially for a GLMM doing this is
complicated.
> However, this gives the following error:
>
> Error in lmer(Reaction ~ 0 + (1 | Subject) + (0 + Days | Subject), sleepstudy, :
> Xp must be a real matrix
>
> It seems that lmer does not allow the fitting of a model with no fixed effects terms. Is this restriction necessary? I can think of other situations where it would be useful to have a variance-components-only model.
>
> Setting this issue aside, does lmer notice the offset at all? This fit
>
> lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy, offset = fm2 at X %*% c(250, 10))
>
> is identical to fm2. An alternative specification
>
> update(fm2, offset = fm2 at X %*% c(250, 10))
>
> gives the error
>
> Error in eval(expr, envir, enclos) : ..1 used in an incorrect context, no ... to look in
>
> while this
>
> update(fm2, formula = I(Reaction - fm2 at X %*% c(250, 10)) ~ .)
>
> is the fit I was expecting.
>
> To summarise this rather rambling request for help:
>
> 1. (Why can't/how can) you fit an lmer model with no fixed effects terms?
> 2. Is the offset argument working correctly and, if so, how should it be used?
>
> As ever, I'd be most grateful for any advice.
>
> Daniel
>
> P.S. How to specify the residual variance is another question entirely;
> since I mostly work with GLMMs this isn't usually an issue for me.
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list