dirch_from_counts function

Given a vector of counts for different categories in 1...n and a prior, simulate a Dirichlet random vector

Given a vector of counts for different categories in 1...n and a prior, simulate a Dirichlet random vector

Takes a vector of counts for 1:n collections, and returns a Dirichlet random variable generated by adding the prior to each collection value, and simulating an alpha from a gamma distribution with this shape parameter.

dirch_from_counts(C, lambda)

Arguments

  • C: a vector giving counts of categories
  • lambda: priors for the categories

Details

The categories are labeled in C from 1 up to n. n is the length of lambda, which is a vector of priors. Note that all elements of lambda

must be strictly greater than 0.

  • Maintainer: Eric C. Anderson
  • License: CC0
  • Last published: 2024-01-24

Useful links