Skip to contents

Abstract 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.

DesignFixedBernoulli and DesignSeqOneByOneBernoulli

Assignments 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.

DesignFixediBCRD

Assignment 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.

DesignFixedBlocking

Resampling 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.

DesignFixedOptimalBlocks

Same 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.

DesignFixedCluster

Assignment 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.

DesignFixedBlockedCluster

Clusters 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, DesignFixedRerandomization

The 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.

DesignFixedMatchingGreedyPairSwitching

The 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.

DesignFixedBinaryMatch

Matched 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.

DesignFixedFactorial

Row-level resampling does not replicate the balanced allocation across factor combinations. Conservative, minor.

DesignFixedCustom

Warning: 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

+ inherited public methods from InferenceRandCI
+ inherited public methods from InferenceRand
+ inherited public methods from Inference


InferenceNonParamBootstrap$get_supported_bootstrap_pval_types()

Returns the type values compute_bootstrap_two_sided_pval() accepts.

Usage

InferenceNonParamBootstrap$get_supported_bootstrap_pval_types()


InferenceNonParamBootstrap$get_supported_bootstrap_ci_types()

Returns the type values compute_bootstrap_confidence_interval() accepts.

Usage

InferenceNonParamBootstrap$get_supported_bootstrap_ci_types()


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

B

Number of resamples. Default 501.

m

Number of exchangeable resampling units drawn with replacement. If NULL (default), use the deterministic intermediate-size rule floor(n_units^0.7), where n_units is the number of exchangeable units used by the design (observations, clusters, pairs, or matched sets). The resolved value must satisfy max(5, p_eff + 2) <= m <= floor(n_units / 2).

show_progress

A flag indicating whether a progress bar should be displayed.

debug

If TRUE, return distribution diagnostics in addition to the resampled estimates.

bootstrap_type

Optional empirical-resampling scheme. See approximate_bootstrap_distribution_beta_hat_T().

scaling

Scaling sequence for centered m-out-of-n pivots. The default "sqrt_n" uses sqrt(m) for the m-sample distribution and converts back to the full-sample scale using sqrt(n_units).

center

Centering convention for diagnostics and cache keys.

Returns

A numeric vector of bootstrap estimates, or when debug = TRUE, a diagnostic list.


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

delta

Null treatment effect. Default 0.

B

Number of resamples. Default 501.

m

Number of exchangeable units drawn with replacement. If NULL (default), use floor(n_units^0.7) subject to the validation bounds documented for approximate_m_out_of_n_bootstrap_distribution_beta_hat_T().

type

P-value type. Currently only "centered" is supported.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite resampled estimates required after filtering. Default 5.

bootstrap_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered m-out-of-n pivots.

min_fraction_usable_samples

Minimum fraction of the B resamples 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 returns NA with reason "m_out_of_n_too_few_usable_draws_fraction" and one edi_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 returns NA on many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to return NA sooner. Other classes ignore it and keep their fixed rule (at least half of the resamples finite).

Returns

A numeric two-sided p-value, or NA_real_ if the procedure fails (recorded as a failure of this procedure only; the Wald estimate and standard error are kept).


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

alpha

Significance level. Default 0.05.

B

Number of resamples. Default 501.

m

Number of exchangeable units drawn with replacement. If NULL (default), use floor(n_units^0.7) subject to the validation bounds documented for approximate_m_out_of_n_bootstrap_distribution_beta_hat_T().

type

Confidence-interval type. Currently only "basic" is supported.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite resampled estimates required after filtering. Default 5.

bootstrap_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered m-out-of-n pivots.

min_fraction_usable_samples

Minimum fraction of the B resamples 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 returns NA with reason "m_out_of_n_too_few_usable_draws_fraction" and one edi_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 returns NA on many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to return NA sooner. Other classes ignore it and keep their fixed rule (at least half of the resamples finite).

Returns

A length-2 numeric confidence interval, or c(NA_real_, NA_real_) if the procedure fails (recorded as a failure of this procedure only; the Wald estimate and standard error are kept).


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

B

Number of resamples per candidate size. Default 251.

alpha

Significance level for interval-width objectives.

m_pow_of_n_grid

Candidate exponent grid used when m_grid = NULL. Defaults to seq(0.5, 0.9, by = 0.05).

