% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/marglik.R
\name{add_marglik.brma}
\alias{add_marglik.brma}
\alias{add_marglik}
\title{Add Marginal Likelihood to brma Objects}
\usage{
\method{add_marglik}{brma}(object, ...)
}
\arguments{
\item{object}{a brma model object.}

\item{...}{additional arguments (currently not used).}
}
\value{
The brma object with the marginal likelihood result stored in
\code{object[["marglik"]]}.
}
\description{
Compute the marginal likelihood of a brma model using
bridge sampling and store the result in the object.
}
\details{
The marginal likelihood is computed using the \code{bridgesampling} package
via the \code{BayesTools::JAGS_bridgesampling} wrapper. The result is stored
in the object and can be extracted using \code{\link{bridge_sampler.brma}}.

Product-space model-averaging objects (\code{BMA.norm}, \code{BMA.glmm},
and \code{RoBMA}) do not expose a bridge-sampling marginal likelihood;
use predictive comparison methods such as \code{\link{loo.brma}} instead.
}
\examples{
\dontrun{
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)
}
}

}
\seealso{
\code{\link{bridge_sampler.brma}}, \code{\link{logml.brma}},
\code{\link{bf.brma}}, \code{\link{post_prob.brma}}
}
