
Bootstrap-based Inference
Source:R/inference_all_abstract_non_param_boot.R
InferenceNonParamBootstrap.RdAbstract class for bootstrap-based inference.
The default m = NULL rule is a cheap deterministic
intermediate sequence: \(m \to \infty\) and \(m / n \to 0\), as
required by the standard m-out-of-n bootstrap asymptotic setup
(Bickel, Gotze, and van Zwet; Bickel and Sakov). The exponent 0.7 is a
pragmatic interior point in \((0, 1)\); it is not a silver-bullet
optimal choice. Use select_optimal_m_out_of_n_bootstrap() for
data-adaptive minimum-volatility selection.
The default m = NULL follows the intermediate-sequence
convention from the m-out-of-n bootstrap literature:
\(m \to \infty\) and \(m / n \to 0\). The deterministic exponent
0.7 is a first-pass default; for unstable paths prefer the
minimum-volatility selector.
The NULL default is grounded in the standard m-out-of-n
asymptotic condition \(m \to \infty\) and \(m / n \to 0\). The
minimum-volatility selector is available when a fixed deterministic
exponent is too brittle for a specific estimator/design path.
This implements the same minimum-volatility idea used in PTE's m-selection workflow: scan admissible intermediate sizes and choose a stable region of the target statistic rather than assuming one exponent is uniformly optimal.
The default b = NULL rule is a cheap deterministic
intermediate sequence: \(b \to \infty\) and \(b / n \to 0\), as
required by the Politis, Romano, and Wolf subsampling framework. The
exponent 0.7 is a pragmatic interior point in \((0, 1)\); it is not a
universal optimum. Use select_optimal_b_subsampling() for
data-adaptive minimum-volatility selection.
The default b = NULL follows the intermediate-sequence
convention from the Politis/Romano/Wolf subsampling literature:
\(b \to \infty\) and \(b / n \to 0\). The deterministic exponent
0.7 is a first-pass default; for unstable paths prefer the
minimum-volatility selector.
The NULL default is grounded in the standard
Politis/Romano/Wolf asymptotic condition \(b \to \infty\) and
\(b / n \to 0\). The minimum-volatility selector is available when a
fixed deterministic exponent is too brittle for a specific
estimator/design path.
This implements the same minimum-volatility idea used in PTE's m-selection workflow, applied to the PRW block/subsample-size choice: scan admissible intermediate sizes and choose a stable region of the target statistic rather than assuming one exponent is uniformly optimal.
Minimum B for BCa confidence intervals
type = "bca" needs a large enough B. The BCa-adjusted tail probabilities
must stay more than two order statistics from the ends of the bootstrap
distribution; with the default two-sided alpha = 0.05 and B of about 100
the nominal tail holds only about 2.5 order statistics, so the interval is
frequently NA (reason "bootstrap_bca_adjustment_on_boundary", reported once per
object per type by an edi_bootstrap_bca_boundary_warning). Use B of 501
or more for "bca", or type = "percentile" for small B. The same
guidance applies to compute_bayesian_bootstrap_confidence_interval(type = "bca").
This small-B guard is deliberate: it is not relaxed, and EDI does not silently
substitute a percentile interval. When it trips the interval is returned as
c(NA, NA) (with the warning above) and counts as an invalid interval;
EDI's coverage calibration fails a CI method that returns an invalid interval
in more than 5% of attempts, which BCa at small B can exceed.
Design-specific validity caveats for the nonparametric bootstrap
Nonparametric bootstrap methods are not supported for DesignSeqOneByOne
designs and their subclasses, except the concrete
DesignSeqOneByOneBernoulli class. The restriction includes m-out-of-n
bootstrap and subsampling methods registered under the same capability.
Calling restricted methods reports that the method is not supported.
For supported designs, the nonparametric bootstrap resamples experimental units with replacement from their
empirical distribution, carrying each unit's realized (x, w, y) into the
replicate, and recomputes the estimator. Its validity rests on the resampled units
being (approximately) iid draws from the design's unit-level superpopulation. Since
covariate-adaptive designs induce dependence among the assignments \(w_i\) (and
between \(w\) and \(X\)), the appropriate resampling unit and the fidelity with
which the design's dependence is replicated differ by design. In all cases below the
inference is asymptotic, never finite-sample exact (for exact finite-sample inference
under the design's actual randomization mechanism, use the randomization tests and
randomization confidence intervals where their assumptions hold). Calibration
depends on the design and estimator; omitted dependence does not in general
guarantee conservative inference.
DesignFixedBernoulliandDesignSeqOneByOneBernoulliAssignments are independent coin flips that do not use covariates or past assignments. If subjects and their potential outcomes arrive iid, with a noninformative sample size, observed rows are iid and ordinary row-level resampling has its usual asymptotic justification for regular estimators. Independent assignments alone do not establish iid rows under time trends, dependent recruitment, or informative stopping.
DesignFixediBCRDAssignment depends only on the treatment counts (completely randomized / without-replacement urn), inducing negative correlation among the \(w_i\) through the fixed-margin constraint. Row-level iid resampling does not replicate this constraint: replicates have a random number of treated subjects. The extra variability is \(O(1/n)\), so the bootstrap is conservative by an asymptotically negligible amount.
DesignFixedBlockingResampling is within-strata by default (
bootstrap_type = "within_blocks"), preserving stratum sizes; the exact within-stratum treatment/control split is not enforced in replicates, so the block-randomization variance reduction is partially unreplicated. Conservative, minor.bootstrap_type = "resample_blocks"instead resamples whole blocks, preserving within-block composition at the price of fewer resampling atoms.DesignFixedOptimalBlocksSame within-block resampling caveats as
DesignFixedBlocking, plus the blocks themselves are computed from the realized covariate sample: the block structure is a global function of the data that the bootstrap conditions on rather than re-derives. The justification for this conditioning is asymptotic: as \(n\) grows the blocking depends on the sample only through the (convergent) empirical distribution of \(X\), so between-block dependence vanishes. Conservative.DesignFixedClusterAssignment is at the cluster level and outcomes are correlated within clusters, so whole clusters are resampled with replacement. This is the correct exchangeable unit; with few clusters the bootstrap distribution rests on few resampling atoms and becomes unstable. Asymptotics are in the number of clusters, not the number of subjects.
DesignFixedBlockedClusterClusters are resampled within strata, matching both levels of the design's dependence (stratum and cluster). Sound, with the same small-sample caution: few clusters per stratum means few resampling atoms per stratum, and asymptotics are in the number of clusters.
DesignFixedGreedyDOptimal,DesignFixedGreedy,DesignFixedRerandomizationThe observed \(w\) vector is one draw from a tightly constrained (optimized or acceptance-sampled) set of allocations. Resampled replicates carry per-row assignments whose recombined \(w\) vector no longer satisfies the balance constraint, so the bootstrap reflects the variance of unconstrained assignment (cf. Li, Ding & Rubin 2018 for rerandomization). Conservative, moderate-to-large: the stronger the optimization, the greater the over-coverage.
DesignFixedMatchingGreedyPairSwitchingThe greedy switching search only ever flips assignments within binary-match pairs, so every pair has exactly one treated subject; the bootstrap resamples intact pairs, preserving the within-pair anticorrelation. Remaining caveats: the pairing is a global function of the sample (conditioned on, justified asymptotically as for the matched designs below), and the greedy choice of which pair member is treated couples the pairs, which resampling does not replicate — the residual effect errs conservative.
DesignFixedBinaryMatchMatched pairs are resampled intact, preserving the within-pair anticorrelation of \(w\) and the pair-level variance reduction. The pairing itself is a global function of the covariate sample (an Abadie & Imbens 2008-type concern): pairs are exchangeable but not exactly independent. Validity is asymptotic — as \(n\) grows the pairing depends on the sample only through the empirical distribution of \(X\) and between-pair dependence vanishes — and the bootstrap conditions on the realized match structure.
DesignFixedFactorialRow-level resampling does not replicate the balanced allocation across factor combinations. Conservative, minor.
DesignFixedCustomWarning: iid row-level resampling is used because the package has no knowledge of the user-supplied assignment mechanism. If that mechanism balances on covariates, the bootstrap is likely conservative; if it induces clustering or other positive dependence, the bootstrap may not even be valid (anti-conservative). Use the randomization-based inference, which draws from the actual custom mechanism, whenever possible.
References
Bickel, P. J., Gotze, F., and van Zwet, W. R. (1997). Resampling fewer than n observations: gains, losses, and remedies for losses. Statistica Sinica.
Bickel, P. J. and Sakov, A. (2008). On the choice of m in the m out of n bootstrap. The Annals of Statistics.
Politis, D. N., Romano, J. P., and Wolf, M. (1999). Subsampling. Springer.
Super classes
Inference -> InferenceResamplingCore -> InferenceRand -> InferenceRandCI -> InferenceNonParamBootstrap
Methods
Public methods
InferenceNonParamBootstrap$get_supported_bootstrap_pval_types()InferenceNonParamBootstrap$get_supported_bootstrap_ci_types()InferenceNonParamBootstrap$approximate_m_out_of_n_bootstrap_distribution_beta_hat_T()InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_two_sided_pval()InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_confidence_interval()InferenceNonParamBootstrap$select_optimal_m_out_of_n_bootstrap()InferenceNonParamBootstrap$approximate_subsampling_distribution_beta_hat_T()InferenceNonParamBootstrap$compute_subsampling_two_sided_pval()InferenceNonParamBootstrap$compute_subsampling_confidence_interval()InferenceNonParamBootstrap$compute_subsampling_sensitivity()InferenceNonParamBootstrap$approximate_bootstrap_distribution_beta_hat_T()InferenceNonParamBootstrap$compute_bootstrap_two_sided_pval()InferenceNonParamBootstrap$compute_bootstrap_confidence_interval()
+ inherited public methods from InferenceRandCI
+ inherited public methods from InferenceRand
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()Inference$compute_asymp_confidence_interval()Inference$compute_asymp_two_sided_pval()Inference$compute_estimate()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$initialize()Inference$is_nonestimable()Inference$set_estimand()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceNonParamBootstrap$get_supported_bootstrap_pval_types()
Returns the type values
compute_bootstrap_two_sided_pval() accepts.
InferenceNonParamBootstrap$get_supported_bootstrap_ci_types()
Returns the type values
compute_bootstrap_confidence_interval() accepts.
InferenceNonParamBootstrap$approximate_m_out_of_n_bootstrap_distribution_beta_hat_T()
Creates the m-out-of-n bootstrap distribution of the treatment-effect estimate.
Usage
InferenceNonParamBootstrap$approximate_m_out_of_n_bootstrap_distribution_beta_hat_T(
B = 501,
m = NULL,
show_progress = TRUE,
debug = FALSE,
bootstrap_type = NULL,
scaling = "sqrt_n",
center = "full_estimate"
)Arguments
BNumber of resamples. Default 501.
mNumber of exchangeable resampling units drawn with replacement. If
NULL(default), use the deterministic intermediate-size rulefloor(n_units^0.7), wheren_unitsis the number of exchangeable units used by the design (observations, clusters, pairs, or matched sets). The resolved value must satisfymax(5, p_eff + 2) <= m <= floor(n_units / 2).show_progressA flag indicating whether a progress bar should be displayed.
debugIf
TRUE, return distribution diagnostics in addition to the resampled estimates.bootstrap_typeOptional empirical-resampling scheme. See
approximate_bootstrap_distribution_beta_hat_T().scalingScaling sequence for centered m-out-of-n pivots. The default
"sqrt_n"usessqrt(m)for the m-sample distribution and converts back to the full-sample scale usingsqrt(n_units).centerCentering convention for diagnostics and cache keys.
InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_two_sided_pval()
Computes a centered m-out-of-n bootstrap two-sided p-value.
Usage
InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_two_sided_pval(
delta = 0,
B = 501,
m = NULL,
type = "centered",
show_progress = TRUE,
min_number_usable_samples = 5L,
bootstrap_type = NULL,
scaling = "sqrt_n",
min_fraction_usable_samples = 0.8
)Arguments
deltaNull treatment effect. Default 0.
BNumber of resamples. Default 501.
mNumber of exchangeable units drawn with replacement. If
NULL(default), usefloor(n_units^0.7)subject to the validation bounds documented forapproximate_m_out_of_n_bootstrap_distribution_beta_hat_T().typeP-value type. Currently only
"centered"is supported.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite resampled estimates required after filtering. Default 5.
bootstrap_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered m-out-of-n pivots.
min_fraction_usable_samplesMinimum fraction of the
Bresamples that must be usable, for a ratio estimand (InferenceIncidLogRegr,InferenceIncidKKGEE,InferenceIncidModifiedPoisson,InferenceIncidLogBinomial,InferenceCountPoisson). A draw is unusable when it is degenerate (a treatment arm with no events; on the logit scale also only events; for a count a zero total; or a separated logistic fit) or its fit fails. Below this fraction the method returnsNAwith reason"m_out_of_n_too_few_usable_draws_fraction"and oneedi_procedure_na_warning; otherwise it uses the usable draws only. Default 0.8 (v1.0.6-TODO-230): degenerate draws concentrate in the data sets with an extreme estimate, so a stricter cap returnsNAon many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to returnNAsooner. Other classes ignore it and keep their fixed rule (at least half of the resamples finite).
InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_confidence_interval()
Computes a basic m-out-of-n bootstrap confidence interval.
Usage
InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_confidence_interval(
alpha = 0.05,
B = 501,
m = NULL,
type = "basic",
show_progress = TRUE,
min_number_usable_samples = 5L,
bootstrap_type = NULL,
scaling = "sqrt_n",
min_fraction_usable_samples = 0.8
)Arguments
alphaSignificance level. Default 0.05.
BNumber of resamples. Default 501.
mNumber of exchangeable units drawn with replacement. If
NULL(default), usefloor(n_units^0.7)subject to the validation bounds documented forapproximate_m_out_of_n_bootstrap_distribution_beta_hat_T().typeConfidence-interval type. Currently only
"basic"is supported.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite resampled estimates required after filtering. Default 5.
bootstrap_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered m-out-of-n pivots.
min_fraction_usable_samplesMinimum fraction of the
Bresamples that must be usable, for a ratio estimand (InferenceIncidLogRegr,InferenceIncidKKGEE,InferenceIncidModifiedPoisson,InferenceIncidLogBinomial,InferenceCountPoisson). A draw is unusable when it is degenerate (a treatment arm with no events; on the logit scale also only events; for a count a zero total; or a separated logistic fit) or its fit fails. Below this fraction the method returnsNAwith reason"m_out_of_n_too_few_usable_draws_fraction"and oneedi_procedure_na_warning; otherwise it uses the usable draws only. Default 0.8 (v1.0.6-TODO-230): degenerate draws concentrate in the data sets with an extreme estimate, so a stricter cap returnsNAon many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to returnNAsooner. Other classes ignore it and keep their fixed rule (at least half of the resamples finite).
InferenceNonParamBootstrap$select_optimal_m_out_of_n_bootstrap()
Selects an m-out-of-n bootstrap size by minimum volatility.
Usage
InferenceNonParamBootstrap$select_optimal_m_out_of_n_bootstrap(
B = 251,
alpha = 0.05,
m_pow_of_n_grid = seq(0.5, 0.9, by = 0.05),
m_grid = NULL,
objective = "ci_width",
target = "ci",
volatility_window = 3L,
bootstrap_type = NULL,
scaling = "sqrt_n",
show_progress = TRUE,
min_finite_fraction = 0.8
)Arguments
BNumber of resamples per candidate size. Default 251.
alphaSignificance level for interval-width objectives.
m_pow_of_n_gridCandidate exponent grid used when
m_grid = NULL. Defaults toseq(0.5, 0.9, by = 0.05).m_gridOptional explicit integer candidate sizes.
objectiveSelection objective. Currently
"ci_width".targetTarget summary. Currently
"ci".volatility_windowRolling window size used to measure local volatility across candidate sizes.
bootstrap_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered m-out-of-n pivots.
show_progressA flag indicating whether a progress bar should be displayed.
min_finite_fractionMinimum finite-resample fraction required for a candidate size to be eligible.
InferenceNonParamBootstrap$approximate_subsampling_distribution_beta_hat_T()
Creates the Politis/Romano/Wolf subsampling distribution of the treatment-effect estimate.
Usage
InferenceNonParamBootstrap$approximate_subsampling_distribution_beta_hat_T(
B = 501,
b = NULL,
show_progress = TRUE,
debug = FALSE,
subsampling_type = NULL,
scaling = "sqrt_n",
center = "full_estimate"
)Arguments
BNumber of subsamples. Default 501.
bNumber of exchangeable units drawn without replacement. If
NULL(default), use the deterministic intermediate-size rulefloor(n_units^0.7), wheren_unitsis the number of exchangeable units used by the design (observations, clusters, pairs, or matched sets). The resolved value must satisfymax(5, p_eff + 2) <= b <= floor(n_units / 2).show_progressA flag indicating whether a progress bar should be displayed.
debugIf
TRUE, return distribution diagnostics in addition to the subsampled estimates.subsampling_typeOptional empirical-resampling scheme. See
approximate_bootstrap_distribution_beta_hat_T().scalingScaling sequence for centered subsampling pivots. The default
"sqrt_n"usessqrt(b)for the subsample distribution and converts back to the full-sample scale usingsqrt(n_units).centerCentering convention for diagnostics and cache keys.
InferenceNonParamBootstrap$compute_subsampling_two_sided_pval()
Computes a centered PRW subsampling two-sided p-value.
Usage
InferenceNonParamBootstrap$compute_subsampling_two_sided_pval(
delta = 0,
B = 501,
b = NULL,
type = "centered",
show_progress = TRUE,
min_number_usable_samples = 5L,
subsampling_type = NULL,
scaling = "sqrt_n",
min_fraction_usable_samples = 0.8
)Arguments
deltaNull treatment effect. Default 0.
BNumber of subsamples. Default 501.
bNumber of exchangeable units drawn without replacement. If
NULL(default), usefloor(n_units^0.7)subject to the validation bounds documented forapproximate_subsampling_distribution_beta_hat_T().typeP-value type. Currently only
"centered"is supported.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite subsampled estimates required after filtering. Default 5.
subsampling_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered subsampling pivots.
min_fraction_usable_samplesMinimum fraction of the
Bsubsamples that must be usable, for a ratio estimand (InferenceIncidLogRegr,InferenceIncidKKGEE,InferenceIncidModifiedPoisson,InferenceIncidLogBinomial,InferenceCountPoisson). A draw is unusable when it is degenerate (a treatment arm with no events; on the logit scale also only events; for a count a zero total; or a separated logistic fit) or its fit fails. Below this fraction the method returnsNAwith reason"subsampling_too_few_usable_draws_fraction"and oneedi_procedure_na_warning; otherwise it uses the usable draws only. Default 0.8 (v1.0.6-TODO-230): degenerate draws concentrate in the data sets with an extreme estimate, so a stricter cap returnsNAon many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to returnNAsooner. Other classes ignore it and keep their fixed rule (at least half of the subsamples finite).
InferenceNonParamBootstrap$compute_subsampling_confidence_interval()
Computes a basic PRW subsampling confidence interval.
Usage
InferenceNonParamBootstrap$compute_subsampling_confidence_interval(
alpha = 0.05,
B = 501,
b = NULL,
type = "basic",
show_progress = TRUE,
min_number_usable_samples = 5L,
subsampling_type = NULL,
scaling = "sqrt_n",
min_fraction_usable_samples = 0.8
)Arguments
alphaSignificance level. Default 0.05.
BNumber of subsamples. Default 501.
bNumber of exchangeable units drawn without replacement. If
NULL(default), usefloor(n_units^0.7)subject to the validation bounds documented forapproximate_subsampling_distribution_beta_hat_T().typeConfidence-interval type. Currently only
"basic"is supported.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite subsampled estimates required after filtering. Default 5.
subsampling_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered subsampling pivots.
min_fraction_usable_samplesMinimum fraction of the
Bsubsamples that must be usable, for a ratio estimand (InferenceIncidLogRegr,InferenceIncidKKGEE,InferenceIncidModifiedPoisson,InferenceIncidLogBinomial,InferenceCountPoisson). A draw is unusable when it is degenerate (a treatment arm with no events; on the logit scale also only events; for a count a zero total; or a separated logistic fit) or its fit fails. Below this fraction the method returnsNAwith reason"subsampling_too_few_usable_draws_fraction"and oneedi_procedure_na_warning; otherwise it uses the usable draws only. Default 0.8 (v1.0.6-TODO-230): degenerate draws concentrate in the data sets with an extreme estimate, so a stricter cap returnsNAon many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to returnNAsooner. Other classes ignore it and keep their fixed rule (at least half of the subsamples finite).
InferenceNonParamBootstrap$select_optimal_b_subsampling()
Selects a PRW subsampling size by minimum volatility.
Usage
InferenceNonParamBootstrap$select_optimal_b_subsampling(
B = 251,
alpha = 0.05,
b_pow_of_n_grid = seq(0.5, 0.9, by = 0.05),
b_grid = NULL,
objective = "ci_width",
target = "ci",
volatility_window = 3L,
subsampling_type = NULL,
scaling = "sqrt_n",
show_progress = TRUE,
min_finite_fraction = 0.8
)Arguments
BNumber of subsamples per candidate size. Default 251.
alphaSignificance level for interval-width objectives.
b_pow_of_n_gridCandidate exponent grid used when
b_grid = NULL. Defaults toseq(0.5, 0.9, by = 0.05).b_gridOptional explicit integer candidate sizes.
objectiveSelection objective. Currently
"ci_width".targetTarget summary. Currently
"ci".volatility_windowRolling window size used to measure local volatility across candidate sizes.
subsampling_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered subsampling pivots.
show_progressA flag indicating whether a progress bar should be displayed.
min_finite_fractionMinimum finite-subsample fraction required for a candidate size to be eligible.
InferenceNonParamBootstrap$compute_subsampling_sensitivity()
Computes PRW subsampling sensitivity over candidate sizes.
Usage
InferenceNonParamBootstrap$compute_subsampling_sensitivity(
B = 251,
alpha = 0.05,
b_pow_of_n_grid = seq(0.5, 0.9, by = 0.05),
b_grid = NULL,
objective = "ci_width",
target = "ci",
volatility_window = 3L,
subsampling_type = NULL,
scaling = "sqrt_n",
show_progress = TRUE,
min_finite_fraction = 0
)Arguments
BNumber of subsamples per candidate size. Default 251.
alphaSignificance level for interval-width objectives.
b_pow_of_n_gridCandidate exponent grid used when
b_grid = NULL. Defaults toseq(0.5, 0.9, by = 0.05).b_gridOptional explicit integer candidate sizes.
objectiveSelection objective. Currently
"ci_width".targetTarget summary. Currently
"ci".volatility_windowRolling window size used to measure local volatility across candidate sizes.
subsampling_typeOptional empirical-resampling scheme.
scalingScaling sequence for centered subsampling pivots.
show_progressA flag indicating whether a progress bar should be displayed.
min_finite_fractionMinimum finite-subsample fraction required for a candidate size to be eligible. Defaults to 0 for sensitivity scans.
InferenceNonParamBootstrap$approximate_bootstrap_distribution_beta_hat_T()
Creates the bootstrap distribution of the estimate for the treatment effect. The resampling unit is design-specific (rows, within-strata rows, matched pairs plus reservoir, or clusters); see the class-level section Design-specific validity caveats for the nonparametric bootstrap for the conservativeness and asymptotics of each concrete design.
Usage
InferenceNonParamBootstrap$approximate_bootstrap_distribution_beta_hat_T(
B = 501,
show_progress = TRUE,
debug = FALSE,
bootstrap_type = NULL
)Arguments
BNumber of bootstrap samples. The default is 501.
show_progressA flag indicating whether a progress bar should be displayed.
debugIf
TRUE, return a list with the distribution values and per-iteration diagnostics including error messages, warning messages, counts of each, and summary proportions for iterations with errors, warnings, and illegal (non-finite) values. Runs serially. DefaultFALSE.bootstrap_typeOptional bootstrap-resampling scheme. Legal public values are:
NULLUse the design's default row-resampling bootstrap. For ordinary non-blocking designs this is the usual subject-level resample-with-replacement bootstrap. For certain blocking designs,
NULLmaps to the same behavior as"within_blocks"."within_blocks"Only legal for blocking-style designs that support block-aware bootstrap resampling:
DesignFixedBlocking,DesignFixedOptimalBlocks, andDesignFixedBlockedCluster. (DesignSeqOneByOneSPBRis aDesignSeqOneByOnesubclass, so the nonparametric bootstrap is not supported on it at all; see the class documentation.) Resamples observational units within each observed block/stratum. For blocked cluster designs this means resampling clusters within strata."resample_blocks"Only legal for the same blocking-style designs as
"within_blocks". Resamples entire observed blocks/strata with replacement rather than resampling units within each block.
Any non-
NULLvalue is rejected for designs outside that blocking family.
Returns
When debug = FALSE (default), a numeric vector of length B
containing the bootstrap estimates. When debug = TRUE, a list with: values,
errors (list of character vectors, one per iteration), warnings (list of
character vectors, one per iteration), num_errors, num_warnings,
prop_iterations_with_errors, prop_iterations_with_warnings, and
prop_illegal_values.
InferenceNonParamBootstrap$compute_bootstrap_two_sided_pval()
Computes a bootstrap-based two-sided p-value for the treatment effect. Validity is asymptotic and design-dependent; for most covariate-adaptive designs the p-value errs conservative. See the class-level section Design-specific validity caveats for the nonparametric bootstrap.
Usage
InferenceNonParamBootstrap$compute_bootstrap_two_sided_pval(
delta = 0,
B = 501,
type = NULL,
na.rm = FALSE,
show_progress = TRUE,
min_number_usable_samples = 5L,
min_fraction_usable_samples = 0.95
)Arguments
deltaNull hypothesis value. Default 0.
BNumber of bootstrap samples. Default 501.
typeBootstrap p-value type. Supported values are
"percentile","symmetric","studentized","bootstrap-t", and"bca"."percentile": shifts the bootstrap distribution to be centred atdeltaand counts the two-tail proportion (Hall 1992)."symmetric": uses \(|T^* - \bar{T}^*| \ge |t_{\rm obs} - \delta|\) for a symmetric one-sample test; recommended by Hall & Wilson (1991) when the null distribution may be skewed. This pooled-tail test is offered only as a p-value here, not as a confidence-intervaltypeincompute_bootstrap_confidence_interval: pooling both tails via \(|\cdot|\) improves testing power (Hall & Wilson's original use case), but inverting it unstudentized would add no value as an interval. The unstudentized pivot is not asymptotically pivotal, so the resulting interval would have the same first-order \(O(n^\{-1/2\})\) coverage error as"percentile"/"basic", while forcing symmetric bounds around a possibly skewed bootstrap distribution — strictly worse than"percentile"/"basic"for shape-adaptivity, and strictly worse than"symmetric-percentile-t"for accuracy, since studentizing (not the absolute-value pooling) is what buys the \(O(n^\{-1\})\) improvement. The CI-worthy symmetric variant is therefore"symmetric-percentile-t"(studentized pivot), not a plain"symmetric"CI type."studentized"/"bootstrap-t": pivots by the per-replicate standard error, giving O(n^{-1}) error versus O(n^{-1/2}) for the percentile method (Hall 1992; Davidson & MacKinnon 1999)."bca": bias-corrected and accelerated p-value via closed-form CI inversion using the jackknife acceleration and bias-correction constants; second-order accurate (Efron 1987; Efron & Tibshirani 1993). Whendeltalies outside every BCa interval (outside the range of the bootstrap draws, or past the acceleration's turning point) the p-value is the floor \(2/B\) that the other types also report, notNA. It isNAonly when the BCa adjustment itself is degenerate: on the order-statistic boundary (oneedi_bootstrap_bca_boundary_warningper object) or with an unstable bias correction or acceleration (oneedi_bootstrap_bca_unstable_warningper object); usetype = "percentile"then. It is alsoNAwhen the jackknife behind the acceleration (automatic unit: blocks, clusters, matched sets or subjects) has fewer than 5 deletion units (reason"bootstrap_bca_jackknife_too_few_deletion_units", the same minimum ascompute_jackknife_std_error()) or fewer than 2 finite replicates (reason"bootstrap_bca_jackknife_unavailable"), with oneedi_procedure_na_warning.na.rmRemove non-finite bootstrap replicates. Default FALSE, in which case a single non-finite replicate makes the p-value
NA(with a once-per-object warning of classedi_bootstrap_nonfinite_na_warningsaying how many replicates were non-finite). The confidence-interval method always drops non-finite replicates, so it can be finite when this p-value isNA;na.rm = TRUEdrops them here too, subject tomin_number_usable_samplesandmin_fraction_usable_samples.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite bootstrap samples required after filtering. Default 5. Must be less than or equal to
B.min_fraction_usable_samplesMinimum fraction of the
Breplicates that must be finite whenna.rm = TRUE(for the studentized types: a finite estimate and a positive finite standard error). A number in \([0, 1]\); default0.95, which mirrors the 5% cap on invalid intervals that EDI's coverage calibration applies to confidence intervals. Below it the p-value isNAwith the recorded reason"bootstrap_too_few_valid_replicates_fraction"and oneedi_procedure_na_warning(silent inside an outer resampling operation), so a p-value is never formed from the few resamples on which the estimator happened to work.0turns the check off;1requires every replicate. Ignored whenna.rm = FALSE, which already returnsNAon any non-finite replicate.
InferenceNonParamBootstrap$compute_bootstrap_confidence_interval()
Computes a bootstrap-based confidence interval. Coverage is asymptotic and design-dependent; for most covariate-adaptive designs the interval errs conservative (over-coverage). See the class-level section Design-specific validity caveats for the nonparametric bootstrap.
Usage
InferenceNonParamBootstrap$compute_bootstrap_confidence_interval(
alpha = 0.05,
B = 501,
type = NULL,
na.rm = TRUE,
show_progress = TRUE,
min_number_usable_samples = 5L
)Arguments
alphaThe significance level; the interval has confidence level 1 -
alpha. Default 0.05.BNumber of bootstrap samples. Default 501.
typeBootstrap CI type. Supported values are
"percentile","basic","studentized","bootstrap-t","symmetric-percentile-t","bca","prepivoted","double-bootstrap","calibrated", and"smoothed". There is no plain"symmetric"CI type (contrast with the"symmetric"p-value type incompute_bootstrap_two_sided_pval): inverting the unstudentized Hall & Wilson pooled-tail statistic would add no value as an interval, since it is not asymptotically pivotal and so has the same first-order \(O(n^\{-1/2\})\) coverage error as"percentile"/"basic", while forcing symmetric bounds around a possibly skewed bootstrap distribution — strictly worse than"percentile"/"basic"for shape-adaptivity, and strictly worse than"symmetric-percentile-t"for accuracy, since studentizing (not the absolute-value pooling) is what buys the \(O(n^\{-1\})\) improvement."symmetric-percentile-t"is the CI-worthy symmetric variant. Minimum B for"bca": the BCa adjusted tail probabilities must stay more than two order statistics (2/(B + 1)) inside the sample range, so at small B the interval isNA(reason"bootstrap_bca_adjustment_on_boundary", with oneedi_bootstrap_bca_boundary_warningper object). B of about 501 or more is recommended for"bca"; at B of about 100 it is NA for many datasets. Usetype = "percentile"when a small B is needed. The BCa interval is alsoNAwhen the bias correction or acceleration is unstable (\(|z_0| > 2.5\), i.e. the estimate lies in the far tail of the bootstrap draws, \(|a| > 1\), either not finite, or a (near) zero BCa denominator; reason"bootstrap_bca_unstable_bias_or_acceleration"), with oneedi_bootstrap_bca_unstable_warningper object; a larger B does not help there, usetype = "percentile". Minimum units for"bca": the acceleration comes from the jackknife on the design's automatic unit (blocks, clusters, matched sets or subjects); with fewer than 5 deletion units (the same minimum ascompute_jackknife_std_error()) the interval isNA(reason"bootstrap_bca_jackknife_too_few_deletion_units"; with fewer than 2 finite replicates,"bootstrap_bca_jackknife_unavailable") with oneedi_procedure_na_warning. Each suchNAraises only that one warning.na.rmRemove non-finite bootstrap replicates. Default TRUE. Non-finite replicates are always removed internally.
show_progressShow progress bar.
min_number_usable_samplesMinimum number of finite bootstrap samples required after filtering. Default 5. Must be less than or equal to
B.