Importance Sampling and independence Metropolis Hastings sampling {iterLap} | R 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 |
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 |
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