View source: R/model_selection.R
mml | R Documentation |
This function approximates the model's marginal likelihood.
mml(x, S = 0, ncores = parallel::detectCores() - 1, recompute = FALSE)
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 |
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.
The object x
, including the object mml
, which is the model's
approximated marginal likelihood value.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.