Compute the Bayes factor comparing two brma models.
Usage
# S3 method for class 'brma'
bf(x1, x2, log = FALSE, ...)
# S3 method for class 'brma'
bayes_factor(x1, x2, log = FALSE, ...)Value
A list of class "bf_default" with components:
bf: (scalar) value of the Bayes factor in favor ofx1overx2.log: Boolean indicating whetherbfcorresponds to the log Bayes factor.
Details
Computes the Bayes factor in favor of the model x1 over the
model x2. The marginal likelihoods must first be computed using
add_marglik. Both models must be fitted to the same
outcome target/data, including outcome type and, when present, weights and
cluster identifiers.
Examples
if (FALSE) { # \dontrun{
if (requireNamespace("metadat", quietly = TRUE)) {
data(dat.lehmann2018, package = "metadat")
fit1 <- brma(yi = yi, vi = vi, data = dat.lehmann2018, measure = "SMD")
fit2 <- brma(
yi = yi,
vi = vi,
data = dat.lehmann2018,
measure = "SMD",
prior_effect = FALSE
)
fit1 <- add_marglik(fit1)
fit2 <- add_marglik(fit2)
bf(fit1, fit2)
}
} # }