Skip to contents

Abstract class for Dirichlet-weight Bayesian bootstrap inference layered on top of the existing nonparametric bootstrap infrastructure.

Methods

+ inherited public methods from InferenceRandBootstrapCI
+ inherited public methods from InferenceRandBootstrap
+ inherited public methods from InferenceNonParamBootstrap
+ inherited public methods from InferenceRandCI
+ inherited public methods from InferenceRand
+ inherited public methods from Inference


InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_pval_types()

Returns the type values compute_bayesian_bootstrap_two_sided_pval() accepts.

Usage

InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_pval_types()


InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_ci_types()

Returns the type values compute_bayesian_bootstrap_confidence_interval() accepts.

Usage

InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_ci_types()


InferenceBayesianBootstrap$compute_estimate_with_bootstrap_weights()

Recomputes the treatment estimate under Bayesian-bootstrap subject-, block-, cluster-, or matched-set weights.

This is an abstract hook implemented by concrete inference families that support weighted re-estimation.

Usage

InferenceBayesianBootstrap$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Numeric Bayesian-bootstrap weights at the design's exchangeable resampling unit. For ordinary designs these are subject-level weights. For blocking, clustering, or matching designs these may instead be block-, cluster-, pair-, or matched-set-level weights, depending on weighting_unit_type.

estimate_only

If TRUE, compute only the point estimate for the weighted replicate.

Returns

A numeric treatment-effect estimate for the weighted replicate.


InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T()

Creates the Bayesian-bootstrap distribution of the treatment estimate using Dirichlet weights.

Usage

InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T(
  B = 501,
  show_progress = TRUE,
  debug = FALSE,
  weighting_unit_type = NULL
)

Arguments

B

Number of Bayesian-bootstrap replicates. 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.

weighting_unit_type

Optional Bayesian-bootstrap weighting-unit scheme. Legal public values are:

NULL

Use the design's default weighting-unit logic. For ordinary non-blocking designs this is the usual subject-level Bayesian 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 weighting: DesignFixedBlocking, DesignFixedOptimalBlocks, DesignSeqOneByOneSPBR, and DesignFixedBlockedCluster. Draws Dirichlet weights on observational units within each observed block/stratum. For blocked cluster designs this means cluster-within-stratum weights.

"resample_blocks"

Only legal for the same blocking-style designs as "within_blocks". Draws Dirichlet weights on whole observed blocks/strata rather than on 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 Bayesian-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.


InferenceBayesianBootstrap$compute_bayesian_bootstrap_two_sided_pval()

Computes a Bayesian-bootstrap-based two-sided p-value for the treatment effect.

Usage

InferenceBayesianBootstrap$compute_bayesian_bootstrap_two_sided_pval(
  delta = 0,
  B = 501,
  type = NULL,
  na.rm = FALSE,
  show_progress = TRUE,
  min_number_usable_samples = 5L,
  weighting_unit_type = NULL,
  min_fraction_usable_samples = 0.95
)

Arguments

delta

Null hypothesis value. Default 0.

B

Number of Bayesian-bootstrap replicates. Default 501.

type

Type of Bayesian-bootstrap p-value. Supported values are "percentile" (default), "symmetric", "wald", "studentized" / "bootstrap-t" (pivots by replicate SE from compute_estimate_with_bootstrap_weights(..., estimate_only = FALSE)), and "bca" (bias-corrected and accelerated via leave-one-unit-out Bayesian jackknife). The "bca" p-value is the floor \(2/B\) when delta lies outside every BCa interval (for example outside the range of the draws), and NA only when the BCa adjustment 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). It is also NA when the Bayesian jackknife has fewer than 5 weighting units (e.g. 4 blocks with weighting_unit_type = "resample_blocks"; reason "bayesian_bootstrap_bca_jackknife_too_few_deletion_units") or fewer than 2 finite replicates ("bayesian_bootstrap_bca_jackknife_unavailable"), with one edi_procedure_na_warning.

na.rm

If TRUE, discard non-finite bootstrap replicates before computing the p-value. Default FALSE, in which case any non-finite replicate returns 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 drops non-finite replicates by default, 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 Bayesian-bootstrap replicates required after filtering. Default 5.

weighting_unit_type

Optional Bayesian-bootstrap weighting-unit scheme. See InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T().

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 "bayesian_bootstrap_too_few_valid_replicates_fraction" and one edi_procedure_na_warning (silent inside an outer resampling operation). 0 turns the check off; 1 requires every replicate. Ignored when na.rm = FALSE.

Returns

A numeric two-sided p-value, or NA_real_ if too few usable replicates remain or the estimate is non-finite.


InferenceBayesianBootstrap$compute_bayesian_bootstrap_confidence_interval()

Computes a Bayesian-bootstrap confidence interval for the treatment effect.

Usage

InferenceBayesianBootstrap$compute_bayesian_bootstrap_confidence_interval(
  alpha = 0.05,
  B = 501,
  type = NULL,
  na.rm = TRUE,
  show_progress = TRUE,
  min_number_usable_samples = 5L,
  weighting_unit_type = NULL
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of Bayesian-bootstrap replicates. Default 501.

type

Type of Bayesian-bootstrap interval. Supported values are "percentile" (default), "basic", "wald", "studentized" / "bootstrap-t" (pivots by replicate SE from compute_estimate_with_bootstrap_weights(..., estimate_only = FALSE)), and "bca" (bias-corrected and accelerated via leave-one-unit-out Bayesian jackknife). As for the nonparametric bootstrap, "bca" needs B of about 501 or more: at small B the adjusted tail probabilities fall within two order statistics of the ends of the bootstrap distribution and the interval is c(NA, NA) (reason "bayesian_bootstrap_bca_adjustment_on_boundary", one edi_bootstrap_bca_boundary_warning per object); use type = "percentile" for small B. It is also c(NA, NA) when the bias correction or acceleration is unstable (reason "bayesian_bootstrap_bca_unstable_bias_or_acceleration", one edi_bootstrap_bca_unstable_warning per object; a larger B does not help, use type = "percentile"). It is c(NA, NA) as well when the Bayesian jackknife has fewer than 5 weighting units (the same minimum as compute_jackknife_std_error(); reason "bayesian_bootstrap_bca_jackknife_too_few_deletion_units") or fewer than 2 finite replicates ("bayesian_bootstrap_bca_jackknife_unavailable"), with one edi_procedure_na_warning. Each such NA raises only that one warning.

na.rm

If TRUE (default), discard non-finite bootstrap replicates before constructing the interval.

show_progress

A flag indicating whether a progress bar should be displayed.

min_number_usable_samples

Minimum number of finite Bayesian-bootstrap replicates required after filtering. Default 5.

weighting_unit_type

Optional Bayesian-bootstrap weighting-unit scheme. See InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T().

Returns

A length-2 numeric confidence interval. Returns c(NA_real_, NA_real_) when the estimate is non-finite or too few usable replicates remain.


InferenceBayesianBootstrap$clone()

The objects of this class are cloneable with this method.

Usage

InferenceBayesianBootstrap$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.