draw.correlated.binary {MultiRNG}R Documentation

Generation of Correlated Binary Data

Description

This function implements pseudo-random number generation for a multivariate Bernoulli distribution (correlated binary data).

Usage

draw.correlated.binary(no.row,d,prop.vec,corr.mat)

Arguments

no.row

Number of rows to generate.

d

Number of variables to generate.

prop.vec

Vector of means.

corr.mat

Correlation matrix.

Value

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

References

Park, C. G., Park, T., & Shin D. W. (1996). A simple method for generating correlated binary variates. The American Statistician, 50(4), 306-310.

See Also

loc.min

Examples

cmat<-matrix(c(1,0.2,0.3,0.2,1,0.2,0.3,0.2,1), nrow=3, ncol=3)
propvec=c(0.3,0.5,0.7)

mydata=draw.correlated.binary(no.row=1e5,d=3,prop.vec=propvec,corr.mat=cmat)
apply(mydata,2,mean)-propvec
cor(mydata)-cmat


[Package MultiRNG version 1.2.4 Index]