Skip to content

DPredict · Guide test 213

Brock–Dechert–Scheinkman test

Tests independent and identically distributed behavior using correlation integrals across embedding dimensions.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

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

  • Randomness and serial-dependence tests — Is the series (or a model's residuals) just random noise, or does it carry runs, trends, autocorrelation, volatility clustering or nonlinear structure?

In Randomness and serial-dependence tests, choose Test = BDS (i.i.d. against any dependence).

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 · Brock–Dechert–Scheinkman test

200
0.000
0.40

Each error carries φ × the previous one; 1 is a random walk.

0.0
2
0.050

Your data

Simulated with a known ρ

If H₀ were true

z = 2.63
  1. The reference: how z varies across samples when H₀ is true (normal approximation).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .008).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Wm=n−m+1 cm(ε)−c1(ε)mσ^m(ε)W_m = \sqrt{n-m+1}\,\dfrac{c_m(\varepsilon) - c_1(\varepsilon)^m}{\hat\sigma_m(\varepsilon)}

With your numbers

c1=0.71,cm=0.52,W2=2.63c_1 = 0.71,\quad c_m = 0.52,\quad W_{2} = 2.63
cm(ε)c_m(\varepsilon)
share of pairs of m-histories within ε in every coordinate
ε\varepsilon
1.5 × the sample SD

The verdict

BDS = 2.63, z = 2.63, p = .008

p ≤ α = .050: reject H₀

Detects any dependence, linear or not; apply it to residuals of a fitted model to look for what the model missed. The normal approximation needs long series: below about 200 observations it over-rejects.

Statistic
2.632
p-value
0.0085
Brock–Dechert–Scheinkman test on 200 (x, y) pairs: BDS = 2.63, z = 2.63, p = .008. The p-value is below α = .050, so the data are hard to reconcile with H0.

Brock–Dechert–Scheinkman test on 200 (x, y) pairs: BDS = 2.63, z = 2.63, p = .008. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: the scalar observations are independent and identically distributed.

Assumptions

A stationary iid null with suitable regularity; chosen embedding dimension m and distance threshold ε; adequate sample size.

Formula

Wm,ϵ=T[Cm(ϵ)−C1(ϵ)m]σ^m,ϵσm,ϵ2=4[Km+2∑j=1m−1Km−jC12j+(m−1)2C12m−m2KC12m−2]\begin{gathered}W_{m,\epsilon}=\frac{\sqrt T[C_m(\epsilon)-C_1(\epsilon)^m]}{\widehat\sigma_{m,\epsilon}}\\[5pt]\sigma_{m,\epsilon}^2=4\left[K^m+2\sum_{j=1}^{m-1}K^{m-j}C_1^{2j}+(m-1)^2C_1^{2m}-m^2KC_1^{2m-2}\right]\end{gathered}

Parameters and notation

Cm is the proportion of embedded vector pairs within ε in sup-norm; embedded vectors are (xt,…,xt+m−1). σ̂ is the BDS null standard deviation accounting for overlap. In the variance formula K=E[h(X1,X2)h(X1,X3)] for h(x,y)=I(|x−y|<ε). Estimate C1 and K by their pair/triple empirical averages, using the implementation’s finite-sample exclusions.

Structure of the method

Construct overlapping delay vectors, count pairs close in the sup norm, compare their empirical correlation integral with the corresponding power of the one-dimensional integral, and standardize by the iid-null variance. This is a dependence diagnostic with roughly quadratic pairwise work, not a fitted nonlinear forecasting architecture.

Estimated and nuisance parameters

Estimated quantities are correlation integrals, their null variance components, and optionally the standard deviation used to scale epsilon. If applied to regression or volatility-model residuals, upstream model coefficients are additional estimated nuisance quantities whose estimation can affect the reference distribution.

Settings and design choices

Prespecify maximum embedding dimension, distance threshold or standard-deviation multiplier, and the set of thresholds examined. Larger dimensions consume effective observations and make nearby pairs rare; very small or very large epsilon makes the statistic poorly informative. Selecting the smallest p value across settings is multiple testing.

Fitting and adaptation

No neural fine-tuning applies. First fit any intended mean/variance model, inspect the residual definition, then apply BDS with calibration appropriate to estimated residuals. A bootstrap for an upstream fitted model should repeat fitting as required by its validity argument rather than merely reshuffle final residuals automatically.

Sensitivity and robustness

Check sample size, missing-time handling, extreme observations, threshold sensitivity, and the effect of volatility clustering. Rejection identifies a failure of iid behavior; it cannot distinguish deterministic chaos, stochastic nonlinear dependence, omitted volatility, or a structural break. The existing examples illustrate iid draws, not proof of uniform finite-sample size.

How to use and calibrate

Use asymptotic normal or a documented bootstrap calibration; report m,ε and all examined combinations.

Example application

Detect nonlinear dependence after fitting a linear time-series model.

Interpretation and pitfalls

Watch out

Rejection can reflect nonstationarity, heteroskedasticity or model estimation effects; it does not identify deterministic chaos.

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

Tests IID, not merely zero autocorrelation. Output covers embedding dimensions 2 and 3; epsilon is 1.5 sample standard deviations.

Python · native

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

import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
from statsmodels.tsa.stattools import bds
x=rng.normal(size=150)
print(bds(x,max_dim=3,distance=1.5))
Output
(array([1.03023929, 2.21634196]), array([0.30289769, 0.02666809]))
R

Validated — Executed successfully in the validation environment · needs tseries

set.seed(2026)
x<-rnorm(150);print(tseries::bds.test(x,m=3,eps=1.5*sd(x)))
Output
	 BDS Test 

data:  x 

Embedding dimension =  2 3 

Epsilon for close points =  1.5359 

Standard Normal = 
      [ 1.5359 ]
[ 2 ]     1.8918
[ 3 ]     1.6872

p-value = 
      [ 1.5359 ]
[ 2 ]     0.0585
[ 3 ]     0.0916

Sources

Statistics guide v4 (historical):
Python: Executed successfully in the validation environment · R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Unavailable local dependencies: statsmodels. Python: Not run in the reference's review: Unavailable local dependencies: statsmodels. No installation attempted. R: Reviewed but not run: R wasn't available to the reference's authors.

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