Learn R Programming

MCCM (version 0.1.0)

gen_mixed: Continuous and Ordinal Simulated Data

Description

Generate multi-normal sample and segment it into ordinal.

Usage

gen_mixed(n, R, indc, thresholds)

Value

latent

the original normal data.

observed

the observed ordinal data.

Arguments

n

the sample size.

R

the correlation coefficient matrix.

indc

vector to indicate whether variables are continuous or categorical.

thresholds

list contains thresholds for ordinal variables

Examples

Run this code
library(mvtnorm)
set.seed(1997)
R1 = gen_CCM(6)
n = 1000
indc = 4:6
thresholds = list(
  c(),
  c(),
  c(),
  c(0),
  c(-0.5,0),
  c(0,0.5)
)
data1 = gen_mixed(n,R1,indc,thresholds)$observed
data1 = data.frame(data1)
table(data1$X4,data1$X5)
table(data1$X5,data1$X6)

Run the code above in your browser using DataLab