generate.binary: Generates multivariate binary data given marginal...

Description Usage Arguments Details Value See Also Examples

View source: R/generate.binary.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

MultiOrd documentation built on March 6, 2021, 1:08 a.m.