Raw File
Tip revision: 2565fc870cd7f0a64d857ff89e682dc9344dc7c1 authored by Dominique Makowski on 12 February 2020, 04:10 UTC
version 0.5.2
Tip revision: 2565fc8
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayesfactor_inclusion.R
\title{Inclusion Bayes Factors for testing predictors across Bayesian models}
bayesfactor_inclusion(models, match_models = FALSE, prior_odds = NULL, ...)

bf_inclusion(models, match_models = FALSE, prior_odds = NULL, ...)
\item{models}{An object of class \code{\link{bayesfactor_models}} or \code{BFBayesFactor}.}

\item{match_models}{See details.}

\item{prior_odds}{Optional vector of prior odds for the models. See \code{BayesFactor::priorOdds<-}.}

\item{...}{Arguments passed to or from other methods.}
a data frame containing the prior and posterior probabilities, and BF for each effect.
The \code{bf_*} function is an alias of the main function.
\cr \cr
For more info, see \href{}{the Bayes factors vignette}.
Inclusion Bayes factors answer the question: Are the observed data more
probable under models with a particular effect, than they are under models without
that particular effect? In other words, on average - are models with effect \eqn{X}
more likely to have produced the observed data than models without effect \eqn{X}?

\subsection{Match Models}{
If \code{match_models=FALSE} (default), Inclusion BFs are computed by comparing all models
with a predictor against all models without that predictor. If \code{TRUE},
comparison is restricted to models that (1) do not include any interactions
with the predictor of interest; (2) for interaction predictors, averaging is done
only across models that containe the main effect from which the interaction
predictor is comprised.
Random effects in the \code{lme} style will be displayed as interactions:
i.e., \code{(X|G)} will become \code{1:G} and \code{X:G}.

# Using bayesfactor_models:
# ------------------------------
mo0 <- lm(Sepal.Length ~ 1, data = iris)
mo1 <- lm(Sepal.Length ~ Species, data = iris)
mo2 <- lm(Sepal.Length ~ Species + Petal.Length, data = iris)
mo3 <- lm(Sepal.Length ~ Species * Petal.Length, data = iris)

BFmodels <- bayesfactor_models(mo1, mo2, mo3, denominator = mo0)
# BayesFactor
# -------------------------------

BF <- generalTestBF(len ~ supp * dose, ToothGrowth, progress = FALSE)


# compare only matched models:
bayesfactor_inclusion(BF, match_models = TRUE)
  \item Hinne, M., Gronau, Q. F., van den Bergh, D., and Wagenmakers, E. (2019, March 25). A conceptual introduction to Bayesian Model Averaging. \doi{10.31234/}
  \item Clyde, M. A., Ghosh, J., & Littman, M. L. (2011). Bayesian adaptive sampling for variable selection and model averaging. Journal of Computational and Graphical Statistics, 20(1), 80-101.
  \item Mathot, S. (2017). Bayes like a Baws: Interpreting Bayesian Repeated Measures in JASP [Blog post]. Retrieved from
\code{\link{weighted_posteriors}} for Bayesian parameter averaging.
Mattan S. Ben-Shachar
back to top