Learn R Programming

RepeatedHighDim (version 2.3.0)

start_matrix: Setup of the start matrix

Description

Generation of the start matrix with n rows and specified marginal probabilities p.

Usage

start_matrix(p, k)

Value

A (k x p)-Matrix with with entries 0 and 1 according to the specified marginal probabilities p.

Arguments

p

Marginal probabilities of the start matrix.

k

Number of rows to be generated.

Author

Jochen Kruppa, Klaus Jung

Details

The start matrix needs to be setup for further use in the genetic algorithm implemented in the function iter_matrix. For high-dimensional cases or if the marginal probabilities have multiple decimal places, the number k of rows should be large (up to multiple thousand).

References

Kruppa, J., Lepenies, B., & Jung, K. (2018). A genetic algorithm for simulating correlated binary data from biomedical research. Computers in biology and medicine, 92, 1-8. tools:::Rd_expr_doi("10.1016/j.compbiomed.2017.10.023")

See Also

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

Examples

Run this code
X0 <- start_matrix(p = c(0.5, 0.6), k = 10000)

## check if p can be restored
apply(X0, 2, mean)

Run the code above in your browser using DataLab