Description Usage Arguments Details Value See Also Examples
View source: R/generate.binary.R
Generates multivariate binary data given marginal probabilities and correlation based on the algorithm described in Emrich and Piedmonte (1991).
1 | generate.binary(nObs, prop.vec.bin, corr.mat)
|
nObs |
Number of observations |
prop.vec.bin |
Vector of binary marginal probabilities |
corr.mat |
correlation matrix of the binary data |
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.
data |
Matrix of multivariate binary data |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.