Create data containing the treatment variable and all other covariates. This
data is required to build the design (i.e., x
) matrix in either a propensity
score model or a covariate adjusted outcomes model. Only variables required
by the model are kept.
make_xdata( formula, data, imputation = c("multi", "none"), missing_dummy = FALSE, id = "patient_id", n_impute = 5 )
formula | A formula for the propensity score with the treatment variable
to the left of the |
---|---|
data | The dataset containing the variables specified in |
imputation | Imputation strategy to use. Use |
missing_dummy | Whether to create dummy variables for variables when observations are missing. |
id | The variable uniquely identifying each patient. |
n_impute | Number of imnputations to perform. Only used when
|
An object of class model_data
inheriting from dplyr::tibble
.
It contains all variables used in formula
and, if multiple imputation
is used, an additional column named imp
indicating the imputation
number.