Description Usage Arguments Value References See Also Examples
The function simulates a data set with ordinal and normal components with a pre-specified correlation matrix and marginals.
1 |
n |
Number of rows |
plist |
A list of probability vectors corresponding to each ordinal variable. The i-th element of |
cmat.star |
The intermediate correlation matrix obtained from |
mean.vec |
A vector of means for the normal variables. |
sd.vec |
A vector of standard deviations for the normal variables. |
no.ord |
Number of ordinal variables. |
no.norm |
Number of normal variables. |
A matrix of size n \times (no.ord + no.norm), of which first no.ord
are ordinal variables.
Demirtas, H., Yavuz, Y. (2015). Concurrent generation of ordinal and normal data. Journal of Biopharmaceutical Statistics; 25(4), 635-650.
cmat.star
, validate.target.cormat
, validate.plist
1 2 3 4 5 6 7 8 9 10 11 | Sigma = diag(4)
Sigma[lower.tri(Sigma)] = c(0.42, 0.78, 0.29, 0.37, 0.14, 0.26)
Sigma = Sigma + t(Sigma)
diag(Sigma)=1
marginal = list( c(0.2, 0.5), c(0.4, 0.7, 0.9))
cmat= cmat.star(marginal, Sigma, 2, 2)
mean.vec = c(2,4)
sd.vec = c(0.5, 1.5)
Y=genOrdNor(10000,marginal, cmat, mean.vec, sd.vec, 2, 2)
cor(Y)
|
Loading required package: mvtnorm
Loading required package: corpcor
Loading required package: Matrix
Loading required package: GenOrd
Loading required package: MASS
[,1] [,2] [,3] [,4]
[1,] 1.0000000 0.4234109 0.7800659 0.2813916
[2,] 0.4234109 1.0000000 0.3796650 0.1365731
[3,] 0.7800659 0.3796650 1.0000000 0.2497522
[4,] 0.2813916 0.1365731 0.2497522 1.0000000
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.