generate.binary {MultiOrd}R Documentation

Generates multivariate binary data given marginal probabilities and correlation.

Description

Generates multivariate binary data given marginal probabilities and correlation based on the algorithm described in Emrich and Piedmonte (1991).

Usage

generate.binary(nObs, prop.vec.bin, corr.mat)

Arguments

nObs

Number of observations

prop.vec.bin

Vector of binary marginal probabilities

corr.mat

correlation matrix of the binary data

Details

It generates multivariate binary data from the marginal probabilities and correlation matrix. It uses the algorithm described in Emrich and Piedmonte (1991). In the process, if the tetrachoric correlation matrix is non-positive definite, a nearest positive definite matrix is used.

Value

data

Matrix of multivariate binary data

See Also

nearPD, compute.sigma.star

Examples

## Not run: ordPmat1 = matrix( c(0.15,0.70,0.40,
					0.55,0.10,0.25,
					0.25,0.10,0.15,
					0.05,0.10,0.20),4,3,byrow=TRUE)
## End(Not run)
## Not run: cmat1= matrix( 	c(1,0.2,0.2,
				0.2,1,0.2,
				0.2,0.2,1),3,3,byrow=TRUE)
## End(Not run)
## Not run: p=find.binary.prob(ordPmat1) 
## Not run: finalCorr = simBinCorr(ordPmat1, cmat1, no.rows=100000)
## Not run: y=generate.binary( 1000, p$p, finalCorr$del.next)

[Package MultiOrd version 2.4.3 Index]