[R] lmm WITHOUT random factor (lme4)

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Thu Mar 17 15:29:19 CET 2011

Dear Mark,

You cannot compare lm() with lme() because the likelihoods are not the same. Use gls() instead of lm()

data("sleepstudy", package = "lme4")
fm <- lm(Reaction ~ Days, sleepstudy)
fm0 <- gls(Reaction ~ Days, sleepstudy)

fm1 <- lme(Reaction ~ Days, random= ~1|Subject, sleepstudy)
anova(fm0, fm1)

Best regards,


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen

Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen

tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op r-project.org 
> [mailto:r-help-bounces op r-project.org] Namens Mark Difford
> Verzonden: donderdag 17 maart 2011 10:55
> Aan: r-help op r-project.org
> Onderwerp: Re: [R] lmm WITHOUT random factor (lme4)
> On Mar 17, 2011; 11:43am Baugh wrote:
> >> Question: can I simply substitute a dummy var (e.g. populated by 
> >> zeros) for "ID" to run the model without the random factor? when I 
> >> try this R returns values that seem reasonable, but I want 
> to be sure 
> >> this is appropriate.
> If you can fit the model using lme (and it looks like you 
> easily can) then another check would be:
> ## Compare models with and without random effects fm <- 
> lm(Reaction ~ Days, sleepstudy)
> fm1 <- lme(Reaction ~ Days, random= ~1|Subject, sleepstudy)
> anova(fm1, fm)                 ## lme-fitted model must come first
> Regards, Mark.
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/lmm-WITHOUT-random-factor-lme4-t
> p3384054p3384072.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list