Subset Model Results for Binary and Categorical Exposures
Source:R/margot_subset_model.R
margot_subset_model.Rd
This function extracts and combines evaluation tables for specified outcome variables from model results, handling both binary and categorical exposure models.
Usage
margot_subset_model(
model_results,
outcome_vars = NULL,
subset_condition = NULL,
scale = "RD",
contrast = NULL,
debug = FALSE
)
Arguments
- model_results
A list of model results from `model_causal_forest` or similar functions.
- outcome_vars
Optional. A character vector of outcome variable names. If NULL, the function will use all models in the input.
- subset_condition
A logical vector indicating the subset of data to use. Default is NULL.
- scale
A character string indicating the scale to use. Default is "RD".
- contrast
For categorical exposures, a single character string specifying the contrast to extract.
- debug
Logical. If TRUE, print debug information. Default is FALSE.
Examples
if (FALSE) { # \dontrun{
# Example for binary exposure
model_cat_subset_pols_binary <- margot_subset_model(
model_results = models_binary,
outcome_vars = t2_outcome_vars_z,
subset_condition = subset_condition_pols,
scale = "RD",
debug = FALSE
)
# Example for categorical exposure
model_cat_subset_pols_categorical <- margot_subset_model(
model_results = models_cat,
outcome_vars = t2_outcome_vars_z,
subset_condition = subset_condition_pols,
scale = "RD",
contrast = "[6.0,7.0] - [1.0,5.0)",
debug = TRUE
)
} # }