Re: [R] lmm WITHOUT random factor (lme4)

From: ONKELINX, Thierry <Thierry.ONKELINX_at_inbo.be>
Date: Thu, 17 Mar 2011 14:29:19 +0000

Dear Mark,

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

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

fm0 <- gls(Reaction ~ Days, sleepstudy)
logLik(fm)
logLik(fm0)

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

Best regards,

Thierry



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

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

tel. + 32 54/436 185
Thierry.Onkelinx_at_inbo.be
www.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_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] Namens Mark Difford
> Verzonden: donderdag 17 maart 2011 10:55
> Aan: r-help_at_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_at_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.
>



R-help_at_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. Received on Thu 17 Mar 2011 - 14:34:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Mar 2011 - 17:40:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive