Gibbs sampling of a bivariate discrete distribution
Implements Gibbs sampling for an arbitrary bivariate discrete distribution
gibbs_discrete(p, i = 1, iter = 1000)
p
: matrix defining the probabiity distributioni
: starting row of the matrixiter
: number of cycles of algorithmmatrix of simulated draws from algorithm
Jim Albert
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)