Learn R Programming

BMAmevt (version 1.0.5)

marginal.lkl: 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))
)

Value

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

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.

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

Run this code
if (FALSE) {
  lklNL=  marginal.lkl(dat=Leeds,
                 likelihood=dnestlog,
                 prior=prior.nl,
                 Nsim=20e+3,
                 displ=TRUE,
                 Hpar=nl.Hpar,
                )
}

Run the code above in your browser using DataLab