marginalLikelihood {CNPBayes} | R Documentation

## Compute the marginal likelihood of a converged model.

### Description

The recommended function for fitting mixture models and evaluating convergence is through the ‘gibbs' function. This function will return a list of models ordered by the marginal likelihood. The marginal likelihood is computed using the Chib’s estimator (JASA, Volume 90 (435), 1995).

### Usage

    marginalLikelihood(model, params = mlParams())

    ## S4 method for signature 'MultiBatchModel'
    marginalLikelihood(model,
      params = mlParams())

    ## S4 method for signature 'MultiBatchPooled'
    marginalLikelihood(model,
      params = mlParams())

    ## S4 method for signature 'list'
    marginalLikelihood(model, params = mlParams(warnings =
      FALSE))

### Arguments

`model` | An object of class `MarginalModel`, or a list of `MarginalModel`'s. Can also be an object of `BatchModel` or a list of such models.
`params` | A list containing parameters for marginalLikelihood computation. See `mlParams` for details.

### Value

A vector of the marginal likelihood of the model(s)

### See Also

See `mlParams` for parameters related to computing the log marginal likelihood via Chib's estimator. See `gibbs` for fitting multiple mixture models and returning a list sorted by the marginal likelihood. See `marginal_lik` for the accessor.

Note: currently thinning of the reduced MCMC chains is not allowed.

### Examples

    ## In practice, run a much longer burnin and increase the number of
    ## iterations to save after burnin
       mm <- SingleBatchModelExample
       mcmcParams(mm) <- McmcParams(iter=50, burnin=0, nStarts=0)
       mm <- posteriorSimulation(mm)
       marginalLikelihood(mm)

[Package CNPBayes version 1.12.0 Index]