Learn R Programming

RepeatedHighDim (version 2.4.0)

rmvbinary_QA: Simulating correlated binary variables using the algorithm by Qaqish (2003)

Description

Generation of random sample of binary correlated variables

Usage

rmvbinary_QA(n, R, p)

Value

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

Arguments

n

Sample size

R

Correlation matrix

p

Vector of marginal probabilities

Author

Jochen Kruppa, Klaus Jung

Details

The function implements the algorithm proposed by Qaqish (2003) 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 starts by generating a data for the first variable X_1 and generates succesively the data for X_2, ... based on their conditional probabilities P(X_j|X_[i-1],...,X_1), j=1,...,d.

References

Qaqish, B. F. (2003) A family of multivariate binary distributions for simulating correlated binary variables with specified marginal means and correlations. Biometrika, 90(2), 455-463. tools:::Rd_expr_doi("10.1093/biomet/90.2.455")

See Also

For more information, please refer to the package's documentation and the tutorial: https://software.klausjung-lab.de/.

Examples

Run this code
## Generation of a random sample
rmvbinary_QA(n = 10, R = diag(2), p = c(0.5, 0.6))

Run the code above in your browser using DataLab