ISandIMH: Monte Carlo sampling using the iterated Laplace...

Importance Sampling and independence Metropolis Hastings samplingR Documentation

Monte Carlo sampling using the iterated Laplace approximation.

Description

Use iterated Laplace approximation as a proposal for importance sampling or the independence Metropolis Hastings algorithm.

Usage

IS(obj, nSim, df = 4, post, vectorized = FALSE, cores = 1, ...)

IMH(obj, nSim, df = 4, post, vectorized = FALSE, cores = 1, ...)

Arguments

obj

an object of class "mixDist"

nSim

number of simulations

df

degrees of freedom of the mixture of t distributions proposal

post

log-posterior density

vectorized

Logical determining, whether post is vectorized

cores

number of cores you want to use to evaluate the target density (uses the mclapply function from the parallel package). For Windows machines, a value > 1 will have no effect, see mclapply help for details.

...

additional arguments passed to post.

Value

A list with entries:
samp: Matrix containing sampled values
w: Vector of weights for values in samp
normconst: normalization constant estimated based on importance sampling
ESS: Effective sample size (for IS)
accept: Acceptance rate (for IMH)

Author(s)

Bjoern Bornkamp

Examples

  ## see function iterLap for an example on how to use IS and IMH

iterLap documentation built on Oct. 1, 2023, 1:06 a.m.