marginalLikelihood-method: Compute the marginal likelihood of a converged model.

Description Usage Arguments Value See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
marginalLikelihood(model, params = mlParams())

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

## S4 method for signature 'SingleBatchPooled'
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

1
2
3
4
5
6
## 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)

CNPBayes documentation built on May 2, 2018, 3:57 a.m.