Learn R Programming

iterLap (version 1.1-4)

Importance Sampling and independence Metropolis Hastings sampling: 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, ...)

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)

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.

Author

Bjoern Bornkamp

Examples

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

Run the code above in your browser using DataLab