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

(count)
number of rows (observations).

p_catvar

(count)
number of covariates (excluding treatment arm).

add_contvars

(flag)
whether to add continuous covariates.

arm_factor

(flag)
whether to make the arm variable a factor.

Details

The following pattern is repeated for the covariate blocks:

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)

[Package bonsaiforest version 0.1.0 Index]