[R-sig-ME] models with no fixed effects

Douglas Bates bates at stat.wisc.edu
Thu Sep 11 21:15:03 CEST 2008


On Thu, Sep 11, 2008 at 8:03 AM, Daniel Farewell
<farewelld at cardiff.ac.uk> wrote:
> I'm running into an error when using lmer to fit models with no fixed effects terms.
>
> For example, generating some data with
>
> df$y <- with(df <- data.frame(i = gl(5, 5), b = rep(rnorm(5), each = 5)), b + rnorm(25))
>
> and fitting like this
>
> fit1 <- lmer(y ~ 1 + (1 | i), df)
>
> works fine. But fitting like this
>
> fit0 <- lmer(y ~ 0 + (1 | i), df)
>
> gives the following error:
>
> CHOLMOD error: Pl?
> Error in mer_finalize(ans) :
>  Cholmod error `invalid xtype' at file:../Cholesky/cholmod_solve.c, line 971

Admittedly that is a rather obscure error message.  It is related to
the fact, apparently not verified, that we should have p, the number
of fixed-effects, greater than zero.

I should definitely add a check on p to the validate method.  (In some
ways I'm surprised that it got as far as mer_finalize before kicking
an error).  I suppose that p = 0 could be allowed and I could add some
conditional code in the appropriate places but does it really make
sense to have p = 0?  The random effects are defined to have mean
zero.  If you have p = 0 that means that E[Y] = 0.  I would have
difficulty imagining when I would want to make that restriction.

Let me make this offer - if someone could suggest circumstances in
which such a model would make sense, I will add the appropriate
conditional code to allow for p = 0. For the time being I will just
add a requirement of  p >  0 to the validate method.




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