advanced27 min studyLesson 875 in Engineering

Calibrate a family of drift tests, including repeated looks

Connect two-sample statistics to their sampling assumptions and distinguish a single-window threshold from a valid monitoring-wide error claim.

On this page

What you’ll understand

  • Compute an empirical two-sample CDF discrepancy.
  • Apply a Bonferroni threshold to an explicitly defined finite family.
  • Explain why dependence, adaptive representations, and indefinite monitoring change a test's interpretation.

A distance becomes a hypothesis test only after specifying its null distribution and decision rule. A monitor then runs many such decisions across features, slices, and time. A five-percent test on each chart does not imply a five-percent chance of any false alert across the dashboard. Make the family of claims explicit, verify how samples were obtained, and pair statistical evidence with practical effect sizes and a response plan.

A statistic and a p-value answer different questions

The two-sample Kolmogorov–Smirnov statistic is the largest absolute gap between empirical cumulative distributions. Its ordinary continuous-null calibration assumes independent samples from their respective populations, with the null asserting identical continuous distributions. Repeated requests from one user, autocorrelation, shared events across windows, or rounded categorical values can invalidate a naive calibration. The empirical CDF gap remains descriptive, but the advertised p-value needs a method appropriate to the data's dependence and discreteness. A named test is not permission to ignore how the observations were generated.

Multivariate tests can compare joint structure through a chosen kernel, representation, or classifier. Freeze these choices or account for their fitting in the testing procedure; choosing a representation because it separates the very samples being tested can bias the resulting evidence. A permutation test needs exchangeability under its null, including any grouping or fitted preprocessing. Even a valid rejection establishes a distributional discrepancy under the test's assumptions, not the size of a model's accuracy loss. Report the statistic, sample sizes, reference identity, and relevant examples beside the decision.

Dn,m=sup⁡z∣F^n(z)−G^m(z)∣,F^n(z)=1n∑i=1n1{Xi≤z}D_{n,m}=\sup_z|\widehat F_n(z)-\widehat G_m(z)|,\qquad \widehat F_n(z)=\frac1n\sum_{i=1}^{n}\mathbf1\{X_i\leq z\}
n,m>0 are sample counts, z has the feature's units, and the empirical CDFs and D are dimensionless. The formula defines a descriptive statistic; its p-value requires the selected null calibration and sampling assumptions.↔ Scroll wide equations horizontally.

Count the claims in the error budget

For a fixed family of M tests, Bonferroni rejects an individual null when its valid p-value is at most α/M. The union bound controls the probability of at least one false rejection by α without requiring independence between tests. It does require each p-value to satisfy its null-validity condition. Increasing feature coverage, adding slices, or looking at additional planned windows expands the family. An engineer should therefore distinguish the number of charts displayed from the number of inferential opportunities that produced the alert.

If twenty independent null tests each reject with probability 0.05, the chance of at least one rejection is one minus 0.95 to the twentieth power. Real monitoring tests are often dependent, so that arithmetic is an illustrative independent case rather than a universal correction. Reusing a reference window does not by itself invalidate Bonferroni, but can affect the validity or dependence of individual test constructions. Practical thresholding can also require a minimum effect size, provided the combined rule and its interpretation are documented. Statistical significance alone can flag negligible movement at large volume.

P(one or more false rejections)≤∑j∈H0P(pj≤α/M)≤αP(\text{one or more false rejections})\leq\sum_{j\in\mathcal H_0}P(p_j\leq\alpha/M)\leq\alpha
The family contains a fixed finite M≥1 tests, 0<α<1, and each true-null p-value is super-uniform at the stated threshold. No test independence is needed. This claim covers that family, not an unbounded sequence of future windows.↔ Scroll wide equations horizontally.

Time is another source of repeated decisions

An hourly monitor that resets its nominal error budget every hour does not retain the same lifetime false-alert guarantee. A finite planned horizon can include every feature–window test in one family. Alternatively, a predeclared spending sequence with a summable total error budget can support a union-bound argument when each scheduled test remains valid. Specialized sequential tests and confidence sequences offer other guarantees under their own assumptions. Stopping when a conventional fixed-sample p-value first looks small requires a justification beyond the original fixed-sample threshold.

The sampling instrument shows how null variability changes with sample size, without implementing a two-sample test. Reset, set p=0.50 and n=25, predict sample-mean variance 0.01, then Play or Step. Separately Reset, set p=0.50 and n=100, predict variance 0.0025, then Play or Step. Exact binomial masses remain fixed while playback highlights outcomes. Neither the normal overlay nor the displayed standardized-CDF bound controls a family's alert rate. Use the instrument to understand variation, then evaluate the actual detector and monitoring schedule with their stated null assumptions.

A dashboard's individual thresholds add up

Twenty features are tested once with valid p-values. The desired family-wise error level is 0.05. Two features have p-values 0.003 and 0.002. Also calculate the chance of at least one false rejection for twenty independent tests that each have exact null rejection probability 0.05.

  1. For the defined one-window family, Bonferroni uses 0.05/20=0.0025 per test. The 0.003 result does not cross this threshold; the 0.002 result does.

  2. Under the separate illustrative independence assumption, the probability that none of twenty unadjusted null tests rejects is 0.95²⁰≈0.358486.

  3. Therefore the probability of at least one unadjusted false rejection is approximately 0.641514, or 64.15%. Bonferroni's bound does not need that independence assumption, but still needs individually valid tests.

The result

A nominal 5% threshold on every chart can produce many investigation opportunities. The corrected claim here covers exactly the twenty tests in one window.

Explore the model

Interactive lab

Interactive lab · sampling

Sampling variability is distinct from alert multiplicity

Reset, set p=0.50 and n=25, predict variance 0.01, then Play or Step. Separately Reset, set p=0.50 and n=100, predict variance 0.0025, then Play or Step. These are exact independent Bernoulli sample-mean distributions, with playback highlighting fixed outcomes. The instrument computes no two-sample p-value, multiple-testing correction, or sequential stopping rule.

Sampling variability is distinct from alert multiplicityExact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA distribution illustration does not supply a monitoring-wide false-alert guarantee.

Check your understanding

What does Bonferroni require for a fixed family of dependent tests?

Try it yourself

A predeclared study runs ten feature tests in each of twenty-four windows and wants a 0.05 family-wise error bound over all 240 decisions. Find the Bonferroni threshold and state what changes if monitoring continues past the planned horizon.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Count feature–window pairs, then divide the total error budget by that count.

Compare with the solution

The per-test threshold is 0.05/240≈0.000208333. The bound requires valid p-values for the complete fixed family, even when windows overlap. Additional future tests are outside that allocation; an extended plan needs another justified overall budget or a suitable sequential procedure. Silently resetting the same family budget does not preserve the original lifetime claim.

Take it with you

  • Descriptive distances and calibrated p-values serve different purposes.
  • Multiple features, slices, and repeated looks belong in the inferential scope.
  • Error control does not establish practical harm or repair invalid sampling assumptions.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.