[R-sig-ME] lmer, intercepts and offsets

Daniel Farewell farewelld at cf.ac.uk
Tue Mar 27 17:19:17 CEST 2007

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))

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.


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.

More information about the R-sig-mixed-models mailing list