anova (lm, lmer ) question
On 14-10-04 10:13 AM, Ben Pelzer wrote:
Dear romunov, Ben and Ken, Thanks for your replies. From these I conclude that: - for linear (lmer vs. lm) models there's no problem in using the deviance difference - for generalized linear models (glmer vs. glm) it's ok to use the deviance difference as long as nAGQ=1. Would you agree with me? Best regards, Ben.
Yes, I believe so, but you might want to check the archives. I think I've posted examples to this effect in the past. (The way to double-check this would either be to set up an example where the RE variance was estimated as exactly zero (e.g. a small/noisy data set with a small number of levels of the grouping variable), or to extract the deviance function via devFunOnly=TRUE and force the random effects to zero -- for lmer this is trivial since the fixed effects estimates are profiled out; for glmer you would have to put the deviance function inside a wrapper function that set the variance parameters to zero while filling in specified values for the fixed effects, and optimize over this function ...) Ben Bolker
On 4-10-2014 2:48, Ben Bolker wrote:
Thanks for checking. The comparison with Stata isn't necessarily relevant though -- or question is whether `lm` and `lmer` (or `glm` and `glmer`) include/exclude the same additive constants, so that their log-likelihoods are directly comparable. On Fri, Oct 3, 2014 at 8:38 PM, Ken Beath <ken.beath at mq.edu.au> wrote:
nAGQ=1 and greater than 1 give different results, and the nAGQ=1 matches fairly closely the log likelihood from Stata for 3 quadrature points, so presumably is correct. Stata's Laplace didn't converge with my data. Ken On 4 October 2014 09:06, Ben Bolker <bbolker at gmail.com> wrote:
romunov <romunov at ...> writes:
FWIW, this is from the glmm faq site <http://glmm.wikidot.com/faq>. How can I test whether a random effect is significant?
...
- *do not* compare lmer models with the corresponding lm fits, or
glmer/glm; the log-likelihoods are not commensurate (i.e., they
include
different additive terms)
For what it's worth, I believe this is out of date, _except_ for glmer fits with nAGQ>1. It should be possible to implement anova(<merMod>,<lm>/<glm>) -- it's only a nuisance (sadly, if we were still using S4 classes at this level it would be easier ...) Ben Bolker
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-- *Ken Beath* Lecturer Statistics Department MACQUARIE UNIVERSITY NSW 2109, Australia Phone: +61 (0)2 9850 8516 Building E4A, room 526 http://stat.mq.edu.au/our_staff/staff_-_alphabetical/staff/beath,_ken/ CRICOS Provider No 00002J This message is intended for the addressee named and m...{{dropped:11}}
_______________________________________________ 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