bf.brma: Bayes Factor for brma Objects

View source: R/bridgesampling.R

bf.brmaR Documentation

Bayes Factor for brma Objects

Description

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, ...)

Arguments

x1

a brma model object (numerator).

x2

a brma model object (denominator).

log

logical; if TRUE, the log Bayes factor is returned. Default is FALSE.

...

additional arguments (currently not used).

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.

Value

A list of class "bf_default" with components:

  • bf: (scalar) value of the Bayes factor in favor of x1 over x2.

  • log: Boolean indicating whether bf corresponds to the log Bayes factor.

See Also

add_marglik, bridge_sampler.brma, post_prob.brma, logml.brma

Examples

## Not run: 
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)
}

## End(Not run)


RoBMA documentation built on May 7, 2026, 5:08 p.m.