BICBF | R Documentation |
Calculates BIC for the entire model, and for the entire set of models dropping each fixed effect one at a time. Uses the change in BIC between models to approximate Bayes Factors (essentially penalized Likelihood Ratios, or evidence for one model over another). This approach is promoted by, for example, Kass and Raftery (1995; 10.1080/01621459.1995.10476572) and Wagenmakers (2007; 10.3758/BF03194105).
BICBF(modIn, logBase = 3)
modIn |
|
logBase |
Base of the logBF |
NOT intended for relations between two variables (in that case, use robustCor
or similar).
Could use further testing to ensure that formula extraction is correct.
Follows the recommendations of Wagenmakers (2007; PBR), e.g., for LMEMs calculates BIC using -2*logLik(modIn) + attr(logLik(modIn),'df')*log(sum(ngrps(modIn)))
BIC_dropped of the Intercept term is the full model BIC. BIC_dropped of all other coefficients are the BIC of the model without that coefficient. See comment(output) for more information.
Known Bug preventing use with non-multi-level models. In other words,
it is only currently functional for multi-level models (i.e., lmer()
or glmer()
)
d <- data.frame(y = rnorm(60),grup = sample(c('a','b','c','d'),60,replace = T),arb = sample(c('e','f','g','h'),60,replace = T))
d$x <- d$y + rnorm(60,0,.2)
m_lmer <- lme4::lmer(y~x*arb+(1|grup),d,REML = F)
BICBF(m_lmer)
m_glmer <- lme4::glmer(y~x*arb+(1|grup),d,family=gaussian())
BICBF(m_glmer)
m_lm <- lm(ravens ~ alert * corsi + isAdult, dat_cochraneEtAl_2019_PLOSOne)
BICBF(m_lm)
m_rlm <- MASS::rlm(ravens ~ alert * corsi + isAdult, dat_cochraneEtAl_2019_PLOSOne)
BICBF(m_rlm)
m_glm <- glm(y ~ x*arb,d,family=gaussian())
BICBF(m_glm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.