Learn R Programming

asbio (version 1.9-2)

anm.mc.bvn: Animation of Markov Chain Monte Carlo walks in bivariate normal space

Description

The algorithm can use three different variants on MCMC random walks: Gibbs sampling, the Metropolis algorithm, and the Metropolis-Hastings algorithms to move through univariate anm.mc.norm and bivariate normal probability space. The jumping distribution is also bivariate normal with a mean vector at the current bivariate coordinates. The jumping kernel modifies the jumping distribution through multiplying the variance covariance of this distribution by the specified constant.

Usage

anm.mc.bvn(start = c(-4, -4), mu = c(0, 0), sigma = matrix(2, 2, data = c(1, 0,
 0, 1)), length = 1000, sim = "M", jump.kernel = 0.2, xlim = c(-4, 4),
 ylim = c(-4, 4), interval = 0.01, show.leg = TRUE, cex.leg = 1, ...)

anm.mc.norm(start = -4, mu = 0, sigma = 1, length = 2000, sim = "M", jump.kernel = 0.2, xlim = c(-4, 4), ylim = c(0, 0.4), interval = 0.01, show.leg = TRUE,...)

anm.mc.bvn.tck()

Value

The function returns two plots. These are: 1) the proposal bivariate normal distribution in which darker shading indicates higher density, and 2) an animated plot showing the MCMC algorithm walking through the probability space.

Arguments

start

A two element vector specifying the bivariate starting coordinates.

mu

A two element vector specifying the mean vector for the proposal distribution.

sigma

A 2 x 2 matrix specifying the variance covariance matrix for the proposal distribution.

length

The length of the MCMC chain.

sim

Simulation method used. Must be one of "G" indicating Gibbs sampling, "M" indicating the Metropolis algorithm, or "MH" indicating the Metropolis-Hastings algorithm (Gibbs sampling is not implemented for anm.mc.norm).

jump.kernel

A number > 0 that will serve as a (squared) multiplier for the proposal variance covariance. The result of this multiplication will be used as the variance covariance matrix for the jumping distribution.

xlim

A two element vector describing the upper and lower limits of the x-axis.

ylim

A two element vector describing the upper and lower limits of the y-axis.

interval

Animation interval

show.leg

Logical. Indicating whether or not the chain length should be shown.

cex.leg

Character expansion for legend.

...

Additional arguments from plot.

Author

Ken Aho

References

Gelman, A., Carlin, J. B., Stern, H. S., and D. B. Rubin (2003) Bayesian Data Analysis, 2nd edition. Chapman and Hall/CRC.