Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rbiNormGibbs

Illustrate Bivariate Normal Gibbs Sampler


Description

rbiNormGibbs implements a Gibbs Sampler for the bivariate normal distribution. Intermediate moves are plotted and the output is contrasted with the iid sampler. This function is designed for illustrative/teaching purposes.

Usage

rbiNormGibbs(initx=2, inity=-2, rho, burnin=100, R=500)

Arguments

initx

initial value of parameter on x axis (def: 2)

inity

initial value of parameter on y axis (def: -2)

rho

correlation for bivariate normals

burnin

burn-in number of draws (def: 100)

R

number of MCMC draws (def: 500)

Details

(θ_1, θ_2) ~ N( (0,0), Σ) with Σ = matrix(c(1,rho,rho,1),ncol=2)

Value

R x 2 matrix of draws

Author(s)

Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.

References

For further discussion, see Chapters 2 and 3, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.
http://www.perossi.org/home/bsm-1

Examples

## Not run: out=rbiNormGibbs(rho=0.95)

bayesm

Bayesian Inference for Marketing/Micro-Econometrics

v3.1-4
GPL (>= 2)
Authors
Peter Rossi <perossichi@gmail.com>
Initial release
2019-10-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.