View source: R/glm_effect_estimators.R
| make_effect_estimator | R Documentation |
Returns a closure function(data_slice) that estimates the
within-subgroup treatment effect for the requested outcome type and
effect measure. The closure is called repeatedly inside the
splitting-consistency loop and the bootstrap worker, so it must be
lightweight and handle small-sample edge cases gracefully.
make_effect_estimator(
outcome_type,
treat.name,
outcome.name,
event.name = NULL,
offset.name = NULL,
effect_measure = NULL,
adverse_outcome = TRUE,
robust_se = TRUE,
adjust_covariates = NULL,
ps_adjust_method = c("none", "iptw", "dr_gcomp"),
...
)
outcome_type |
Character. One of |
treat.name |
Character. Name of the binary treatment column (0/1). |
outcome.name |
Character. Name of the outcome column. |
event.name |
Character or |
offset.name |
Character or |
effect_measure |
Character or |
adverse_outcome |
Logical. If
|
robust_se |
Logical. Use sandwich robust SE when available.
Default |
adjust_covariates |
This option is implemented but has not been
tested against the manuscript analyses or the simulation studies of
León and Anderson (2026a, 2026b), which use the unadjusted
treatment-only fits.
Character vector or |
ps_adjust_method |
This option is implemented but has not been
tested against the manuscript analyses or the simulation studies of
León and Anderson (2026a, 2026b), which use the unadjusted
treatment-only fits.
Character. Propensity score adjustment method.
One of |
... |
Additional arguments (reserved for future extensions). |
A closure function(data_slice) returning a list with
components: estimate, se, converged, n0,
n1, measure, method_used.
## Not run:
# Binary outcome with odds ratio
fn <- make_effect_estimator("binary", "treat", "event",
effect_measure = "OR")
result <- fn(my_data)
exp(result$estimate) # odds ratio
# Poisson rate with IPTW adjustment
fn_iptw <- make_effect_estimator("binary", "treat", "event",
offset.name = "time", effect_measure = "IRR",
ps_adjust_method = "iptw")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.