[R-sig-ME] Fixed effects only model with lme4

Ben Bolker bolker at ufl.edu
Sat Jun 6 19:53:14 CEST 2009


  Be careful.  I'm not sure that the likelihoods as calculated
by lm and lmer have the same additive constants/are directly
comparable ... (see link in previous message).

Douglas Bates wrote:
> On Sat, Jun 6, 2009 at 12:03 PM, Jeroen Ooms<jeroenooms at gmail.com> wrote:
>> For my GUI, I would like the user to be able to compare a fixed effects
>> model with a random effects model. For example:
>> fm0 <- lmer(Reaction ~ Days, sleepstudy);
>> fm1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy);
>> anova(fm0,fm1);
>>
>> However, this returns the obvious "No random effects terms specified in
>> formula" error for the first model. I've also tried fitting the fixed
>> effects model with lm:
>>
>> fm0 <- lm(Reaction ~ Days, sleepstudy);
>> fm1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy);
>> anova(fm0,fm1);
> 
> Try listing them the other way around
> 
> anova(fm1, fm0)
> 
> If the first model in the call to anova is of class "lm" then the
> method for that class is the one chosen and that method doesn't know
> about models created by lmer.  You must list them so that the lmer
> model comes first.
> 
>> However, now the anova function starts complaining. Is there a way to
>> perform variance analysis on a fixed only model and a random effects model,
>> similar to comparing two random effects models?
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc




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