Learn R Programming

bayestestR (version 0.2.2)

bayesfactor_inclusion: Inclusion Bayes Factors for testing effects across Bayesian models

Description

Inclusion Bayes Factors for testing effects across Bayesian models

Usage

bayesfactor_inclusion(models, match_models = FALSE, prior_odds = NULL,
  ...)

Arguments

models

An object of class bayesfactor_models or BFBayesFactor.

match_models

If FALSE (default), Inclusion BFs are computed by comparing all models with an effect against all models without the effect. If 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 (additionally, interactions are compared only to models with the all main effects).

prior_odds

Optional vector of prior odds for the models. See priorOdds<-.

...

Arguments passed to or from other methods.

Value

a data frame containing the prior and posterior probabilities, and BF for each effect.

Details

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 \(X\) more likely to have produced the observed data than models without effect \(X\)?

See also the Bayes factors vignette.

References

  • Hinne, M., Gronau, Q. F., van den Bergh, D., and Wagenmakers, E. (2019, March 25). A conceptual introduction to Bayesian Model Averaging. 10.31234/osf.io/wgb64

  • 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.

  • 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

Examples

Run this code
# NOT RUN {
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)
# }
# NOT RUN {
# BayesFactor
# -------------------------------
library(BayesFactor)

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

bayesfactor_inclusion(BF)

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

Run the code above in your browser using DataLab