draw.dirichlet: Pseudo-Random Number Generation under Multivariate Beta...

Description Usage Arguments Value Examples

View source: R/draw.dirichlet.R

Description

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

f(x|α_{1},...,α_{d})=\frac{Γ(∑_{j=1}^{d}α_{j})}{∏_{j=1}^{d}Γ(α_{j})} ∏_{j=1}^{d}x_{j}^{α_{j}-1}

for α_{j}>0, x_{j}≥q 0, and ∑_{j=1}^{d}x_{j}=1, where α_{1},...,α_{d} are the shape parameters and β is a common scale paramter.

Usage

1
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 d variables.

Value

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

Examples

1
2
3
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)

Example output

[1] -1.852098e-04  9.293519e-05 -1.725680e-04  2.648426e-04

MultiRNG documentation built on March 6, 2021, 1:06 a.m.