cBern: Main function

Description Usage Arguments Value References See Also Examples

View source: R/cBern.R

Description

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

Usage

1
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 correlation structures. Submitted.

See Also

cBernEx, cBernDCP, cBern1dep

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

CorBin documentation built on Oct. 30, 2019, 9:46 a.m.

Related to cBern in CorBin...