genOrdNor function

Generates a data set with ordinal and normal variables

Generates a data set with ordinal and normal variables

The function simulates a data set with ordinal and normal components with a pre-specified correlation matrix and marginals.

genOrdNor(n, plist, cmat.star, mean.vec, sd.vec, no.ord, no.norm)

Arguments

  • n: Number of rows
  • plist: A list of probability vectors corresponding to each ordinal variable. The i-th element of plist is a vector of the cumulative probabilities defining the marginal distribution of the i-th ordinal component of the multivariate variables. If the i-th ordinal variable has k categories, the i-th vector of the plist will contain k-1 probability values. The k-th element is implicitly 1.
  • cmat.star: The intermediate correlation matrix obtained from cmat.star function.
  • 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.

References

Demirtas, H., Yavuz, Y. (2015). Concurrent generation of ordinal and normal data. Journal of Biopharmaceutical Statistics; 25(4) , 635-650.

Returns

A matrix of size n×(no.ord+no.norm)n \times (no.ord + no.norm), of which first no.ord are ordinal variables.

See Also

cmat.star, validate.target.cormat, validate.plist

Examples

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)
  • Maintainer: Ran Gao
  • License: GPL
  • Last published: 2021-03-05

Useful links