Gibbs sampling of the beta-binomial distribution
Implements Gibbs sampling of the beta-binomial distribution
gibbs_betabin(n, a, b, p = 0.5, iter = 1000)
n
: binomial sample sizea
: first beta shape parameterb
: second beta shape parameterp
: starting value of proportion in algorithmiter
: number of iterationsmatrix of simulated draws from the algorithm
Jim Albert
sp <- gibbs_betabin(20, 5, 5, 100)