[R-sig-ME] interpreting random intercepts when no fixed intercept?present

Emmanuel Curis curis at pharmacie.univ-paris5.fr
Tue Feb 12 17:30:06 CET 2013


Hello,

On Tue, Feb 12, 2013 at 04:10:59PM +0000, Ben Bolker wrote:

«   Hmmm.  I think in order to answer this question I'd have to
« figure out what model.matrix() is doing when we use
« [ordered factor]+0 in a formula.  I thought I knew but now
« I don't think I do ...

According to its code, it also uses the default contrasts, but for
ordered factor it is contr.poly and not contr.treatment.

« > d <- data.frame(f=ordered(rep(1:5,10)),y=runif(50))
« > options(digits=3)
« > coef(lm(y~f,data=d))
« (Intercept)         f.L         f.Q         f.C         f^4 
«       0.525      -0.064       0.154       0.144      -0.116 
« > coef(lm(y~f+0,data=d))
«    f1    f2    f3    f4    f5 
« 0.589 0.651 0.360 0.428 0.599 
« > coef(lm(y~f,data=d,contrasts=list(f=contr.treatment)))
« (Intercept)          f2          f3          f4          f5 
«      0.5885      0.0625     -0.2286     -0.1602      0.0101 

With your example:

>  d <- data.frame(f=ordered(rep(1:5,10)),y=runif(50))
> options(digits=3)
>  coef(lm(y~f,data=d))
(Intercept)         f.L         f.Q         f.C         f^4 
     0.4936     -0.0775     -0.1209      0.0614     -0.0233 
> coef(lm(y~f+0,data=d))
   f1    f2    f3    f4    f5 
0.456 0.600 0.542 0.474 0.397 
> coef(lm(y~f,data=d,contrasts=list(f=contr.poly)))
(Intercept)         f.L         f.Q         f.C         f^4 
     0.4936     -0.0775     -0.1209      0.0614     -0.0233 
> coef(lm(y~f+0,data=d,contrasts=list(f=contr.poly)))
   f1    f2    f3    f4    f5 
0.456 0.600 0.542 0.474 0.397 

I imagine the default choice of contr.poly is to have this separation
between linear, quadratic... terms (orthogonal polynomials?), building
contrasts assuming equally-spaced X values...

«  (It would probably be better to use an example with a clear
« linear and quadratic term and nothing else, for clarity)

«   I think the answer to this is going to have to involve more
« searching into how model.matrix() parameterizes these models.
« Basically, once you know how the fixed effects are parameterized,
« you can interpret what it means to add a zero-mean random-effects
« offset to it ...   

Generally, would it mean by forcing a null fixed intercept means that
we assume that the population average is 0 for the intercept, but vary
from a patient to another?

Of course, assuming a null (mean) intercept strongly depends on the
coding of the quantitative (or ordered) predictor, so can be easily
misleading I guess...

Hope this help,

-- 
                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html



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