FTime to event · Guide test 145
Gini exponentiality test
Tests whether the sample’s Gini based inequality agrees with exponentiality.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Exponentiality tests (battery) — Could these lifetimes be exponential, with a constant failure rate?
In Exponentiality tests (battery), choose Test = Gini.
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 · Gini exponentiality test
1 is exponential (a constant hazard); below 1 the hazard falls, above 1 it rises.
Your data
Drag a lifetime or change the shapeIf H₀ were true
- The reference: how z varies across samples when H₀ is true (normal approximation).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .295).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- Gini index of the lifetimes: half under exponentiality
- mean lifetime (the scale cancels)
- standardized G, approximately normal
The verdict
G = 0.44, z = −1.05, p = .295, G = 0.44
p > α = .050: compatible with H₀
Effect size: Gini index (½ under exponentiality) G = 0.444
G above ½ means the lifetimes are more unequal than exponential ones (a falling hazard); below ½, more even (a rising hazard). Matching ½ is compatible with exponentiality, not proof of it.
- Statistic
- −1.046
- p-value
- 0.2955
Gini exponentiality test on Lifetimes: n = 30: G = 0.44, z = −1.05, p = .295, G = 0.44. The p-value is above α = .050, so the data are compatible 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
Parameters and notation
G is a finite-sample normalized Gini statistic; other Gini normalizations differ by n/(n−1).
Structure of the method
Compute the sum of absolute pairwise lifetime differences, divide by the declared finite-sample factor and sample mean, and compare the resulting relative-dispersion measure with one-half. The test targets the exponential Gini functional rather than every distributional feature.
Estimated and nuisance parameters
The mean estimates scale, and the pairwise absolute-difference functional is empirically estimated. Their ratio removes scale. Alternative Gini normalization conventions differ by a finite-n factor and must be identified.
Settings and design choices
Prespecify the finite-sample normalization, direction or two-sided rule, alpha and simulation count. An efficient sorted-sample Gini formula may replace pair enumeration only when algebraically equivalent under the same convention.
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
A nonexponential distribution may share the same Gini functional, limiting omnibus power. A few very long times affect both numerator and denominator. Dependent or censored lifetimes need specialized variance/calibration, and published p-values should not be compared when the implementations use different normalizations.
How to use and calibrate
Use a normal reference asymptotically or null simulation with the same normalization.
Example application
Assess whether relative lifetime dispersion matches an exponential distribution.
Interpretation and pitfalls
Watch out
A distribution can match this dispersion summary without being exponential. This is a targeted goodness-of-fit test, not a proof of the model.
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.
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::gini.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()
Not run — Syntax checked; runtime not verified in the final environment · needs exptest
set.seed(2026)
x<-rexp(24,rate=2)
print(exptest::gini.exp.test(x))
Sources
- exptest — exptest · gini.exp.testAuthor documentation/source reviewed: exptest 1.2.rdrr.io
- gini.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 145, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT145.