[R-sig-ME] Rasch with lme4

Andy Fugard andy.fugard at sbg.ac.at
Tue Jun 9 18:13:24 CEST 2009


Daniel Ezra Johnson wrote:
>> What happens in practice when you compare the two approaches of [Subject] as a
>> fixed versus as a random effect?
>>
>> Consider:
>>
>>  M1 = lmer(Reaction ~ Days + (1|Subject), sleepstudy)
>>  M2 = lm(Reaction ~ Days + factor(Subject), sleepstudy)
>>
>> The slope estimates for Days for are practically identical, the mean
>> intercepts differ...
> 
> One important difference arises if you have a fixed effect that,
> unlike Days, is "between subject", like Gender for example. In that
> case you MUST use the M1 (mixed-model) approach with Subject as a
> random effect. You CANNOT have Gender as a fixed effect AND Subject as
> a fixed effect.

They're still similar for the example I tried.  (lmer vs. lm)

   Intercept:  250.0442 (SE = 10.0442) vs 293.6628 (SE = 10.8062)
   Days:    10.4498 (SE = 0.8067) vs 10.4511 (SE = 0.8067)
   SexMale: 2.5910 (SE = 4.6849) vs 2.4017 (SE = 4.6864)

(See below.)  The largest difference is in intercepts.

So I still need a good counterexample.  I feel a term like "shrinkage" 
will be involved in an explanation.

A

P.S. I guess lm still is a mixed effects approach - the residuals are a 
random effect at the level of observations? :-)


-------------------------------------------------------------------

 > M1 = lmer(Reaction ~ Days + (1|Subject), sleepstudy)
 >
 > # Use the random intercept to make up a Male/Female IV
 > sleepstudy$Sex = 
cut(ranef(M1)$Subject$"(Intercept)",2,labels=c("Female","Male"))
 >
 > # Now again: the same models:
 >
 > M1 = lmer(Reaction ~ Days + Sex + (1|Subject), sleepstudy)
 > summary(M1)
...
             Estimate Std. Error t value
(Intercept) 250.0442    10.0442  24.894
Days         10.4498     0.8067  12.954
SexMale       2.5910     4.6849   0.553

 >
 > M2 = lm(Reaction ~ Days + Sex + factor(Subject), sleepstudy)
 > summary(M2)

...

Coefficients:
                     Estimate Std. Error t value Pr(>|t|)
(Intercept)         293.6628    10.8062  27.176  < 2e-16 ***
Days                 10.4511     0.8067  12.956  < 2e-16 ***
SexMale               2.4017     4.6864   0.512 0.609020
...




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