Raw File
bayesfactor_inclusion.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayesfactor_inclusion.R
\name{bayesfactor_inclusion}
\alias{bayesfactor_inclusion}
\title{Inclusion Bayes Factors for effects across Bayesian models}
\usage{
bayesfactor_inclusion(models, match_models = FALSE, prior_odds = NULL,
  ...)
}
\arguments{
\item{models}{an object of class \link{bayesfactor_models} or \code{BFBayesFactor}.}

\item{match_models}{If \code{FALSE} (default), Inclustion BFs are computed by
comparing all models with an effect against all models without the effect. If \code{TRUE},
Inclusion BFs are computed by comparing all models with an effect against models without
the effect AND without any higher-order interactions with the effect.}

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

\item{...}{Arguments passed to or from other methods.}
}
\value{
a data frame containing the prior and posterior probabilities, and BF for each effect.
}
\description{
Inclusion Bayes Factors for effects across Bayesian models
}
\details{
Inclusion Bayes factors answer the question: Given the observed data,
how much more likely are models with a particular effect, compared to models
without that particular effect? In other words, on average - do models with
effect X better fit (or describe) the data compared to models without effect X? See also
\href{https://easystats.github.io/bayestestR/articles/bayes_factors.html}{this vignette}.
}
\note{
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}.
}
\examples{
library(bayestestR)

# 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_inclusion(BFmodels)

# BayesFactor
# -------------------------------
library(BayesFactor)

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

bayesfactor_inclusion(BF)

# compare only matched models:
bayesfactor_inclusion(BF, match_models = TRUE)

}
\references{
\itemize{
  \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/osf.io/wgb64}
  \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 https://www.cogsci.nl/blog/interpreting-bayesian-repeated-measures-in-jasp
}
}
\author{
Mattan S. Ben-Shachar
}
back to top