View source: R/fs_mr_inference.R
| fs_mr_inference | R Documentation |
Computes a multiplier-bootstrap approximation of the bootstrap
bias-corrected treatment effect for the selected subgroup and flags whether
it is still consistent with harm. Reuses the resample consistency engine's
per-candidate treatment dfbeta; see the file header for the closed form.
fs_mr_inference(
df,
candidates,
spec,
selected_members,
admission,
t_confirm = NULL,
confirm_rule = c("point", "ci"),
reselection = c("maxcons", "maxeff", "maxSG", "minSG", "effMaxSG", "effMinSG"),
effect_neighborhood = 0.1,
selection_rule = c("neighborhood", "pareto", "both"),
draws = 2000L,
multiplier = c("poisson", "gaussian", "rademacher"),
include_complement = FALSE,
ci_method = c("field", "ij", "wald"),
seed = NULL,
return_reselection = TRUE,
field_R_out = 1000L,
field_R_in = 500L,
field_uniform = FALSE,
field_M_cap = NULL,
field_complement = TRUE,
field_decompose = FALSE,
field_scale_complement = c("selected", "none"),
ij_residual = c("two_term", "winner", "winner_floor"),
field_recovery = FALSE,
keep_declaration_field = FALSE,
keep_field_matrix = FALSE,
declaration_c0 = NULL,
pconsistency.digits = NULL
)
df |
Analysis data frame (the standardized |
candidates |
Named list of integer row-index vectors, one per screened candidate subgroup (the family the selection rule chose among). |
spec |
List with |
selected_members |
Integer row indices of the observed selected subgroup
( |
admission |
The resolved admission set, as returned by
This replaces the former
|
t_confirm |
Harm-confirmation threshold on the effect scale (HR/OR/
RR/IRR, or RD/MD for differences – not the working log scale). |
confirm_rule |
Which harm-confirmation rule to apply to the de-biased
estimate: |
reselection |
Bootstrap re-selection rule for the bias term; default
|
effect_neighborhood |
Band for the |
draws, multiplier, seed |
Multiplier-bootstrap controls. |
include_complement |
Logical. When |
ci_method |
|
return_reselection |
Logical. When |
field_R_out, field_R_in |
Outer and inner Monte Carlo sizes for
|
field_uniform |
Logical (default |
field_M_cap |
Optional override of the uniform sweep's mass-carrying
cap ( |
field_complement |
Logical (default |
field_decompose |
Logical (default |
field_scale_complement |
|
ij_residual |
Which IJ residual populates the reported de-biased
SE and interval ( |
field_recovery |
Logical (default |
keep_declaration_field |
Logical (default |
keep_field_matrix |
Logical (default |
declaration_c0 |
|
pconsistency.digits |
Integer or |
This is post-selection inference on a completed analysis: it runs after
forestsearch() has chosen the subgroup and cannot change that choice. It
is the fast, refit-free counterpart of the full bootstrap (FB,
forestsearch_bootstrap_dofuture()), which re-runs the entire search in
every replicate; MR perturbs the influence contributions of a single fit
instead. MR approximates FB to leading order and does not replace it.
List with the selected index/label, naive and debiased estimates
(effect scale, with approximate 95% CIs), selection_bias, fixed_bias,
selection_rate, mean_r, mean_r_c, the settings actually used (t_confirm,
confirm_rule, reselection, selection_rule, multiplier, draws),
harm_flag, family/subgroup sizes, and timing_seconds. The debiased
element carries se_ij, se_wald, var_ij, and ij_source; its CI uses
the IJ SE under ci_method = "field" (the default) and "ij" (the FB
analogue in both cases) and the robust SE under "wald".
When include_complement = TRUE, a complement element carries the
complement subgroup's naive/debiased estimates and bias terms in the
same form, including its own IJ variance. The complement's de-biased CI
follows the same SE convention as the winner's: the IJ SE under
ci_method = "ij" and "field" (under "field" the complement, like the
debiased element, is identical to the "ij" output), the robust SE
under "wald".
mean_r is the mean of the IJ residual r_b over ok_H – exactly
the draws entering the variance, not all draws, since on an excluded
draw r_b is not a meaningful quantity. The invariant is that it is
zero by construction whenever both bias terms share a denominator, which
is the convention the package implements: selection_bias and
fixed_bias both average over the draws that produced a winner, and the
IJ runs on that same set. A non-zero value therefore means the two terms
are being normalised differently somewhere – the defect corrected in
dad0415, whose signature was precisely a non-zero residual mean.
mean_r_c is the same quantity for the complement over use_c, and is
NA_real_ when no complement was fit. Both are diagnostics of the
correction's internal consistency rather than properties of the estimate,
which is why they sit beside selection_rate and not inside debiased.
Note the mixed scales in the flat debiased list: est/lower/upper/
lower_1s are on the effect scale, while se/se_ij/se_wald/
var_ij and the two bias terms are on the working (log, for ratio
measures) scale.
When the selected subgroup cannot be fit in the reconstructed family the
return is a short variant carrying only selected_index (NA),
selected_label, harm_flag (NA), settings, note and n_family;
consumers must tolerate that shape.
Under return_reselection = TRUE the full return additionally carries a
reselection element (see that argument); the short variant never does.
Under ci_method = "field" the full return additionally carries a
field element: lambda_mean, lambda_sd/se_field and the
Lambda* quantiles q05/q25/q50/q75/q95/q025/q975 on the working
scale; n_out_used, n_in_used_mean, R_out, R_in, seed_offset,
timing_seconds; and, on the effect scale (the debiased
convention), the second-order point estimate est2 (de-biased estimate
minus lambda_mean), the primary one-sided 95% bound lower_1s
(de-biased minus q95), the two-sided quantile interval
lower_2s/upper_2s, and the supplementary SE-type interval
lower_se/upper_se around est2.
Under field_recovery = TRUE the field element additionally carries
recovery: sens_H (the primary quantity – the mean share of the
identified patients that the re-selections retain), ppv_H, sens_Hc,
ppv_Hc and its alias npv_Hc; the containment quantiles q10, q50,
q90 and share_equal_1 (the share of draws whose re-selection contains
all of the observed subgroup); and the accounting n_draws, n_used,
n_skipped, n_selected, n_all, timing_seconds. Descriptive only;
absent when field_recovery = FALSE.
Under field_complement = TRUE (with include_complement = TRUE) the
field element additionally carries complement, the complement's own
field block in the same form and scales, inverted around the complement's
two-term de-biased estimate: lambda_mean, lambda_sd/se_field, the
seven Lambda*c quantiles; on the effect scale est2, the primary
one-sided 95% upper bound upper_1s (de-biased minus q05), the
one-sided lower bound lower_1s, the two-sided lower_2s/upper_2s
and the SE-type lower_se/upper_se; the draw accounting
n_out_used, n_in_used_mean, n_out_dropped_unfit; the fit accounting
n_complement_fits (distinct complement fits, the multiplier stage's
included), n_new_fits, share_draws_new_fit (share of outer + inner
draw-winner readings whose candidate the multiplier stage had not fit);
R_out, R_in, timing_seconds. A note replaces the numbers when
the selected complement is unfit or fewer than 2 outer draws survive.
With the complement field on, field also carries joint: the
simultaneous (harm lower, complement upper) pair from the aligned outer
draws (\Lambda^*_r, \Lambda^{*c}_r) – same multipliers, same
winners, no new draws. gamma is the equal-tail level (grid from
alpha down to alpha / 2, step 0.001; the largest value whose joint
probability P^*(\Lambda^* \le q_{1-\gamma}, \Lambda^{*c} \ge
q_\gamma) \ge 1 - \alpha), joint_prob the achieved probability,
lower_H/upper_Hc the calibrated pair (effect scale),
bonf_lower_H/bonf_upper_Hc the Bonferroni pair at gamma = alpha/2
with its bonf_joint_prob, corr the draws' correlation,
n_joint_draws, and the grid_gamma/grid_joint_prob profile. The
marginal one-sided bounds are unchanged. The top-level ij_residual
records the residual that populated the reported IJ SEs.
This is an engine-level entry point. Its arguments are a candidate family,
a specification, and a selected membership vector – the identifier
configuration that produced them is not visible, so the alignment
conditions MR requires (selection ranking on the inferential coefficient
\hat\beta(g), and a fixed candidate family) cannot be verified at
this level and are assumed to have been established upstream.
They are enforced by .validate_mr_configuration() at the three
configuration-visible entry points – forestsearch() under
mr_inference = TRUE, and forestsearch_bootstrap_dofuture() and
forestsearch_Kfold() under mr_in_replicates = TRUE. Calling
fs_mr_inference() directly bypasses those guards: a family ranked on
DINA's native tau-hat, on GRF's doubly-robust score, or on a GRF
policy-tree objective will still produce numbers, but they do not de-bias
the reported effect.
forestsearch() for the mr_inference switch and the
vocabulary section; mr_estimates_table() to render the result;
forestsearch_bootstrap_dofuture() for the full bootstrap (FB) this
approximates; fs_fdr_report() which sweeps c_confirm thresholds.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.