View source: R/aib_bootstrap.R
| aib_bootstrap | R Documentation |
Resamples whole unit histories with replacement and recomputes every audit component already present in the object: the gap trajectory and cumulative burden ([AIBias::aib_describe()]), the pooled recovery and retention gaps ([AIBias::aib_transition()]), the amplification index ([AIBias::aib_amplify()]) and the gap decomposition ([AIBias::aib_decompose()]). Each replicate reuses the reference group, weights, pairing rule, sign convention and sparse-cell threshold stored in the object.
aib_bootstrap(
object,
B = 500,
conf = 0.95,
ref_group = NULL,
seed = NULL,
verbose = TRUE
)
object |
An 'aibias' object with at least one of '$bias', '$transitions', '$amplification' or '$decomposition' populated. |
B |
Integer. Number of bootstrap replicates. Default 500. |
conf |
Numeric. Confidence level. Default 0.95. |
ref_group |
Character or NULL. Reference group. If NULL (default), uses the reference group stored by the earlier steps. Supplying a different group than those steps used is an error. |
seed |
Integer. Random seed for reproducibility. |
verbose |
Logical. |
Units are resampled with replacement and all their occasions are kept, which preserves the dependence between a unit's decisions. Intervals are pointwise percentile intervals. A replicate can fail to produce a quantity, for example when a resample leaves a prior-state cell empty; such replicates are dropped for that quantity only, and 'n_valid' reports how many replicates remained. Treat intervals with 'n_valid' well below 'B' as unreliable.
The 'aibias' object with '$bootstrap' populated, a list with - 'ci': gap trajectory intervals ('group', 'time', 'B_raw', 'B_lo', 'B_hi'), as in earlier versions - 'intervals': one row per reported quantity, with columns 'component', 'group', 'time', 'quantity', 'estimate', 'lo', 'hi', 'se', 'n_valid' - 'boot_draws': replicate values of the gap trajectory - 'B', 'conf', 'ref_group'
data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved",
verbose = FALSE)
obj <- aib_describe(obj, ref_group = "White", verbose = FALSE)
obj <- aib_decompose(obj, ref_group = "White", verbose = FALSE)
obj <- aib_bootstrap(obj, B = 100, seed = 42)
head(obj$bootstrap$intervals)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.