add_marglik.brma: Add Marginal Likelihood to brma Objects

View source: R/marglik.R

add_marglik.brmaR Documentation

Add Marginal Likelihood to brma Objects

Description

Compute the marginal likelihood of a brma model using bridge sampling and store the result in the object.

Usage

## S3 method for class 'brma'
add_marglik(object, ...)

Arguments

object

a brma model object.

...

additional arguments (currently not used).

Details

The marginal likelihood is computed using the bridgesampling package via the BayesTools::JAGS_bridgesampling wrapper. The result is stored in the object and can be extracted using bridge_sampler.brma.

Product-space model-averaging objects (BMA.norm, BMA.glmm, and RoBMA) do not expose a bridge-sampling marginal likelihood; use predictive comparison methods such as loo.brma instead.

Value

The brma object with the marginal likelihood result stored in object[["marglik"]].

See Also

bridge_sampler.brma, logml.brma, bf.brma, post_prob.brma

Examples

## Not run: 
if (requireNamespace("metadat", quietly = TRUE)) {
  data(dat.lehmann2018, package = "metadat")
  fit <- brma(yi = yi, vi = vi, data = dat.lehmann2018, measure = "SMD")

  fit <- add_marglik(fit)

  bridge <- bridge_sampler(fit)
  print(bridge)

  logml(fit)
}

## End(Not run)


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