
Bayesian Bootstrap-capable Inference
Source:R/inference_all_abstract_bayesian_bootstrap.R
InferenceBayesianBootstrap.RdAbstract class for Dirichlet-weight Bayesian bootstrap inference layered on top of the existing nonparametric bootstrap infrastructure.
Super classes
Inference -> InferenceResamplingCore -> InferenceRand -> InferenceRandCI -> InferenceNonParamBootstrap -> InferenceRandBootstrap -> InferenceRandBootstrapCI -> InferenceBayesianBootstrap
Methods
Public methods
InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_pval_types()InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_ci_types()InferenceBayesianBootstrap$compute_estimate_with_bootstrap_weights()InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T()InferenceBayesianBootstrap$compute_bayesian_bootstrap_two_sided_pval()InferenceBayesianBootstrap$compute_bayesian_bootstrap_confidence_interval()
+ inherited public methods from InferenceRandBootstrapCI
+ inherited public methods from InferenceRandBootstrap
+ inherited public methods from InferenceNonParamBootstrap
InferenceNonParamBootstrap$approximate_bootstrap_distribution_beta_hat_T()InferenceNonParamBootstrap$approximate_m_out_of_n_bootstrap_distribution_beta_hat_T()InferenceNonParamBootstrap$approximate_subsampling_distribution_beta_hat_T()InferenceNonParamBootstrap$compute_bootstrap_confidence_interval()InferenceNonParamBootstrap$compute_bootstrap_two_sided_pval()InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_confidence_interval()InferenceNonParamBootstrap$compute_m_out_of_n_bootstrap_two_sided_pval()InferenceNonParamBootstrap$compute_subsampling_confidence_interval()InferenceNonParamBootstrap$compute_subsampling_sensitivity()InferenceNonParamBootstrap$compute_subsampling_two_sided_pval()InferenceNonParamBootstrap$get_supported_bootstrap_ci_types()InferenceNonParamBootstrap$get_supported_bootstrap_pval_types()InferenceNonParamBootstrap$select_optimal_b_subsampling()InferenceNonParamBootstrap$select_optimal_m_out_of_n_bootstrap()+ 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()
InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_pval_types()
Returns the type values
compute_bayesian_bootstrap_two_sided_pval() accepts.
InferenceBayesianBootstrap$get_supported_bayesian_bootstrap_ci_types()
Returns the type values
compute_bayesian_bootstrap_confidence_interval() accepts.
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_weightsNumeric 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_onlyIf
TRUE, compute only the point 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
BNumber of Bayesian-bootstrap replicates. 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.weighting_unit_typeOptional Bayesian-bootstrap weighting-unit scheme. Legal public values are:
NULLUse the design's default weighting-unit logic. For ordinary non-blocking designs this is the usual subject-level Bayesian 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 weighting:
DesignFixedBlocking,DesignFixedOptimalBlocks,DesignSeqOneByOneSPBR, andDesignFixedBlockedCluster. 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-
NULLvalue 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
deltaNull hypothesis value. Default 0.
BNumber of Bayesian-bootstrap replicates. Default 501.
typeType of Bayesian-bootstrap p-value. Supported values are
"percentile"(default),"symmetric","wald","studentized"/"bootstrap-t"(pivots by replicate SE fromcompute_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\) whendeltalies outside every BCa interval (for example outside the range of the draws), andNAonly when the BCa adjustment 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). It is alsoNAwhen the Bayesian jackknife has fewer than 5 weighting units (e.g. 4 blocks withweighting_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 oneedi_procedure_na_warning.na.rmIf
TRUE, discard non-finite bootstrap replicates before computing the p-value. DefaultFALSE, in which case any non-finite replicate returnsNA(with a once-per-object warning of classedi_bootstrap_nonfinite_na_warningsaying 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 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 Bayesian-bootstrap replicates required after filtering. Default 5.
weighting_unit_typeOptional Bayesian-bootstrap weighting-unit scheme. See
InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T().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"bayesian_bootstrap_too_few_valid_replicates_fraction"and oneedi_procedure_na_warning(silent inside an outer resampling operation).0turns the check off;1requires every replicate. Ignored whenna.rm = FALSE.
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
alphaSignificance level. Default 0.05.
BNumber of Bayesian-bootstrap replicates. Default 501.
typeType of Bayesian-bootstrap interval. Supported values are
"percentile"(default),"basic","wald","studentized"/"bootstrap-t"(pivots by replicate SE fromcompute_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 isc(NA, NA)(reason"bayesian_bootstrap_bca_adjustment_on_boundary", oneedi_bootstrap_bca_boundary_warningper object); usetype = "percentile"for small B. It is alsoc(NA, NA)when the bias correction or acceleration is unstable (reason"bayesian_bootstrap_bca_unstable_bias_or_acceleration", oneedi_bootstrap_bca_unstable_warningper object; a larger B does not help, usetype = "percentile"). It isc(NA, NA)as well when the Bayesian jackknife has fewer than 5 weighting units (the same minimum ascompute_jackknife_std_error(); reason"bayesian_bootstrap_bca_jackknife_too_few_deletion_units") or fewer than 2 finite replicates ("bayesian_bootstrap_bca_jackknife_unavailable"), with oneedi_procedure_na_warning. Each suchNAraises only that one warning.na.rmIf
TRUE(default), discard non-finite bootstrap replicates before constructing the interval.show_progressA flag indicating whether a progress bar should be displayed.
min_number_usable_samplesMinimum number of finite Bayesian-bootstrap replicates required after filtering. Default 5.
weighting_unit_typeOptional Bayesian-bootstrap weighting-unit scheme. See
InferenceBayesianBootstrap$approximate_bayesian_bootstrap_distribution_beta_hat_T().