[R-sig-ME] Random slopes without random intercepts

Nathaniel Smith njs at pobox.com
Thu Jan 17 12:25:11 CET 2008


On Thu, Jan 17, 2008 at 11:11:31AM +0000, Nick Isaac wrote:
> Basically, I want to explore the full volume of parameter space for my
> dataset. There's only one fixed effect, but several levels of random
> variation. I can fit all combinations of random intercept and random slope
> models as:
> 
> 1) lmer( y ~ x + (1|A) ...)
> 2) lmer(y ~ x + (x|A) ...)
> 
> The logical way to remove the random intercept is to remove "A" from formula
> 2. But then lmer wouldn't know which level at which to fit the random
> slopes. I tried "A-1" and "(A-1)" but both returned errors.

You want (x-1|A), or (x+0|A) -- the two are identical to each other.

(The trick is that in R, formulas are generally assumed to contain an
intercept term by default.  The intercept term is named "1", so if you
write y ~ x, it's assumed you mean y ~ 1 + x.  You can override this
by explicitly subtracting the 1 off again, or by explicitly putting in
a 0, either way.  The same applies to the specification of random
effect terms.)

-- Nathaniel

-- 
Electrons find their paths in subtle ways.




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