cBern {CorBin}R Documentation

Main function

Description

The main function of our package, through which we can simulate correlated binary data under different settings.

Usage

cBern(n, p, rho, type, k = NULL)

Arguments

n

number of observations

p

the vector of marginal probabilities with dimension m

rho

For the first three types, rho is either a non-negative value indecating the shared correlation coefficient or and m-1 vector indicating the correlation coefficients between adjacent variables. For the general case, rho should be a list, the i-th element of which specifies the coefficients on the i-th minor diagnal.

type

including 4 types.

type="exchange"

type="DCP"

type="1-dependent"

type="General"

k

(for 'General' use only). The number of layers setting for k-dependent structure. k=m-1 for the general case.

Value

an n*p matrix of binary data

References

Jiang, W., Song, S., Hou, L. and Zhao, H. A set of efficient methods to generate high-dimensional binary data with specified correlation structures. The American Statistician. DOI:10.1080/00031305.2020.1816213

See Also

cBernEx, cBernDCP, cBern1dep

Examples

X <- cBern(10, rep(0.5,3), 0.5, type="exchange")

X <- cBern(10, rep(0.5,3), c(0.2,0.2), type="DCP")

X <- cBern(5, c(0.4,0.5,0.6), c(0.2,0.3), type="1-dependent")

rho <- list()
rho[[1]] <- c(0.2,0.3)
rho[[2]] <- 0.1
X <- cBern(2, c(0.7,0.8,0.9),rho=rho,type="General", k=2)

[Package CorBin version 1.0.0 Index]