m_grid

Optional explicit integer candidate sizes.

objective

Selection objective. Currently "ci_width".

target

Target summary. Currently "ci".

volatility_window

Rolling window size used to measure local volatility across candidate sizes.

bootstrap_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered m-out-of-n pivots.

show_progress

A flag indicating whether a progress bar should be displayed.

min_finite_fraction

Minimum finite-resample fraction required for a candidate size to be eligible.

Returns

An EDIMOutOfNBootstrapMSelection list with the selected m, mapped exponent, candidate table, status, and reason.


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

B

Number of subsamples. Default 501.

b

Number of exchangeable units drawn without replacement. If NULL (default), use the deterministic intermediate-size rule floor(n_units^0.7), where n_units is the number of exchangeable units used by the design (observations, clusters, pairs, or matched sets). The resolved value must satisfy max(5, p_eff + 2) <= b <= floor(n_units / 2).

show_progress

A flag indicating whether a progress bar should be displayed.

debug

If TRUE, return distribution diagnostics in addition to the subsampled estimates.

subsampling_type

Optional empirical-resampling scheme. See approximate_bootstrap_distribution_beta_hat_T().

scaling

Scaling sequence for centered subsampling pivots. The default "sqrt_n" uses sqrt(b) for the subsample distribution and converts back to the full-sample scale using sqrt(n_units).

center

Centering convention for diagnostics and cache keys.

Returns

A numeric vector of subsampled estimates, or when debug = TRUE, a diagnostic list.


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

delta

Null treatment effect. Default 0.

B

Number of subsamples. Default 501.

b

Number of exchangeable units drawn without replacement. If NULL (default), use floor(n_units^0.7) subject to the validation bounds documented for approximate_subsampling_distribution_beta_hat_T().

type

P-value type. Currently only "centered" is supported.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite subsampled estimates required after filtering. Default 5.

subsampling_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered subsampling pivots.

min_fraction_usable_samples

Minimum fraction of the B subsamples 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 returns NA with reason "subsampling_too_few_usable_draws_fraction" and one edi_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 returns NA on many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to return NA sooner. Other classes ignore it and keep their fixed rule (at least half of the subsamples finite).

Returns

A numeric two-sided p-value, or NA_real_ if the procedure fails (recorded as a failure of this procedure only; the Wald estimate and standard error are kept).


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

alpha

Significance level. Default 0.05.

B

Number of subsamples. Default 501.

b

Number of exchangeable units drawn without replacement. If NULL (default), use floor(n_units^0.7) subject to the validation bounds documented for approximate_subsampling_distribution_beta_hat_T().

type

Confidence-interval type. Currently only "basic" is supported.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite subsampled estimates required after filtering. Default 5.

subsampling_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered subsampling pivots.

min_fraction_usable_samples

Minimum fraction of the B subsamples 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 returns NA with reason "subsampling_too_few_usable_draws_fraction" and one edi_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 returns NA on many data sets a test should reject. Lower it (down to 0) to keep more data sets, raise it to return NA sooner. Other classes ignore it and keep their fixed rule (at least half of the subsamples finite).

Returns

A length-2 numeric confidence interval, or c(NA_real_, NA_real_) if the procedure fails (recorded as a failure of this procedure only; the Wald estimate and standard error are kept).


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

B

Number of subsamples per candidate size. Default 251.

alpha

Significance level for interval-width objectives.

b_pow_of_n_grid

Candidate exponent grid used when b_grid = NULL. Defaults to seq(0.5, 0.9, by = 0.05).

b_grid

Optional explicit integer candidate sizes.

objective

Selection objective. Currently "ci_width".

target

Target summary. Currently "ci".

volatility_window

Rolling window size used to measure local volatility across candidate sizes.

subsampling_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered subsampling pivots.

show_progress

A flag indicating whether a progress bar should be displayed.

min_finite_fraction

Minimum finite-subsample fraction required for a candidate size to be eligible.

Returns

An EDISubsamplingBSelection list with the selected b, mapped exponent, candidate table, status, and reason.


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

B

Number of subsamples per candidate size. Default 251.

alpha

Significance level for interval-width objectives.

b_pow_of_n_grid

Candidate exponent grid used when b_grid = NULL. Defaults to seq(0.5, 0.9, by = 0.05).

