mml {RprobitB} | R Documentation |
Approximate marginal model likelihood
Description
This function approximates the model's marginal likelihood.
Usage
mml(x, S = 0, ncores = parallel::detectCores() - 1, recompute = FALSE)
Arguments
x |
An object of class |
S |
The number of prior samples for the prior arithmetic mean estimate. Per
default, |
ncores |
Computation of the prior arithmetic mean estimate is parallelized, set the number of cores. |
recompute |
Set to |
Details
The model's marginal likelihood p(y\mid M)
for a model M
and data
y
is required for the computation of Bayes factors. In general, the
term has no closed form and must be approximated numerically.
This function uses the posterior Gibbs samples to approximate the model's
marginal likelihood via the posterior harmonic mean estimator.
To check the convergence, call plot(x$mml)
, where x
is the output
of this function. If the estimation does not seem to have
converged, you can improve the approximation by combining the value
with the prior arithmetic mean estimator. The final approximation of the
model's marginal likelihood than is a weighted sum of the posterior harmonic
mean estimate and the prior arithmetic mean estimate,
where the weights are determined by the sample sizes.
Value
The object x
, including the object mml
, which is the model's
approximated marginal likelihood value.