draw.dirichlet {MultiRNG}R Documentation

Pseudo-Random Number Generation under Multivariate Beta (Dirichlet) Distribution

Description

This function implements pseudo-random number generation for a multivariate beta (Dirichlet) distribution with pdf

f(xα1,...,αd)=Γ(j=1dαj)j=1dΓ(αj)j=1dxjαj1f(x|\alpha_{1},...,\alpha_{d})=\frac{\Gamma(\sum_{j=1}^{d}\alpha_{j})}{\prod_{j=1}^{d}\Gamma(\alpha_{j})} \prod_{j=1}^{d}x_{j}^{\alpha_{j}-1}

for αj>0\alpha_{j}>0, xj0x_{j}\geq 0, and j=1dxj=1\sum_{j=1}^{d}x_{j}=1, where α1,...,αd\alpha_{1},...,\alpha_{d} are the shape parameters and β\beta is a common scale paramter.

Usage

draw.dirichlet(no.row,d,alpha,beta)

Arguments

no.row

Number of rows to generate.

d

Number of variables to generate.

alpha

Vector of shape parameters.

beta

Scale parameter common to dd variables.

Value

A no.row×dno.row \times d matrix of generated data.

Examples

alpha.vec=c(1,3,4,4)
mydata=draw.dirichlet(no.row=1e5,d=4,alpha=alpha.vec,beta=2)
apply(mydata,2,mean)-alpha.vec/sum(alpha.vec)

[Package MultiRNG version 1.2.4 Index]