Skip to content

FTime to event · Guide test 136

Deshpande exponentiality test

Uses a characterization of exponential lifetimes to detect departures from constant hazard behavior.

Runs in CodeSplashPython (calls R) example not runR example not run

Do it in CodeSplash

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

In Exponentiality tests (battery), choose Test = Deshpande.

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 · Deshpande exponentiality test

25
1.60

1 is the exponential (constant hazard); above 1 wear-out, below 1 early failures.

2.0
0.050

Your data

Weibull lifetimes; shape 1 is exponential
Lifetimes · n = 25 · mean 2.07

If H₀ were true

z = 3.25
  1. The reference: how z varies across samples when H₀ is true, simulated: 999 exponential samples of 25 (simulated null on the shared Wichmann–Hill stream).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .006).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Jb=1n(n−1)#{xi>b xj},b=0.44J_b=\dfrac{1}{n(n-1)}\#\{x_i>b\,x_j\},\quad b=0.44

With your numbers

Jb=0.79,z=3.25J_b = 0.79,\qquad z = 3.25
bb
Deshpande's constant 0.44
1/(b+1)1/(b+1)
J_b's null mean

The verdict

z = 3.25, p = .006

p ≤ α = .050: reject H₀

A U-statistic aimed at increasing-failure-rate-average alternatives. H0 fixes no scale: every statistic uses x / x̄.

Statistic
3.254
p-value
0.0060
Deshpande exponentiality test on Lifetimes: n = 25: z = 3.25, p = .006. The p-value is below α = .050, so the data are hard to reconcile with H0.

Deshpande exponentiality test on Lifetimes: n = 25: z = 3.25, p = .006. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: Xi are exponential with some common mean θ>0; H1: a departure detectable by this statistic.

Assumptions

Independent identically distributed positive, uncensored observations. The null is an exponential distribution with unknown scale and known origin zero. Censored, shifted or dependent samples need specialized versions.

Formula

Jb=1n(n−1)∑i≠jI(Xi>bXj)Z=n[Jb−1/(b+1)]2ζb\begin{gathered}J_b=\frac{1}{n(n-1)}\sum_{i\ne j}I(X_i>bX_j)\\[5pt] Z=\frac{\sqrt n[J_b-1/(b+1)]}{2\sqrt{\zeta_b}}\end{gathered}

Parameters and notation

Choose b>0, b≠1. ζb=¼[1+b/(b+2)+1/(2b+1)+2(1−b)/(b+1)−2b/(b²+b+1)−4/(b+1)²].

Structure of the method

Count ordered distinct pairs satisfying a lifetime-ratio inequality, average those indicators and compare with the exponential probability 1/(b+1). The asymptotic variance derives from the dependence among pairwise terms sharing observations, not a binomial sample size of n(n−1).

Estimated and nuisance parameters

The pairwise probability is estimated by a U-statistic; common exponential scale cancels. The multiplier b is chosen externally and is not a fitted hazard parameter or learned model coefficient.

Settings and design choices

Fix positive b away from the degenerate value one, the alternative direction and calibration method. The familiar default b=0.44 is a design recommendation, not a universally optimal choice for every alternative.

Fitting and adaptation

There is no neural fitting or fine-tuning stage. For an unknown-scale exponential null, exploit scale invariance or re-estimate the mean in every simulated unit-exponential sample, exactly matching the observed-data algorithm. Calibrate the prespecified tail and repeat the entire procedure after changing a tuning rule. Report simulation count and Monte Carlo uncertainty; use a plus-one randomized p-value convention for newly implemented Monte Carlo tests.

Sensitivity and robustness

Near b=1 the statistic and its variance can degenerate numerically. Pair indicators are dependent, so ordinary Bernoulli standard errors are wrong. Ties, discretization and an unknown time origin change the characterization. Searching b for the largest standardized departure requires null simulation of the search itself.

How to use and calibrate

Use asymptotic normal tails or exponential-null simulation with the same b.

Example application

Assess departures using probabilities of pairwise lifetime ratios.

Interpretation and pitfalls

Watch out

At b=1 the statistic degenerates for continuous samples. Choosing b after inspecting results needs adjusted calibration.

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

Uses exptest 1.2 (archived CRAN package); see installation notes. Complete positive uncensored lifetimes, unknown exponential scale and known origin zero. Defaults and tail calibration follow the cited function.

Python · invokes R

Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: exptest

# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
    raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
x<-rexp(24,rate=2)
print(exptest::deshpande.exp.test(x))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
                        text=True, capture_output=True)
print(result.stdout)
if result.stderr:
    print(result.stderr)
result.check_returncode()
R

Not run — Syntax checked; runtime not verified in the final environment · needs exptest

set.seed(2026)
x<-rexp(24,rate=2)
print(exptest::deshpande.exp.test(x))

Sources

  • exptest — exptest · deshpande.exp.testAuthor documentation/source reviewed: exptest 1.2.rdrr.io
  • deshpande.exp.testrdrr.io
Statistics guide v4 (historical):
Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.

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