rpdirichlet: Random Samples from the Product-Dirichlet Distribution

View source: R/RcppExports.R

rpdirichletR Documentation

Random Samples from the Product-Dirichlet Distribution

Description

Random samples from the prior/posterior (i.e., product-Dirichlet) of the unconstrained product-multinomial model (the encompassing model).

Usage

rpdirichlet(n, alpha, options, drop_fixed = TRUE)

Arguments

n

number of samples

alpha

Dirichlet parameters concatenated across independent conditions (e.g., a1,a2, b1,b2,b3)

options

the number of choice options per item type, e.g., c(2,3) for a binary and ternary condition. The sum of options must be equal to the length of alpha.

drop_fixed

whether the output matrix includes the last probability for each category (which is not a free parameter since probabilities must sum to one).

Examples

# standard uniform Dirichlet
rpdirichlet(5, c(1,1,1,1), 4)
rpdirichlet(5, c(1,1,1,1), 4, drop_fixed = FALSE)

# two ternary outcomes: (a1,a2,a3,  b1,b2,b3)
rpdirichlet(5, c(9,5,1,  3,6,6), c(3,3))
rpdirichlet(5, c(9,5,1,  3,6,6), c(3,3), drop_fixed = FALSE)

multinomineq documentation built on Nov. 22, 2022, 5:09 p.m.