Skip to content

BCompare groups · Guide test 277

Higher criticism test

Detects sparse signals by finding an excess of small p values relative to the global null.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Combine p-values (global test across studies), choose Combination method = Higher criticism.

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Higher criticism test

10
1.20
0.50
0.050

Your data

Drag a point or use ↑/↓ to change it
p-values · n = 10 · mean 0.41

If H₀ were true

HC = 1.90
  1. The reference: how HC varies across samples when H₀ is true, simulated: 10,000 sets of 10 uniforms (Monte Carlo: 10,000 null sets on the shared stream).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .165).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

How the studies combine

Higher criticism looks for an excess of small p-values over i/k in the window 1/k ≤ p ≤ ½ (shaded); the marked point is where the excess is largest. Dashed gray: what k uniform p-values would look like.

The formula

HC=max⁡i: 1/k≤p(i)≤1/2k (i/k−p(i))p(i)(1−p(i))HC=\max_{i:\,1/k\le p_{(i)}\le 1/2}\frac{\sqrt k\,(i/k-p_{(i)})}{\sqrt{p_{(i)}(1-p_{(i)})}}

With your numbers

HC=1.90,k=10,10000 null drawsHC = 1.90,\quad k = 10,\quad 10000\text{ null draws}
i/k−p(i)i/k - p_{(i)}
how far the i-th smallest p sits below its uniform expectation
1/k≤p(i)≤1/21/k\le p_{(i)}\le 1/2
the truncation window of this variant; the null is simulated, as drawn

The verdict

HC = 1.90, p = .165

p > α = .050: compatible with H₀

Built for many tests with a few weak signals; with few studies it has little to work with. Other truncation windows give other p-values, so state the variant.

Statistic
1.897
p-value
0.1647
Higher criticism test on p-values: n = 10: HC = 1.90, p = .165. The p-value is above α = .050, so the data are compatible with H0.

Higher criticism test on p-values: n = 10: HC = 1.90, p = .165. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: all components are null; H1: a sparse collection of weak signals.

Assumptions

Independent or appropriately dependence-adjusted p values; a specified range of order statistics and null calibration.

Formula

HC=max⁡i∈Ik(i/k−p(i))p(i)(1−p(i))HC=\max_{i\in\mathcal I}\frac{\sqrt k(i/k-p_{(i)})}{\sqrt{p_{(i)}(1-p_{(i)})}}

Parameters and notation

I often restricts p(i) away from endpoints and i≤α0k. Trimming rules are part of the test.

Structure of the method

Compare the empirical fraction of p values below each selected order statistic with its uniform-null expectation, standardize the discrepancy and take a maximum over a prespecified range. This is a global sparse-signal detection statistic, with its maximum distribution calibrated rather than treating one selected point as a normal Z test.

Estimated and nuisance parameters

The empirical CDF and maximizing rank are estimated summaries. No sparsity proportion or alternative effect size is necessarily fitted by the classical statistic. Trimming constants, admissible ranks and the joint null model determine which deviations count as evidence.

Settings and design choices

Prespecify endpoint trimming, maximum rank/fraction and whether negative discrepancies are permitted or truncated. The baseline uses p between 1/k and 0.5; therefore it deliberately excludes the very smallest p values. This is one finite-sample variant, not an interchangeable universal higher-criticism definition.

Fitting and adaptation

Simulate the exact chosen statistic under the appropriate joint null, including all trimming and empty-set rules. Increasing replicates improves Monte Carlo precision; use a plus-one correction for an exchangeable simulation test. Correlated features require a justified dependent-null construction rather than independent uniforms.

Sensitivity and robustness

Heavy dependence, p values at machine endpoints and different trimming conventions substantially alter thresholds. With few tests, asymptotic detection-boundary theory is not a substitute for finite-sample calibration. A rejection supports an excess of small p values but does not locate individually significant variables or estimate their effects.

How to use and calibrate

Use finite-sample simulation or the correct higher-criticism asymptotic threshold for the chosen truncation.

Example application

Detect many weak sparse signals in a high-dimensional screen.

Interpretation and pitfalls

Watch out

HC tests a global sparse alternative; it does not by itself identify significant individual features. Correlation changes thresholds.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Explicit truncated higher-criticism variant: 1/n ≤ p(i) ≤ 1/2. Monte Carlo uses independent uniforms; different truncation conventions or dependent tests need different calibration.

Python · native

Validated — Executed successfully in the validation environment · needs numpy, scipy

import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
p=np.r_[.001,.004,.01,.03,rng.uniform(.1,1,16)]
def hc(p):
    n=len(p);u=np.sort(p);j=np.arange(1,n+1);keep=(u>=1/n)&(u<=.5)
    return np.max(np.sqrt(n)*(j[keep]/n-u[keep])/np.sqrt(u[keep]*(1-u[keep]))) if keep.any() else 0.
t=hc(p);B=999;null=np.array([hc(rng.uniform(size=len(p))) for _ in range(B)])
print(t,(1+np.sum(null>=t))/(B+1))
Output
0.3966928582300283 0.737
R

Validated — Executed successfully in the validation environment · needs Base/standard library

set.seed(2026)
p<-c(.001,.004,.01,.03,runif(16,.1,1))
HC<-function(p) {n<-length(p);u<-sort(p);j<-seq_len(n);keep<-u>=1/n & u<=.5;if(!any(keep)) return(0);max(sqrt(n)*(j[keep]/n-u[keep])/sqrt(u[keep]*(1-u[keep])))}
T<-HC(p);B<-999;null<-replicate(B,HC(runif(length(p))));print(c(HC=T,p=(1+sum(null>=T))/(B+1)))
Output
      HC        p 
2.418538 0.098000

Sources

Statistics guide v4 (historical):
R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 277, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT277.