wviechtb / metafor

A meta-analysis package for R
https://www.metafor-project.org
230 stars 52 forks source link

`refit` argument in anova() #59

Closed bwiernik closed 2 years ago

bwiernik commented 2 years ago

Would it be possible to add a refit argument to anova() ala lme4/glmmTMB to automatically refit REML models with ML so that models with different fixed effects can be meaningfully compared?

wviechtb commented 2 years ago

Let me consider that. I think lme4/glmmTMB do such a refit by default, right? If so, then I would not want to do that (so refit=FALSE would be the default), but giving the option by setting refit=TRUE is something I could consider.

wviechtb commented 2 years ago

Also, I just noticed that at least lme4 also refits REML models even if they are identical in their fixed effects. That seems like a strange choice since there is no objection to LRTs based on REML model fits in this case (leaving aside the issue of what the appropriate null distribution is, but that issue affects ML/REML equally).

wviechtb commented 2 years ago

Added in 457f965 (default is refit=FALSE and it only applies when doing a LRT of two models fitted with REML that differ in their fixed effects).

bwiernik commented 2 years ago

The default in glmmTMB is FALSE so that’s reasonable and makes sense to me! Awesome!

wviechtb commented 2 years ago

Good to know that there is some precedent for refit=FALSE as well.

Thanks for bringing up this issue -- definitely a nice addition.

bwiernik commented 2 years ago

Thank you!