simul_covariates {bonsaiforest} | R Documentation |
Generation of a Design Matrix for Simulations
Description
This function uses a block diagonal covariance matrix for the underlying multivariate normal data to create the design matrix in blocks of 10, see the details.
Usage
simul_covariates(n, p_catvar = 10, add_contvars = FALSE, arm_factor = FALSE)
Arguments
n |
( |
p_catvar |
( |
add_contvars |
( |
arm_factor |
( |
Details
The following pattern is repeated for the covariate blocks:
The first 5 covariates are uncorrelated with everything.
The covariates 6 to 8 have "moderate" correlation (0.25) between each other.
The covariates 9 and 10 have "high" correlation (0.5).
By default, only the resulting categorical covariates obtained by thresholding are included. Optionally also the original continuous covariates are included in the returned design matrix.
Value
The design matrix.
Examples
simul_covariates(n = 10, p_catvar = 3, add_contvars = FALSE)
simul_covariates(n = 10, p_catvar = 3, add_contvars = TRUE)
simul_covariates(n = 10, p_catvar = 3, add_contvars = TRUE, arm_factor = TRUE)