Add BCa-at-scale section to quantiles user guide#30
Merged
Conversation
Derives the closed-form jackknife for the q-th order-statistic
quantile (two-valued: X_{(k')} for ranks above k', X_{(k'+1)} for
ranks at or below) and the resulting closed-form acceleration
a_hat = (2k' - n) / (6 * sqrt(n * k' * (n - k'))).
Data dependence cancels via affine invariance, leaving an
expression that depends only on n and q. Numerical agreement with
bootstrap_stat.jackknife_values is exact to floating-point
precision across n = 200 to 100,000.
Pairing this with the index-trick bootstrap and passing both
through the existing theta_star= / jv= hooks on bcanon_interval
gives a BCa pipeline with no resampling and no jackknife, mirroring
the zero-inflated pattern. Updated the caveats section accordingly.
https://claude.ai/code/session_01CRkE1qgfLrZz9oxcfA2Msu
The validation table established correctness; this records the speedup. At n=200,000, B=500: library default ~5 min (99%+ in the jackknife), theta_star + closed-form jv ~35 ms — roughly 10,000x. Pairs naturally with the algebraic argument that BCa decomposes into two independently-acceleratable steps. https://claude.ai/code/session_01CRkE1qgfLrZz9oxcfA2Msu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #29. Extends
docs/user_guides/quantiles_at_scale.rstwith a "BCa intervals at scale" section that closes the BCa loop the previous guide left open.The previous guide showed how to bypass the bootstrap loop for sample quantiles via the
Bin(n+1, q)index trick, but punted on BCa: the jackknife step isO(n)statistic evaluations and dominates at largen. This section derives a closed-form jackknife and a closed-form acceleration that eliminate that step entirely.What's in the new section
Closed-form
jv. Removing observationX_ieither leaves the leave-one-out quantile atX_{(k')}or shifts it toX_{(k'+1)}depending on whetherX_i's rank is above or at-or-belowk' = ceil((n-1) q). Two distinct values across the entire jackknife array; no statistic evaluations.Closed-form
a_hat. Plugging the two-valued jv into the BCa acceleration sum, the data-dependence δ³ cancels via affine invariance, leavingDepends only on
nandq. Falls out: median ⇒a_hat = 0(BCa→BC),|a_hat|grows for tail quantiles,a_hat = O(1/sqrt(n))so BCa→percentile asymptotically.Validation table. Closed-form
a_hatagrees withbootstrap_stat.jackknife_valuesto 6 decimals atn = 200, 1000, 10000, 100000(verified empirically before drafting).General-principle subsection ties the two-hook BCa pattern back to
zero_inflated.rst: same recipe (splittheta_starandjv, exploit structure on each axis), different exploitable structure (linearity vs. ranks).Caveats updated to drop the obsolete "BCa is out of scope" paragraph and replace it with a note about matching the quantile convention (
method='inverted_cdf') across the bootstrap, observedq_hat, and jackknife.Test plan
cd docs && uv run make htmlbuilds cleanly (4 unrelated intersphinx warnings from sandbox).jvmatchesjackknife_values()exactly atn ∈ {200, 1000, 10000, 100000}; closed-forma_hatmatches both to 6 decimals.^^^^underline depth as the rest of the guide, but worth a glance.https://claude.ai/code/session_01CRkE1qgfLrZz9oxcfA2Msu
Generated by Claude Code