jointly.generate.binary.normal {BinNor}R Documentation

Generates a mix of binary and normal data

Description

Generates multiple binary and normal variables simultaneously given marginal characteristics and association structures.

Usage

jointly.generate.binary.normal(no.rows, no.bin, 
			no.nor, prop.vec.bin = NULL, mean.vec.nor = NULL, var.nor = NULL, 
			sigma_star = NULL, corr.vec = NULL, corr.mat = NULL, 
			continue.with.warning = TRUE)

Arguments

no.rows

Number of rows.

no.bin

Number of binary variables

no.nor

Number of normal variables

prop.vec.bin

Probability vector for binary variables

mean.vec.nor

Vector of means for normal variables

var.nor

Vector of variances for normal variables

sigma_star

Intermediate correlation matrix

corr.vec

Vector of elements below the diagonal of correlation matrix ordered columnwise

corr.mat

Specified correlation matrix

continue.with.warning

TRUE to proceed with the nearest positive definite Σ^*. FALSE to terminate program execution if Σ^* is not positive definite

Value

data

A matrix of generated data.

See Also

compute.sigma.star, validation.corr, validation.bin, validation.nor, nearPD, simulation, rmvnorm

Examples


no.rows=100
no.bin=2; no.nor=2
mean.vec.nor=c(3,1); var.nor=c(4,2)
prop.vec.bin=c(0.4,0.7)
corr.vec=c(0.16,0.04,0.38,0.14,0.47,0.68);

cmat = lower.tri.to.corr.mat(corr.vec,4)
sigma.star=compute.sigma.star(no.bin=2, no.nor=2, prop.vec.bin=c(0.4,0.7),
								corr.mat=cmat)
mydata=jointly.generate.binary.normal(no.rows,no.bin,no.nor,prop.vec.bin,
				mean.vec.nor,var.nor, sigma_star=sigma.star$sigma_star, 
				continue.with.warning=TRUE)

[Package BinNor version 2.3.3 Index]