draw.multivariate.hypergeometric {MultiRNG}R Documentation

Pseudo-Random Number Generation under Multivariate Hypergeometric Distribution

Description

This function implements pseudo-random number generation for a multivariate hypergeometric distribution.

Usage

draw.multivariate.hypergeometric(no.row,d,mean.vec,k)

Arguments

no.row

Number of rows to generate.

d

Number of variables to generate.

mean.vec

Number of items in each category.

k

Number of items to be sampled. Must be a positive integer.

Value

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

References

Demirtas, H. (2004). Pseudo-random number generation in R for commonly used multivariate distributions. Journal of Modern Applied Statistical Methods, 3(2), 485-497.

Examples

meanvec=c(10,10,12) ; myk=5
mydata=draw.multivariate.hypergeometric(no.row=1e5,d=3,mean.vec=meanvec,k=myk)
apply(mydata,2,mean)-myk*meanvec/sum(meanvec)

[Package MultiRNG version 1.2.4 Index]