Description Usage Arguments Value Note Examples
This function compte the Bayes factors (BFs) that are appropriate to the
input. For vectors or single models, it will compute BFs for single parameters()
, or is hypothesis
is specified,
BFs for restricted models()
. For multiple models,
it will return the BF corresponding to comparison between models()
and if a model comparison is passed, it will
compute the inclusion BF()
.
For a complete overview of these functions, read the Bayes factor vignette.
1 2 3 4 5 6 7 8 9 10 11 12 
... 
A numeric vector, model object(s), or the output from

prior 
An object representing a prior distribution (see 'Details'). 
direction 
Test type (see 'Details'). One of 
null 
Value of the null, either a scalar (for pointnull) or a range (for a intervalnull). 
hypothesis 
A character vector specifying the restrictions as logical conditions (see examples below). 
effects 
Should results for fixed effects, random effects or both be returned? Only applies to mixed models. May be abbreviated. 
verbose 
Toggle off warnings. 
denominator 
Either an integer indicating which of the models to use as
the denominator, or a model to be used as a denominator. Ignored for

match_models 
See details. 
prior_odds 
Optional vector of prior odds for the models. See

Some type of Bayes factor, depending on the input. See bayesfactor_parameters()
, bayesfactor_models()
or bayesfactor_inclusion()
There is also a plot()
method implemented in the seepackage.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  library(bayestestR)
if (require("logspline")) {
prior < distribution_normal(1000, mean = 0, sd = 1)
posterior < distribution_normal(1000, mean = .5, sd = .3)
bayesfactor(posterior, prior = prior)
}
## Not run:
# rstanarm models
# 
if (require("rstanarm")) {
model < stan_lmer(extra ~ group + (1  ID), data = sleep)
bayesfactor(model)
}
## End(Not run)
if (require("logspline")) {
# Frequentist models
# 
m0 < lm(extra ~ 1, data = sleep)
m1 < lm(extra ~ group, data = sleep)
m2 < lm(extra ~ group + ID, data = sleep)
comparison < bayesfactor(m0, m1, m2)
comparison
bayesfactor(comparison)
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.