gibbs_sampler: Gibbs sampler for DS convex polytopes

Description Usage Arguments Value Examples

View source: R/gibbs_sampler.R

Description

This is the main function of the package. It runs the proposed Gibbs sampler for a desired number of iterations, for a given vector of counts. It generates a convex polytope at each iteration, in the form of a matrix "eta". Below the number of categories is denoted by K, and corresponds to the length of the input vector 'counts'. Each category k has count N_k, possibly equal to zero. The zeros are removed from the counts when performing the Gibbs iterations, and "added back" using extend_us.

Usage

1
gibbs_sampler(niterations, counts)

Arguments

niterations

a number of iterations to perform; each iteration is a full sweep of Gibbs updates for each category. For help on choosing the number of iterations to perform, see the function meeting_times.

counts

a vector of non-negative integers containing the count data; its length defines K, the number of categories. It can include zeros.

Value

A list with the following entries:

Examples

1
2
3
4
5
## Not run: 
gibbs_results <- gibbs_sampler(niterations = 5, counts = c(1,2,0,3))
gibbs_results$etas[5,,]

## End(Not run)

pierrejacob/montecarlodsm documentation built on June 16, 2021, 1:06 p.m.