bin_var {psborrow2}R Documentation

Create binary covariate

Description

Create an object of class SimVarBin to hold proportions of binary variables specified in a simulation study.

Usage

bin_var(
  prob_internal,
  prob_external,
  mu_internal_before_bin = 0,
  mu_external_before_bin = 0
)

Arguments

prob_internal

numeric. Proportion for the internal arms.

prob_external

numeric. Proportion for the external arm.

mu_internal_before_bin

numeric. Mean value of the covariate before binarization for the internal arms. The default is 0. See details for more information.

mu_external_before_bin

numeric. Mean value of the covariate before binarization for the external arm. The default is 0. See details for more information.

Details

This function contains information necessary to create binary covariates as part of a simulation study. The binary covariates are created by binarizing multivariate normal distributions to achieve the probabilities specified in prob_internal and prob_external. The user may choose to change the default mean value of each variable prior to binarization by specifying mu_internal_before_bin or mu_external_before_bin to ensure the correct scales are used in the covariance matrix, though the ultimate proportions will depend on prob_internal and prob_external. The default values for mu_internal_before_bin and mu_external_before_bin are 0, and it is not recommended to change these without good reason.

Value

Object of class SimVarBin.

See Also

Other simvar: cont_var()

Examples

cv1 <- bin_var(0.50, 0.80)
cv2 <- bin_var(.95, .92)

[Package psborrow2 version 0.0.3.4 Index]