marginal.lkl {BMAmevt}R Documentation

Marginal model likelihood

Description

Estimates the marginal likelihood of a model, proceeding by simple Monte-Carlo integration under the prior distribution.

Usage

marginal.lkl(
  dat,
  likelihood,
  prior,
  Nsim = 300,
  displ = TRUE,
  Hpar,
  Nsim.min = Nsim,
  precision = 0,
  show.progress = floor(seq(1, Nsim, length.out = 20))
)

Arguments

dat

The angular data set relative to which the marginal model likelihood is to be computed

likelihood

The likelihood function of the model. See posteriorMCMC for the required format.

prior

The prior distribution: of type
function(type=c("r","d"), n ,par, Hpar, log, dimData ), where dimData is the dimension of the sample space (e.g., for the two-dimensional simplex (triangle), dimData=3. Should return either a matrix with n rows containing a random parameter sample generated under the prior (if type == "d"), or the density of the parameter par (the logarithm of the density if log==TRUE. See prior.pb and prior.nl for templates.

Nsim

Total number of iterations to perform.

displ

logical. If TRUE, a plot is produced, showing the temporal evolution of the cumulative mean, with approximate confidence intervals of +/-2 estimated standard errors.

Hpar

A list containing Hyper-parameters to be passed to prior.

Nsim.min

The minimum number of iterations to be performed.

precision

the desired relative precision. See MCpriorIntFun.

show.progress

An vector of integers containing the times (iteration numbers) at which a message showing progression will be printed on the standard output.

Details

The function is a wrapper calling MCpriorIntFun with parameter FUN set to likelihood.

Value

The list returned by MCpriorIntFun. The estimate is the list's element named emp.mean.

Note

The estimated standard deviations of the estimates produced by this function should be handled with care:For "larger" models than the Pairwise Beta or the NL models, the likelihood may have infinite second moment under the prior distribution. In such a case, it is recommended to resort to more sophisticated integration methods, e.g. by sampling from a mixture of the prior and the posterior distributions. See the reference below for more details.

References

KASS, R. and RAFTERY, A. (1995). Bayes factors. Journal of the american statistical association , 773-795.

See Also

marginal.lkl.pb, marginal.lkl.nl for direct use with the implemented models.

Examples

## Not run: 
  lklNL=  marginal.lkl(dat=Leeds,
                 likelihood=dnestlog,
                 prior=prior.nl,
                 Nsim=20e+3,
                 displ=TRUE,
                 Hpar=nl.Hpar,
                )

## End(Not run)


[Package BMAmevt version 1.0.5 Index]