Skip to content

ADescribe · Guide test 123

Epps–Singleton test

Compares two distributions through selected values of their empirical characteristic functions.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

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

In Compare distributions (two or more groups), choose Test = Epps–Singleton.

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 · Epps–Singleton test

25
25
0.40
1.0
1.6
0.050

Your data

Drag a point or use ↑/↓ to change it
Group 1 · n = 25 · mean 0.60Group 2 · n = 25 · mean 0.02

If H₀ were true

W₂ = 3.74
  1. The reference: how W₂ varies across samples when H₀ is true (χ² approximation (small-sample corrected)).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .442).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

W2=N gˉ⊤Ω^−gˉ,gˉ=gˉx(t)−gˉy(t), t=(0.4,0.8)/σ^W_2=N\,\bar g^{\top}\hat\Omega^{-}\bar g,\quad \bar g=\bar g_x(t)-\bar g_y(t),\ t=(0.4,0.8)/\hat\sigma

With your numbers

W2=3.74,df=4W_2 = 3.74,\qquad \text{df} = 4
g(t)g(t)
cos and sin of t·x: the empirical characteristic function
σ^\hat\sigma
half the pooled IQR

The verdict

W₂(4) = 3.74, p = .442

p > α = .050: compatible with H₀

Compares empirical characteristic functions at two frequencies, so it also works for discrete data. Small samples get the authors' correction.

Statistic
3.743
p-value
0.4419
Epps–Singleton test on Group 1: n = 25; Group 2: n = 25: W2(4) = 3.74, p = .442. The p-value is above α = .050, so the data are compatible with H0.

Epps–Singleton test on Group 1: n = 25; Group 2: n = 25: W₂(4) = 3.74, p = .442. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: two distributions agree at the chosen characteristic-function evaluation points.

Assumptions

Independent samples with enough observations for the estimated covariance and asymptotic reference; discrete data are allowed.

Formula

W=(gˉX−gˉY)T(SX/m+SY/n)+(gˉX−gˉY)W=(\bar g_X-\bar g_Y)^T\left(S_X/m+S_Y/n\right)^+(\bar g_X-\bar g_Y)

Parameters and notation

g(x) stacks cos(tℓx),sin(tℓx) at chosen frequencies; S are sample covariance matrices. Default frequencies often use scale-normalized 0.4 and 0.8.

Structure of the method

Map each observation to sine and cosine features at prespecified scaled frequencies. Compare group feature means through a covariance-standardized quadratic form, using a pseudoinverse and covariance rank when needed, then apply the documented small-sample correction.

Estimated and nuisance parameters

Estimate feature means and covariance matrices; a pooled semi-interquartile scale may normalize frequencies. These are nuisance summaries. The finite frequency set is chosen, not learned automatically from the observed discrepancy.

Settings and design choices

Specify frequencies, scaling, covariance normalization, rank tolerance and correction convention. Different frequency grids target different differences. Searching frequencies for significance invalidates the ordinary chi-square reference unless the search is jointly calibrated.

Fitting and adaptation

Refit scale and covariance summaries for each new sample pair. If validating by null simulation or permutation, recompute every sample-dependent transformation, especially scaling and rank decisions. No network is trained. Report covariance rank and frequency values so that Python and R implementations using slightly different finite-sample conventions can be meaningfully compared.

Sensitivity and robustness

The method accommodates discrete observations, but a zero IQR or singular feature covariance needs explicit handling. Low sample sizes destabilize covariance inversion. Agreement at finitely many frequencies does not identify all distributions; nonrejection cannot exclude alternatives invisible at those chosen frequencies.

How to use and calibrate

Use a χ² reference with covariance rank, usually four for two frequencies; apply documented small sample correction.

Example application

Compare discrete or continuous distributions without relying on continuous KS calibration.

Interpretation and pitfalls

Watch out

A finite set of frequencies does not uniquely identify every possible distribution; scale and frequency choices affect power.

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

Empirical characteristic-function test. Frequencies are scaled by pooled semi-IQR; small-sample correction is applied. Singular covariance requires a generalized inverse rather than solve.

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)
x = np.array([4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0])
y = np.array([4.0,4.4,4.8,5.0,5.1,4.3,4.7,4.6,5.2,4.9])
print(stats.epps_singleton_2samp(x,y,t=(.4,.8)))
Output
Epps_Singleton_2sampResult(statistic=np.float64(5.598241812199613), pvalue=np.float64(0.23122796199063186))
R

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

x <- c(4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0)
y <- c(4.0,4.4,4.8,5.0,5.1,4.3,4.7,4.6,5.2,4.9)
n<-length(x);m<-length(y);s<-IQR(c(x,y))/2; t<-c(.4,.8)/s
features<-function(z) cbind(cos(outer(z,t)),sin(outer(z,t)))
A<-features(x);B<-features(y);delta<-colMeans(A)-colMeans(B);V<-cov(A)*(n-1)/n^2+cov(B)*(m-1)/m^2
T<-drop(t(delta)%*%solve(V,delta)); correction<-if(max(n,m)<25) 1/(1+(n+m)^(-.45)+10.1*(n^(-1.7)+m^(-1.7))) else 1
T<-T*correction;print(c(statistic=T,df=qr(V)$rank,p=pchisq(T,qr(V)$rank,lower.tail=FALSE)))
Output
statistic        df         p 
 5.598242  4.000000  0.231228

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 123, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT123.