gibbs_discrete: Gibbs sampling of a bivariate discrete distribution

Description Usage Arguments Value Author(s) Examples

View source: R/gibbs_discrete.R

Description

Implements Gibbs sampling for an arbitrary bivariate discrete distribution

Usage

1
  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

Value

matrix of simulated draws from algorithm

Author(s)

Jim Albert

Examples

1
2
3
4
5
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)

Example output

Loading required package: LearnBayes
Loading required package: ggplot2
Loading required package: gridExtra
Loading required package: shiny

ProbBayes documentation built on March 13, 2020, 1:31 a.m.