multivariate.metropolis.sample: Metropolis samplers

View source: R/metropolis.R

multivariate.metropolis.sampleR Documentation

Metropolis samplers

Description

Generate a sample from a probability distribution with the Metropolis algorithm.

Usage

multivariate.metropolis.sample(target.dist, x0, sample.size, tuning=1)
univar.metropolis.sample(target.dist, x0, sample.size, tuning=1)

Arguments

target.dist

Target distribution; see make.dist.

x0

Numeric vector containing initial state.

sample.size

Sample size requested.

tuning

Proposal standard deviation

Details

These two functions implement variants of the Metropolis algorithm for sampling a target distribution, following the interface used by compare.samplers. multivariate.metropolis.sample uses spherically symmetric Gaussian proposals with marginal standard deviation equal to the tuning parameter. univar.metropolis.sample updates each coordinate in sequence using univariate Gaussian proposals with standard deviation equal to the tuning parameter.

So that these two functions are roughly comparable, with a p-dimensional target distribution, multivariate.metropolis.sample performs p accept-reject steps each time between observations, so that both functions evaluate the log density a number of times roughly equal to p times the sample size. While there are often efficiency optimizations possible when only one coordinate is updated, univar.metropolis.sample does not support these; these two samplers are included for comparison rather than for practical use.

Value

A list with elements X, evals, and reject.rate. See compare.samplers for more information on X and evals. reject.rate is the fraction of proposals not accepted.

See Also

compare.samplers, adaptive.metropolis.sample


SamplerCompare documentation built on April 24, 2023, 9:09 a.m.