Batch process heterogeneity analyses across multiple outcome domains
Source:R/margot_planned_subgroups_batch.R
margot_planned_subgroups_batch.Rd
This function streamlines the process of running planned contrasts and heterogeneity analyses across multiple outcome domains. It applies the same subset analyses (e.g., by wealth, ethnicity, political orientation) to different outcome domains, saving results, generating tables, and creating visualizations.
Usage
margot_planned_subgroups_batch(
domain_models,
X,
base_defaults,
subset_types,
original_df,
domain_names,
subtitles,
output_dir = NULL,
push_mods = FALSE,
interpret_all_E_gt1 = TRUE
)
Arguments
- domain_models
list of model sets for different domains (e.g., list(models_binary_health, models_binary_psych))
- X
predictor matrix used in the models
- base_defaults
default parameters for model processing
- subset_types
list of subset specifications (e.g., list(wealth = subsets_standard_wealth))
- original_df
original dataframe containing all variables
- domain_names
character vector of names for the outcome domains
- subtitles
character vector of subtitles for plots
- output_dir
directory to save outputs (defaults to NULL)
- push_mods
logical; whether to push models (defaults to FALSE)
- interpret_all_E_gt1
logical; interpretation parameter (defaults to TRUE)
Examples
# set up lists of models, names, and subtitles
domain_models <- list(
models_binary_health,
models_binary_psych,
models_binary_present,
models_binary_life,
models_binary_social
)
#> Error: object 'models_binary_health' not found
domain_names <- c("health", "psych", "present", "life", "social")
subtitles <- c(
subtitle_health,
subtitle_psych,
subtitle_present,
subtitle_life,
subtitle_social
)
#> Error: object 'subtitle_health' not found
# set up subset types in a list
subset_types <- list(
wealth = subsets_standard_wealth,
ethnicity = subsets_standard_ethnicity,
political = subsets_standard_political,
gender = subsets_standard_gender,
cohort = subsets_standard_cohort
)
#> Error: object 'subsets_standard_wealth' not found
# run the batch processing for all domains and subsets
results <- margot_planned_subgroups_batch(
domain_models = domain_models,
X = X,
base_defaults = base_defaults_binary,
subset_types = subset_types,
original_df = original_df,
domain_names = domain_names,
subtitles = subtitles,
push_mods = push_mods
)
#> Error: object 'domain_models' not found