gibbs_discrete function

Gibbs sampling of a bivariate discrete distribution

Gibbs sampling of a bivariate discrete distribution

Implements Gibbs sampling for an arbitrary bivariate discrete distribution

gibbs_discrete(p, i = 1, iter = 1000)

Arguments

  • p: matrix defining the probabiity distribution
  • i: starting row of the matrix
  • iter: number of cycles of algorithm

Returns

matrix of simulated draws from algorithm

Author(s)

Jim Albert

Examples

p <- matrix(c(4, 3, 2, 1, 3, 4, 3, 2, 2, 3, 4, 3, 1, 2, 3, 4) / 40, 4, 4, byrow = TRUE) out <- gibbs_discrete(p, 1, 100)