sim_covariates {psborrow2} | R Documentation |
Specify covariates for simulation study
Description
Provide details on the desired covariate distributions and covariance for for a simulation study.
Usage
sim_covariates(
covariates,
covariance_internal,
covariance_external = covariance_internal
)
Arguments
covariates |
list. Named list of covariate mean values or probabilities as
generated through |
covariance_internal |
matrix. Covariance matrix before binarization for internal patients. |
covariance_external |
matrix. Covariance matrix before binarization for external patients. Defaults to the internal covariance. |
Details
This function is intended to specify the number of covariates and
relationships between them for the purposes of designing a simulation
study in psborrow2
. Because the outcome model does not necessarily
need to adjust for covariates, this function is not necessary in
create_simulation_obj()
. The relationship between the treatment
and the outcome is specified elsewhere (i.e, in sim_survival()
or
sim_binary_event()
).
We need a few things to
Value
Object of class SimCovariates
See Also
Other simulation:
sim_samplesize()
Examples
set.seed(123)
covmat <- matrix(rWishart(1, 2, diag(2)), ncol = 2)
covset1 <- sim_covariates(
covariates = list(
cov1 = bin_var(0.5, 0.5),
cov2 = cont_var(100, 130)
),
covariance_internal = covmat
)