rmvbinary_EP: Simulating correlated binary variables using the algorithm by...

View source: R/rmvbinary_EP.R

rmvbinary_EPR Documentation

Simulating correlated binary variables using the algorithm by Emrich and Piedmonte (1991)

Description

Generation of random sample of binary correlated variables

Usage

rmvbinary_EP(n, R, p)

Arguments

n

Sample size

R

Correlation matrix

p

Vector of marginal probabilities

Details

The function implements the algorithm proposed by Emrich and Piedmonte (1991) to generate a random sample of d (=length(p)) correlated binary variables. The sample is generated based on given marginal probabilities p of the d variables and their correlation matrix R. The algorithm generates first determines an appropriate correlation matrix R' for the multivariate normal distribution. Next, a sample is drawn from N_d(0, R') and each variable is finnaly dichotomized with respect to p.

Value

Sample (n x p)-matrix with representing a random sample of size n from the specified multivariate binary distribution.

Author(s)

Jochen Kruppa, Klaus Jung

References

Emrich, L.J., Piedmonte, M.R. (1991) A method for generating highdimensional multivariate binary variates. The American Statistician, 45(4), 302. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00031305.1991.10475828")}

Examples

## Generation of a random sample
rmvbinary_EP(n = 10, R = diag(2), p = c(0.5, 0.6))

RepeatedHighDim documentation built on July 9, 2023, 6:33 p.m.