b_grid

Optional explicit integer candidate sizes.

objective

Selection objective. Currently "ci_width".

target

Target summary. Currently "ci".

volatility_window

Rolling window size used to measure local volatility across candidate sizes.

subsampling_type

Optional empirical-resampling scheme.

scaling

Scaling sequence for centered subsampling pivots.

show_progress

A flag indicating whether a progress bar should be displayed.

min_finite_fraction

Minimum finite-subsample fraction required for a candidate size to be eligible. Defaults to 0 for sensitivity scans.

Returns

An EDISubsamplingSensitivity list containing the candidate grid table without selecting a final b.


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

B

Number of bootstrap samples. The default is 501.

show_progress

A flag indicating whether a progress bar should be displayed.

debug

If 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. Default FALSE.

bootstrap_type

Optional bootstrap-resampling scheme. Legal public values are:

NULL

Use 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, NULL maps to the same behavior as "within_blocks".

"within_blocks"

Only legal for blocking-style designs that support block-aware bootstrap resampling: DesignFixedBlocking, DesignFixedOptimalBlocks, and DesignFixedBlockedCluster. (DesignSeqOneByOneSPBR is a DesignSeqOneByOne subclass, 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-NULL value 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

delta

Null hypothesis value. Default 0.

B

Number of bootstrap samples. Default 501.

type

Bootstrap p-value type. Supported values are "percentile", "symmetric", "studentized", "bootstrap-t", and "bca". "percentile": shifts the bootstrap distribution to be centred at delta and 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-interval type in compute_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). When delta lies 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, not NA. It is NA only when the BCa adjustment itself is degenerate: on the order-statistic boundary (one edi_bootstrap_bca_boundary_warning per object) or with an unstable bias correction or acceleration (one edi_bootstrap_bca_unstable_warning per object); use type = "percentile" then. It is also NA when 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 as compute_jackknife_std_error()) or fewer than 2 finite replicates (reason "bootstrap_bca_jackknife_unavailable"), with one edi_procedure_na_warning.

na.rm

Remove 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 class edi_bootstrap_nonfinite_na_warning saying how many replicates were non-finite). The confidence-interval method always drops non-finite replicates, so it can be finite when this p-value is NA; na.rm = TRUE drops them here too, subject to min_number_usable_samples and min_fraction_usable_samples.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite bootstrap samples required after filtering. Default 5. Must be less than or equal to B.

min_fraction_usable_samples

Minimum fraction of the B replicates that must be finite when na.rm = TRUE (for the studentized types: a finite estimate and a positive finite standard error). A number in \([0, 1]\); default 0.95, which mirrors the 5% cap on invalid intervals that EDI's coverage calibration applies to confidence intervals. Below it the p-value is NA with the recorded reason "bootstrap_too_few_valid_replicates_fraction" and one edi_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. 0 turns the check off; 1 requires every replicate. Ignored when na.rm = FALSE, which already returns NA on any non-finite replicate.

Returns

A bootstrap two-sided p-value.


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

alpha

The significance level; the interval has confidence level 1 - alpha. Default 0.05.

B

Number of bootstrap samples. Default 501.

type

Bootstrap 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 in compute_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 is NA (reason "bootstrap_bca_adjustment_on_boundary", with one edi_bootstrap_bca_boundary_warning per object). B of about 501 or more is recommended for "bca"; at B of about 100 it is NA for many datasets. Use type = "percentile" when a small B is needed. The BCa interval is also NA when 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 one edi_bootstrap_bca_unstable_warning per object; a larger B does not help there, use type = "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 as compute_jackknife_std_error()) the interval is NA (reason "bootstrap_bca_jackknife_too_few_deletion_units"; with fewer than 2 finite replicates, "bootstrap_bca_jackknife_unavailable") with one edi_procedure_na_warning. Each such NA raises only that one warning.

na.rm

Remove non-finite bootstrap replicates. Default TRUE. Non-finite replicates are always removed internally.

show_progress

Show progress bar.

min_number_usable_samples

Minimum number of finite bootstrap samples required after filtering. Default 5. Must be less than or equal to B.

Returns

A bootstrap confidence interval.


InferenceNonParamBootstrap$clone()

The objects of this class are cloneable with this method.

Usage

InferenceNonParamBootstrap$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.