A report can preserve exactly the same mean difference while changing the probability law used to describe its uncertainty. That is the failure boundary in this review.
The fixture has four synthetic matched pairs. Its statistic never changes: mean(y - x). The source mean is always 3/2. What changes is whether a bootstrap draw keeps the two measurements from the same approved source unit together. A shared-index bootstrap can only produce means between 1 and 2; independently resampling the two margins can produce means from -29 through 32. Both schemes leave the original observed mean untouched.
This article is a software-semantics audit for practicing data scientists, analytics engineers, and reviewers of numerical reports. It uses SciPy 1.16.2 as the versioned API and implementation baseline, NumPy 2.3 documentation, and a compatible Python 3.12 interpreter as the proposed execution environment. No fixture execution is claimed here: runtime fields, traces, random endpoints, package patch versions, build details, warnings, source digest, and platform observations remain EXPECTED / NOT EXECUTED.
The workflow starts with source IDs rather than arrays, derives two exact finite bootstrap laws independently of SciPy, instruments scipy.stats.bootstrap, deliberately breaks row correspondence, repairs it by trusted IDs, and closes with a ten-case evidence ledger. The release decision is therefore not “the interval looks plausible.” It is whether the retained evidence supports ACCEPT_MECHANICS, a repaired replacement artifact, or a hold for execution, provenance, or design.
1. Declare the mean-difference and sampling-unit contract
The analysis contract is deliberately narrow. For retained source pair i, let x_i and y_i be two measurements with an approved one-to-one correspondence. The fixed statistic is
T(x, y) = [sum of (y_i − x_i) for i = 1 to n] / n.
NIST describes paired observations in the same structural way: the i-th observation from one sample is naturally paired with the i-th observation from the other, and the differences become the derived measurements. That definition supports the identity contract used here; this article does not import NIST's subsequent t-test procedure or treat it as validation of a bootstrap interval.
Each retained source record needs two identities with different jobs. pair_id authenticates which left and right measurements belong together. independent_unit_id states which unit is assumed independent of the others for this teaching wrapper. Those are not interchangeable fields. A pair can be perfectly matched internally while two different pairs still share a subject, instrument, household, batch, or other dependence source.
Dimensional checks are a prerequisite, not the main problem. Refonte Learning's paired loss shape validation shows why equal-looking numerical results cannot substitute for verifying the observation structure. That earlier workflow targets broadcasting and residual shape; this one begins after both arrays are already one-dimensional float64.
Distinguish matched pairs from independent units
For this synthetic exercise, the declared teaching design is four IID pairs: each pair has exactly one left measurement, one right measurement, one unique pair_id, and one distinct declared independent-unit identifier. That declaration is an input to the analysis, not something SciPy discovers.
A unique pair_id therefore proves, at most, that the software has a distinct label for a row-level correspondence. It cannot prove that source units were independently sampled. The fixture can reject an obvious contradiction (for example, A and B explicitly declaring the same higher-level unit), but it cannot infer hidden clustering from four labels.
This distinction becomes important later. paired=True is capable of preserving positions. It does not authenticate the identities placed at those positions, and it does not certify that different positions are statistically independent.
2. Read what the paired flag actually controls
The SciPy 1.16.2 public signature sets paired=False by default. Its parameter documentation is unusually direct: when paired=True, bootstrap resamples one array of indices and applies the same indices to all input samples; otherwise it resamples the samples independently.
That is the operational meaning of a SciPy paired bootstrap in this article. It is positional index reuse. It is not an identity join.
The tagged SciPy 1.16.2 implementation shows the same boundary. In paired mode, SciPy checks that sample lengths match, wraps the supplied statistic so an index sample is applied to every data array, and then bootstraps the index array. In the general resampling loop, each sample in data is otherwise passed through the bootstrap resampler, which generates replacement indices and forms a resampled sample. These implementation details describe the pinned tag; they should not be promoted into an undocumented guarantee for unrelated SciPy releases.
This diagnostic passes method='percentile' explicitly. The choice is intentional only because it makes the returned interval a direct quantile summary of the generated bootstrap distribution; the article is not recommending percentile intervals generally. SciPy's 1.16.2 page documents percentile, basic, and BCa methods. There is also a documentation inconsistency worth recording: the two-sample example prose says it uses the percentile method, but its displayed call specifies method='basic'. The fixture therefore follows the parameter definition and tagged implementation rather than relying on that sentence.
The research baseline is also intentionally pinned rather than described as “latest.” SciPy 1.16.0 states support for Python 3.11–3.13 and NumPy 1.25.2 or later, so a compatible Python 3.12 interpreter with NumPy 2.3 is within that documented range. SciPy 1.16.2 is documented as a bug-fix release with no new features relative to 1.16.1; neither paired nor the RNG interface is a new 2026 capability.
The primary technical sources for this review are the SciPy 1.16.2 bootstrap reference, the tagged 1.16.2 resampling implementation, the NIST paired-observation definition, and NumPy's random compatibility policy and numpy.std reference.
3. Freeze four source pairs before constructing arrays
The source manifest is the evidence anchor. Arrays are derived artifacts.
Pair ID | Independent unit | x | y | y - x |
A | UA | 0 | 1 | 1 |
B | UB | 10 | 12 | 2 |
C | UC | 20 | 21 | 1 |
D | UD | 30 | 32 | 2 |
All records are synthetic. In canonical left-ID order A, B, C, D,
x = [0, 10, 20, 30]
y = [1, 12, 21, 32]
d = [1, 2, 1, 2]so
mean(d) = (1 + 2 + 1 + 2) / 4 = 3/2.Preserve those records separately from the arrays. A numerical vector such as [0., 10., 20., 30.] does not contain the claim that position two is source B. Once provenance has been discarded, a later interval cannot recreate it.
This is related to, but distinct from, the problem of identifying source rows behind pairwise correlations. That workflow asks which rows survived pairwise missing-data rules. Here every baseline record is complete. The defect under investigation occurs later, when a resampling operation may separate measurements that were originally approved as a pair.
Authenticate IDs before creating arrays
The guarded path should admit records in this order:
Require exactly four records on each side for this teaching fixture.
Require nonempty, unique pair IDs on each side before constructing any dictionary.
Require exact equality of left and right pair-ID sets.
Require nonempty independent-unit metadata and agreement of that metadata for the same pair.
Require distinct declared independent units across retained pairs for this IID-pair wrapper.
Require finite measurements.
Align the right records to canonical left-ID order.
Construct one-dimensional np.float64 arrays and confirm their shape.
The “exactly four,” one-dimensional, and float64 restrictions belong to this fixture, not to SciPy's general API.
Checking duplicates before dictionary creation matters because {record.id: record} silently collapses repeated keys. Likewise, alignment must use authenticated IDs. Sorting measurements, nearest-value matching, or choosing the alignment that produces convenient differences would change the source contract after observing the data.
B07, B08, B09, and B10 later test this admission boundary. Their expected outcome is rejection before SciPy is called.
4. Derive the exact paired bootstrap distribution
The independent oracle uses only Python integers, itertools.product, Counter, and Fraction. It does not call SciPy and does not require random numbers.
For a paired bootstrap of four observations, an ordered bootstrap draw is an index tuple
(i_1, i_2, i_3, i_4) ∈ {0, 1, 2, 3}^4.
The same tuple indexes both sides. There are 4^4 = 256 equally probable ordered sequences.
The original paired differences are [1,2,1,2]. Each bootstrap statistic is therefore the mean of four draws from an empirical distribution containing two 1s and two 2s. If K is the number of selected positions whose difference is 2, then
T* = 1 + K/4.
For K = 0, 1, 2, 3, 4, the possible means and multiplicities are:
Exact bootstrap mean | Multiplicity | Probability |
1 | 16 | 1/16 |
5/4 | 64 | 1/4 |
3/2 | 96 | 3/8 |
7/4 | 64 | 1/4 |
2 | 16 | 1/16 |
The exact finite-law mean is
E(T*) = 3/2.
The empirical difference distribution has variance 1/4, and an average of four IID draws from that finite empirical law therefore has variance
Var(T*) = (1/4)/4 = 1/16.
The harness below also calculates the same value directly from exact Fraction weights rather than relying on that shortcut.
Count ordered draws rather than distinct value patterns
The multiplicities are part of the law. There are many more index sequences producing 3/2 than producing 1. Treating the five possible means as five equally weighted outcomes would be a different probability distribution.
Repeated IDs inside a bootstrap resample are normal. A draw such as (A, A, D, B) is permitted because bootstrap sampling is with replacement. That is fundamentally different from duplicate IDs in the original source manifest. The former is generated sampling behavior; the latter makes source identity ambiguous before sampling starts.
Everything in this section is an analytical derivation, not a runtime observation. B01 is therefore allowed to establish an exact oracle while the overall SciPy commissioning status remains EXPECTED / NOT EXECUTED.
5. Contrast the independent law without changing the original mean
Now keep the same source arrays and the same statistic but draw an x-index tuple and a y-index tuple independently.
Each margin has 4^4 = 256 ordered bootstrap samples, so the product law has
256^2 = 65,536
equally probable combinations.
The original statistic is still
mean(y) − mean(x) = 16.5 − 15 = 1.5.
The mean of the independent bootstrap law is also 3/2. That agreement is precisely why checking only the point estimate is inadequate.
Its support is radically different. The smallest possible result selects x=30 four times and y=1 four times:
1 − 30 = −29.
The largest selects x=0 four times and y=32 four times:
32 − 0 = 32.
A literal upper-end witness is therefore
x indices = (0, 0, 0, 0)
y indices = (3, 3, 3, 3)
statistic = 32
No correctly aligned paired draw can produce that result because every true paired difference is either 1 or 2.
The population variance of the four x empirical values is 125. For y it is 521/4. The variance of a four-draw sample mean is one quarter of each marginal variance. Independent resampling removes the paired covariance contribution, so
Var(mean(Y*) − mean(X*)) = 125/4 + (521/4)/4 = 500/16 + 521/16 = 1021/16.
Compare that with 1/16 for the shared-index law.
The phrase paired vs unpaired bootstrap can therefore hide a large structural difference. Here the paired empirical law resamples the four observed differences. The independent law resamples from the product of the two marginal empirical distributions, creating synthetic x/y combinations that were never approved source pairs.
Independent resampling is not defective in itself. It can be appropriate for a genuinely independent-sample design. B02 rejects it only because the declared design for this fixture is matched pairs.
6. Instrument a bounded SciPy reproduction
The proposed run uses SciPy 1.16.2, NumPy 2.3, and a compatible Python 3.12 interpreter. It must record the actual Python patch version, NumPy and SciPy patch versions, platform, build-relevant metadata that is available, and the actual NumPy generator/bit generator. None of those runtime observations has been captured for this article.
NumPy's reproducibility guidance is stricter than “same seed.” Stream reproduction depends on the same bit generator, seed, sequence of calls and arguments, NumPy build, environment, and machine; even requested block size is part of the conditions. That is why every comparison below creates a fresh np.random.default_rng(20261201) rather than relying on a generator whose prior consumption is unknown.
The fixed SciPy arguments are:
n_resamples=512
batch=128
vectorized=False
axis=0
confidence_level=0.95
alternative='two-sided'
method='percentile'
bootstrap_result=NoneThe complete runnable fixture follows. It is authored evidence code, EXPECTED / NOT EXECUTED in this article.
#!/usr/bin/env python3
from __future__ import annotations
from collections import Counter
from dataclasses import asdict, dataclass
from fractions import Fraction
from hashlib import sha256
from itertools import product
import json
import platform
from pathlib import Path
import sys
import warnings
import numpy as np
import scipy
from scipy.stats import bootstrap
SEED = 20261201
N_RESAMPLES = 512
BATCH = 128
BOOTSTRAP_KW = dict(
n_resamples=N_RESAMPLES,
batch=BATCH,
vectorized=False,
axis=0,
confidence_level=0.95,
alternative="two-sided",
method="percentile",
bootstrap_result=None,
)
BOOTSTRAP_CALLS = 0
@dataclass(frozen=True)
class SideRecord:
pair_id: str
independent_unit_id: str
value: float
LEFT_BASELINE = (
SideRecord("A", "UA", 0.0),
SideRecord("B", "UB", 10.0),
SideRecord("C", "UC", 20.0),
SideRecord("D", "UD", 30.0),
)
RIGHT_BASELINE = (
SideRecord("A", "UA", 1.0),
SideRecord("B", "UB", 12.0),
SideRecord("C", "UC", 21.0),
SideRecord("D", "UD", 32.0),
)
def source_digest() -> str:
return sha256(Path(__file__).read_bytes()).hexdigest()
def environment_record() -> dict:
probe = np.random.default_rng(SEED)
return {
"python_version": sys.version,
"python_implementation": platform.python_implementation(),
"numpy_version": np.__version__,
"scipy_version": scipy.__version__,
"platform": platform.platform(),
"machine": platform.machine(),
"processor": platform.processor(),
"generator_type": type(probe).__name__,
"bit_generator_type": type(probe.bit_generator).__name__,
"seed": SEED,
}
def require_unique_nonempty_ids(records, side: str) -> None:
ids = [r.pair_id for r in records]
if any(not isinstance(i, str) or not i.strip() for i in ids):
raise ValueError(f"{side}: pair IDs must be nonempty strings")
if len(ids) != len(set(ids)):
raise ValueError(f"{side}: duplicate pair ID")
def admit_and_align(left, right):
if len(left) != 4 or len(right) != 4:
raise ValueError("fixture requires exactly four records per side")
# Must happen before dictionary construction.
require_unique_nonempty_ids(left, "left")
require_unique_nonempty_ids(right, "right")
left_ids = [r.pair_id for r in left]
right_ids = [r.pair_id for r in right]
if set(left_ids) != set(right_ids):
missing = sorted(set(left_ids) - set(right_ids))
extra = sorted(set(right_ids) - set(left_ids))
raise ValueError(f"ID-set mismatch: missing={missing}, extra={extra}")
if any(not r.independent_unit_id for r in (*left, *right)):
raise ValueError("independent-unit metadata must be nonempty")
right_by_id = {r.pair_id: r for r in right}
aligned_right = tuple(right_by_id[i] for i in left_ids)
for lrec, rrec in zip(left, aligned_right):
if lrec.independent_unit_id != rrec.independent_unit_id:
raise ValueError(f"unit metadata mismatch for {lrec.pair_id}")
units = [r.independent_unit_id for r in left]
if len(units) != len(set(units)):
raise ValueError("IID-pair wrapper requires distinct declared units")
values = [r.value for r in (left, *aligned_right)]
if not all(np.isfinite(v) for v in values):
raise ValueError("all measurements must be finite")
x = np.asarray([r.value for r in left], dtype=np.float64)
y = np.asarray([r.value for r in aligned_right], dtype=np.float64)
if x.ndim != 1 or y.ndim != 1 or x.shape != (4,) or y.shape != (4,):
raise ValueError("fixture arrays must be one-dimensional length four")
if x.dtype != np.float64 or y.dtype != np.float64:
raise TypeError("fixture arrays must be float64")
return tuple(left), aligned_right, x, y
def paired_oracle(x_int, y_int):
counts = Counter()
for idx in product(range(4), repeat=4):
total = sum(y_int[i] - x_int[i] for i in idx)
counts[Fraction(total, 4)] += 1
total_mass = sum(counts.values())
mean = sum(v * c for v, c in counts.items()) / total_mass
variance = (
sum((v - mean) ** 2 * c for v, c in counts.items()) / total_mass
)
return counts, mean, variance
def independent_oracle(x_int, y_int):
counts = Counter()
x_draws = list(product(range(4), repeat=4))
y_draws = list(product(range(4), repeat=4))
for xi in x_draws:
xsum = sum(x_int[i] for i in xi)
for yi in y_draws:
ysum = sum(y_int[i] for i in yi)
counts[Fraction(ysum - xsum, 4)] += 1
total_mass = sum(counts.values())
mean = sum(v * c for v, c in counts.items()) / total_mass
variance = (
sum((v - mean) ** 2 * c for v, c in counts.items()) / total_mass
)
return counts, mean, variance
def make_traced_statistic(x_value_to_id, y_value_to_id, trace):
def statistic(a, b):
a = np.asarray(a, dtype=np.float64)
b = np.asarray(b, dtype=np.float64)
if a.ndim != 1 or b.ndim != 1:
raise AssertionError("callback expected one-dimensional samples")
x_ids = [x_value_to_id[float(v)] for v in a]
y_ids = [y_value_to_id[float(v)] for v in b]
matches = [i == j for i, j in zip(x_ids, y_ids)]
value = float(np.mean(b - a))
trace.append({
"x_values": a.tolist(),
"y_values": b.tolist(),
"x_ids": x_ids,
"y_ids": y_ids,
"position_matches": matches,
"statistic": value,
})
return value
return statistic
def run_raw(left, right, paired_mode):
global BOOTSTRAP_CALLS
BOOTSTRAP_CALLS += 1
x = np.asarray([r.value for r in left], dtype=np.float64)
y = np.asarray([r.value for r in right], dtype=np.float64)
# Diagnostic shortcut only: valid because values are unique per side.
x_map = {float(r.value): r.pair_id for r in left}
y_map = {float(r.value): r.pair_id for r in right}
if len(x_map) != 4 or len(y_map) != 4:
raise AssertionError("diagnostic value-to-ID map requires unique values")
trace = []
statistic = make_traced_statistic(x_map, y_map, trace)
rng = np.random.default_rng(SEED)
kwargs = dict(BOOTSTRAP_KW)
kwargs["rng"] = rng
if paired_mode != "omitted":
kwargs["paired"] = paired_mode
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
result = bootstrap((x, y), statistic, **kwargs)
returned = np.asarray(result.bootstrap_distribution, dtype=np.float64)
traced = np.asarray([row["statistic"] for row in trace], dtype=np.float64)
if len(trace) != N_RESAMPLES:
raise AssertionError(f"trace length {len(trace)} != {N_RESAMPLES}")
# Reconcile as a multiset, not as a public callback-order guarantee.
np.testing.assert_array_equal(np.sort(traced), np.sort(returned))
np.testing.assert_allclose(
result.standard_error,
np.std(returned, ddof=1),
rtol=0.0,
atol=0.0,
)
return {
"paired_mode": paired_mode,
"distribution": returned.tolist(),
"confidence_interval": [
float(result.confidence_interval.low),
float(result.confidence_interval.high),
],
"standard_error": float(result.standard_error),
"trace": trace,
"warnings": [
{
"category": type(w.message).__name__,
"message": str(w.message),
}
for w in caught
],
}
def guarded_run(left, right):
aligned_left, aligned_right, _, _ = admit_and_align(left, right)
return run_raw(aligned_left, aligned_right, paired_mode=True)
def expect_pre_call_rejection(name, left, right):
before = BOOTSTRAP_CALLS
try:
guarded_run(left, right)
except Exception as exc:
after = BOOTSTRAP_CALLS
if after != before:
raise AssertionError(f"{name}: SciPy call counter changed")
return {
"case": name,
"rejected": True,
"exception_type": type(exc).__name__,
"message": str(exc),
"bootstrap_calls_before": before,
"bootstrap_calls_after": after,
}
raise AssertionError(f"{name}: expected pre-call rejection")
def main():
evidence = {
"status": "EXECUTED_BY_SCRIPT",
"source_sha256": source_digest(),
"environment": environment_record(),
"settings": {
**BOOTSTRAP_KW,
"seed": SEED,
},
"cases": {},
}
left, right, x, y = admit_and_align(LEFT_BASELINE, RIGHT_BASELINE)
assert float(np.mean(y - x)) == 1.5
p_counts, p_mean, p_var = paired_oracle(
[0, 10, 20, 30], [1, 12, 21, 32]
)
assert sum(p_counts.values()) == 256
assert p_counts == Counter({
Fraction(1, 1): 16,
Fraction(5, 4): 64,
Fraction(3, 2): 96,
Fraction(7, 4): 64,
Fraction(2, 1): 16,
})
assert p_mean == Fraction(3, 2)
assert p_var == Fraction(1, 16)
evidence["cases"]["B01"] = {
"counts": {str(k): v for k, v in sorted(p_counts.items())},
"mean": str(p_mean),
"variance": str(p_var),
}
i_counts, i_mean, i_var = independent_oracle(
[0, 10, 20, 30], [1, 12, 21, 32]
)
assert sum(i_counts.values()) == 65536
assert min(i_counts) == Fraction(-29, 1)
assert max(i_counts) == Fraction(32, 1)
assert i_mean == Fraction(3, 2)
assert i_var == Fraction(1021, 16)
evidence["cases"]["B02"] = {
"combinations": sum(i_counts.values()),
"minimum": str(min(i_counts)),
"maximum": str(max(i_counts)),
"mean": str(i_mean),
"variance": str(i_var),
}
b03_omitted = run_raw(left, right, paired_mode="omitted")
b03_false = run_raw(left, right, paired_mode=False)
np.testing.assert_array_equal(
b03_omitted["distribution"], b03_false["distribution"]
)
evidence["cases"]["B03"] = {
"omitted": b03_omitted,
"explicit_false": b03_false,
}
b04 = guarded_run(left, right)
if not all(all(t["position_matches"]) for t in b04["trace"]):
raise AssertionError("B04 observed an ID mismatch")
if not all(1.0 <= v <= 2.0 for v in b04["distribution"]):
raise AssertionError("B04 statistic escaped exact paired support")
evidence["cases"]["B04"] = b04
reversed_right = tuple(reversed(RIGHT_BASELINE))
b05 = run_raw(LEFT_BASELINE, reversed_right, paired_mode=True)
if all(all(t["position_matches"]) for t in b05["trace"]):
raise AssertionError("B05 failed to expose source-ID mismatch")
evidence["cases"]["B05"] = b05
b06 = guarded_run(LEFT_BASELINE, reversed_right)
np.testing.assert_array_equal(b04["distribution"], b06["distribution"])
evidence["cases"]["B06"] = b06
duplicate_right = (
RIGHT_BASELINE[0],
RIGHT_BASELINE[1],
SideRecord("B", "UB", 21.0),
RIGHT_BASELINE[3],
)
evidence["cases"]["B07"] = expect_pre_call_rejection(
"B07", LEFT_BASELINE, duplicate_right
)
wrong_id_right = (
RIGHT_BASELINE[0],
RIGHT_BASELINE[1],
SideRecord("E", "UC", 21.0),
RIGHT_BASELINE[3],
)
evidence["cases"]["B08"] = expect_pre_call_rejection(
"B08", LEFT_BASELINE, wrong_id_right
)
nan_right = (
RIGHT_BASELINE[0],
RIGHT_BASELINE[1],
SideRecord("C", "UC", float("nan")),
RIGHT_BASELINE[3],
)
evidence["cases"]["B09"] = expect_pre_call_rejection(
"B09", LEFT_BASELINE, nan_right
)
clustered_left = (
SideRecord("A", "UAB", 0.0),
SideRecord("B", "UAB", 10.0),
LEFT_BASELINE[2],
LEFT_BASELINE[3],
)
clustered_right = (
SideRecord("A", "UAB", 1.0),
SideRecord("B", "UAB", 12.0),
RIGHT_BASELINE[2],
RIGHT_BASELINE[3],
)
evidence["cases"]["B10"] = expect_pre_call_rejection(
"B10", clustered_left, clustered_right
)
Path("scipy_bootstrap_pairing_evidence.json").write_text(
json.dumps(evidence, indent=2, sort_keys=True),
encoding="utf-8",
)
print(json.dumps(evidence, indent=2, sort_keys=True))
if __name__ == "__main__":
try:
main()
except Exception:
import traceback
traceback.print_exc(file=sys.stderr)
raise
Run it only in the commissioned environment and retain the command, exit status, complete stdout, stderr, warnings, generated JSON, and exact script. A suitable setup target is a Python 3.12 environment with explicitly installed SciPy 1.16.2 and the selected NumPy 2.3 patch release; the actual installed patch versions must come from the run rather than from this article.
The callback records sampled values, reconstructed IDs, per-position identity matches, and the scalar statistic. Its value-to-ID maps are intentionally a diagnostic shortcut: they work only because all four values are unique on each side. Production identity must come from source records, never from measurement magnitude.
Separate exact-law variance from the observed standard error
The exact 1/16 paired variance and 1021/16 independent variance describe fully enumerated finite probability laws. They use exact probability weights.
SciPy's standard_error, by contrast, is calculated from the particular returned random bootstrap distribution. The tagged 1.16.2 implementation computes it with np.std(theta_hat_b, ddof=1). NumPy documents that ddof=1 uses denominator N-1, whereas ddof=0 uses N. The harness therefore checks the returned value against np.std(returned_distribution, ddof=1) rather than forcing it to equal the square root of an exact finite-law variance.
That separation resembles the distinction in Refonte Learning's discussion of covariance arithmetic and uncertainty claims: a numerical uncertainty quantity can be mechanically consistent with library rules without settling whether the surrounding inferential assumptions are justified.
No Monte Carlo tolerance or confidence-interval endpoint is invented here. Those are execution evidence.
7. Reproduce the omitted and explicit independent modes
B03 answers a deceptively useful question: does omission of paired behave like explicit paired=False under this recorded configuration?
The public signature says yes at the semantic level because the default is False. The fixture goes further operationally: it creates a fresh default_rng(20261201) for each call, holds every other argument constant, and records both full distributions, traces, warnings, interval endpoints, and standard errors.
The expected evidence is:
B03 status: EXPECTED / NOT EXECUTED
omitted paired argument: same configured mode as paired=False
observed distribution equality: [UNFILLED]
observed mismatch trace: [UNFILLED]
observed interval endpoints: [UNFILLED]
warnings: [UNFILLED]For this matched-pair design, the important evidence is not merely equality between omitted and explicit-false calls. The trace should show positions in which the reconstructed x_id and y_id differ, demonstrating that independently sampled margins created unapproved correspondences.
The code does not search seeds until it finds a dramatic mismatch. Seed shopping would contaminate the diagnostic. With the predeclared seed and 512 resamples, the run either exposes the intended behavior or it does not. If a commissioning execution unexpectedly fails to produce the evidence needed to distinguish the modes, the correct state is HOLD and investigate the fixture or trace logic.
The independent mode is rejected only relative to the declared bootstrap matched-pairs design. Nothing in B03 supports a claim that paired=False is generally wrong.
8. Show why paired=True can still preserve the wrong correspondence
B04 is the positive positional control. After admission and ID-based alignment, canonical arrays are
x = [0, 10, 20, 30]
y = [1, 12, 21, 32]and paired=True should resample shared positions. Every traced slot is therefore expected to reconstruct matching IDs, and every statistic must lie in the exact support [1, 2].
B05 then creates the more important counterexample. It reverses the right-side source records while preserving their true IDs:
left IDs: A, B, C, D
right IDs: D, C, B, A
x: 0, 10, 20, 30
y: 32, 21, 12, 1Both arrays still have shape (4,). Their means are unchanged, so
mean(y) − mean(x) = 16.5 − 15 = 1.5.But the positional differences are now
[32, 11, -8, -29]whose mean is also 1.5.
This is the central software counterexample. paired=True can faithfully preserve the wrong row relationship because SciPy receives arrays, not authenticated pair identities. A shared index 0 means “take x position 0 and y position 0.” It cannot know that those source records are A and D.
The negative diagnostic deliberately bypasses the admission guard so the failure can be observed. That bypass belongs only in the test laboratory. It must not become an option in the application path.
A representative expected trace schema (not an observed log) is:
{
"x_values": [0.0, 10.0, 10.0, 30.0],
"y_values": [32.0, 21.0, 21.0, 1.0],
"x_ids": ["A", "B", "B", "D"],
"y_ids": ["D", "C", "C", "A"],
"position_matches": [false, false, false, false],
"statistic": "[COMPUTED AT EXECUTION]"
}Because the fixture has not been run, no claim is made that this exact callback record will occur under seed 20261201. It illustrates the evidence fields B05 must retain.
9. Restore approved correspondence before recomputing
Repair means restoring the approved source contract, not manipulating values until the interval looks better.
B06 begins from the same reversed right-side records used by B05, but it sends them through the guard. The guard verifies uniqueness and set equality, builds an ID lookup only after the duplicate check, and reconstructs the right side in canonical left-ID order:
left: A B C D
right: A B C DThe resulting arrays are the baseline arrays again.
The repaired bootstrap must then be recomputed with a fresh baseline generator and the declared arguments. The old bootstrap result must not be fed back through bootstrap_result. SciPy documents bootstrap_result as a way of incorporating an earlier bootstrap distribution into a later call; that feature is useful in appropriate workflows, but it would make a corrected report depend on draws generated from the disputed source state.
Under a commissioned matching environment, B06 requires observed reconciliation with B04: same aligned arrays, same declared parameters, fresh generator initialized identically, and the same retained bootstrap distribution. Until execution, that comparison remains unfilled.
If a published report is repaired, the replacement should have a distinct artifact identifier. Preserve the original report and label its status; do not overwrite it in place and erase the evidence of what was previously issued.
Reject malformed source records before invoking SciPy
The external call counter makes the guard boundary testable.
B07 repeats right-side ID B. That must fail before dictionary construction.
B08 replaces right-side ID C with E. Array lengths could still be equal, but the ID sets are not: C is missing and E is extra.
B09 makes one measurement nonfinite. This article does not define an imputation policy, so the guarded result is rejection.
For each case, the expected call-counter transition is:
bootstrap_calls_after == bootstrap_calls_beforeAn expected rejection counts as a successful control only after that rejection is actually recorded at the intended boundary. Until then B07–B09 are authored expectations, not passes.
Keeping these guarded failures separate from B05's intentional raw call is important. A negative diagnostic is allowed to violate the production contract precisely because it is fenced off from the accepted path.
10. Reconcile the complete ten-case evidence ledger
The evidence ledger separates expected outcomes from observations. Because the commissioned fixture has not been run, every runtime-dependent observed field remains unfilled and the overall state is HOLD_PENDING_EXECUTION.
Case | Required operation | Expected evidence and decision | Observed |
B01 | Admit baseline; enumerate paired law | Four valid pairs; 256 sequences; mean 3/2; variance 1/16; oracle only | Analytical oracle authored; runtime not required |
B02 | Enumerate independent law | 65,536 combinations; range [-29,32]; variance 1021/16; reject for paired design | Analytical oracle authored; runtime not required |
B03 | Omitted versus explicit False | Matching configured modes; retain actual mismatch trace; repair pairing | NOT EXECUTED |
B04 | Correct source, paired=True | Matching IDs in every sampled slot; means in [1,2]; accept mechanics only | NOT EXECUTED |
B05 | Reversed right records, raw paired call | Positional pairs conflict with source IDs; reject source pairing | NOT EXECUTED |
B06 | Align by IDs and recompute | Restored mapping; reconcile with B04; reviewed replacement candidate | NOT EXECUTED |
B07 | Duplicate right ID B | Reject before dictionary construction and SciPy; hold provenance | NOT EXECUTED |
B08 | Replace right ID C with E | Missing C and extra E despite equal lengths; zero calls; hold provenance | NOT EXECUTED |
B09 | One measurement becomes NaN | Pre-call rejection; no imputation; hold data | NOT EXECUTED |
B10 | A and B share a declared higher-level unit | IID-pair wrapper holds design before SciPy; no claim IDs prove independence | NOT EXECUTED |
The compact table is an index, not the evidence artifact itself. A commissioning package should retain every callback trace, source record, aligned record, parameter, warning, exception, returned distribution, interval endpoint, environment field, and control outcome.
B01 and B02 are different in kind from B03–B10. Their values are mathematical results obtained from finite enumeration. They are not evidence that SciPy was executed.
The distinction prevents a common review error: a correct derivation should not be relabeled as a successful runtime check, just as a successful runtime check should not be promoted into proof that the sampling design is scientifically adequate.
11. Apply acceptance criteria before releasing a result
A release decision should have explicit gates. For this fixture, ACCEPT_MECHANICS requires all of the following in the retained commissioning evidence:
source admission succeeded for the approved baseline;
B01 and B02 exact oracles reconcile with their authored known answers;
B03–B06 retain complete 512-resample traces and returned distributions;
every B04 and B06 sampled position has matching authenticated source IDs;
B03 records the independently resampled behavior rather than silently treating it as paired;
B05 demonstrates that positional pairing cannot repair reordered source identities;
the trace statistic multiset reconciles with SciPy's returned bootstrap distribution;
standard_error reconciles with np.std(distribution, ddof=1);
warnings are captured, even if the list is empty;
B07–B10 reject or hold at their intended boundaries without an unauthorized SciPy call.
That status is deliberately named ACCEPT_MECHANICS, not “validated confidence interval.”
The distinction is analogous to keeping group and row units in evaluation splits separate: software may correctly implement one unit while the analyst's intended unit is something else. In the present workflow, the accepted unit is the approved pair, not an independently selected x value and y value.
A negative control can pass while the candidate artifact remains rejected. For example, an observed B05 source-ID mismatch would mean the negative control succeeded; it would not make the reversed candidate acceptable.
Likewise, a clean B04 cannot establish sample size adequacy, population representativeness, or interval coverage for a real study. These four pairs were designed to expose software semantics, not to estimate a useful population interval.
As of this article, the release state is HOLD_PENDING_EXECUTION because the runtime evidence has not been captured.
12. Recover disputed reports from retained evidence
When a report's pairing is disputed, preserve before repairing.
Retain the original report, the source records that were available to it, pair IDs, independent-unit metadata, argument history, RNG configuration if known, software/environment records, the published interval, and any downstream documents that consumed it. Do not overwrite the original file with corrected numbers.
Then answer two separate questions.
First: can the intended source correspondence be recovered from authoritative records? A point estimate cannot answer that. Neither can a confidence interval. Multiple incompatible pairings can produce the same mean difference, as B05 demonstrates exactly.
Second: can the declared sampling design be recovered? Even perfect left/right correspondence does not tell a reviewer whether the pairs were independent units.
If both contracts are recoverable, rebuild the arrays from approved IDs and recompute the bootstrap from scratch. The replacement artifact should carry a new identifier and explain what changed: not the statistic, but the resampling law and/or source alignment used to generate its uncertainty summary.
If only the old mean and interval survive, hold. Those numbers cannot reconstruct pair identities or the random draws that produced the interval.
The old artifact remains historical evidence. Mark it superseded or withdrawn according to the reporting process, identify dependent reports, and propagate corrections explicitly rather than silently replacing a shared file.
The objective is reproducibility of the correction itself: another reviewer should be able to see the disputed source state, the authorized correspondence, the replacement source manifest, the declared scipy.stats.bootstrap arguments, and the new retained execution evidence.
13. Assign ownership and state the remaining statistical limits
Four ownership roles make the boundary clearer.
The data owner confirms what A, B, C, and D identify, where each x and y measurement came from, and whether the one-to-one correspondence is authoritative.
The statistical owner approves the statistic and the independent sampling unit. That owner decides whether an IID-pair empirical bootstrap is an appropriate design for the intended inference.
The software maintainer verifies the source guard, SciPy configuration, exact oracle reconciliation, runtime trace, warnings, environment record, and evidence retention.
The report owner controls release, supersession, and downstream correction when an artifact changes.
These roles prevent software evidence from absorbing questions it cannot answer. Broader statistical assumptions behind an interval still include how the sample relates to the population and whether the inferential design is appropriate. Refonte's statistics overview likewise distinguishes calculation from the judgment required to generalize beyond observed data.
Requalification is required when a material input to the evidence changes: source mapping, independent-unit declaration, statistic, SciPy arguments, RNG configuration, SciPy or NumPy runtime, Python runtime, build, or platform where reproducibility is claimed. NumPy explicitly conditions detailed stream reproducibility on matching generator, seed, calls, arguments, build, environment, and machine.
That is why the execution record must report actual versions rather than merely repeat the proposed baseline. “Python 3.12” is not an observed patch version. “NumPy 2.3” is not an observed build. “Seed 20261201” is not, by itself, a reproduction record.
Escalate clustered or unknown sampling designs
B10 changes A and B so both declare the same higher-level independent unit. The teaching wrapper should stop before SciPy because its design contract says one independent unit per retained pair.
That rejection is not an independence test. It catches a declared contradiction.
Unique IDs cannot prove that pairs are IID. If the records actually contain repeated subjects, device clusters, household clusters, time dependence, batch dependence, or another shared source of variability, the correct result for this article is HOLD_DESIGN.
Do not respond by quietly changing the analysis unit, inventing cluster IDs, or bolting a clustered or block bootstrap onto this fixture. Those are different sampling designs requiring their own specification and validation.
The same applies when provenance is simply unknown. “No duplicate pair IDs were found” is weaker than “the statistical owner confirmed that each retained pair is an independent sampling unit.” The former is software evidence; the latter is a design assertion that must come from source knowledge.
14. Build statistical review foundations with Refonte Learning
This laboratory combines three skills that matter well beyond one SciPy call: writing numerical code whose assumptions are visible, translating a statistical design into source-level invariants, and retaining enough evidence for another reviewer to reproduce the decision.
Refonte Learning's Data Science & AI Program currently lists a three-month format with 12–14 hours per week and competencies including Python Data Science, Statistical Modelling, EDA and Data Visualization, Machine Learning and Predictive Modelling, problem-solving, and application to industry projects. Its FAQ names Python, Jupyter Notebook, Pandas, NumPy, Matplotlib, scikit-learn, and TensorFlow, while the page associates successful completion with a Training Certificate and Certificate of Internship and describes a virtual internship opportunity and potential internship rather than an unconditional placement guarantee.
The page also contains details that require clarification: Program Specifics says three months and requires current bachelor's or postgraduate study, while the FAQ describes variable duration and elsewhere says there are no strict prerequisites. Prospective learners should confirm those points, mentor cadence, individual internship terms, and coverage of this exact SciPy bootstrap laboratory.
The next review action is narrower than choosing an interval method: establish the approved source correspondence and the independent sampling unit before accepting any bootstrap confidence interval.
