| run_selected_matching | R Documentation |
Rerun GPS Estimation and Matching for a Selected Configuration
run_selected_matching(x, data, formula, smd_group = NULL, row = 1L, ...)
x |
A |
data |
Data frame used in the original optimization (pass it the same
way as in your original analysis, e.g. |
formula |
Model formula used for GPS estimation (e.g.
|
smd_group |
Optional SMD bin to filter on
(e.g. |
row |
Integer index of the row (after optional filtering by
|
... |
Extra args forwarded to |
The result of match_gps().
# Define formula and set up optimization
formula_cancer <- formula(status ~ age * sex)
opt_args <- make_opt_args(cancer, formula_cancer, gps_method = "m1")
withr::with_seed(8252, {
opt_results <- optimize_gps(
data = cancer,
formula = formula_cancer,
opt_args = opt_args,
n_iter = 2000
)
})
# Select optimal combinations prioritizing SMD balance and matching in key
# groups
select_results <- select_opt(
x = opt_results,
smd_groups = list(
c("adenoma", "control"),
c("control", "crc_benign"),
c("crc_malignant", "control")
),
smd_variables = "age",
smd_type = "max",
perc_matched = c("adenoma", "crc_malignant")
)
# Extract the parameter grid from select_results for smd_group = "0.05-0.10"
get_select_params(select_results, smd_group = "0.05-0.10")
# Rerun the analysis
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.