Rolling Excess Kurtosis (KURTOSIS)
Summary
An estimate, from the trailing window, of the excess kurtosis of the distribution its values come from: the fourth standardised moment minus 3, so a normal distribution reads 0. A tail-weight measure: above 0 the distribution has heavier tails than a normal one with the same variance, below 0 lighter ones. The companion to the shipped VAR and STDDEV in the same group.
Formula
Sample-adjusted Fisher excess kurtosis, the estimator usually written G2. With window size n, window mean x̄, and sample variance s² = Σ(x−x̄)²/(n−1):
G2 = [ n(n+1) / ((n−1)(n−2)(n−3)) ] · [ Σ(x−x̄)⁴ / s⁴ ] − 3(n−1)² / ((n−2)(n−3))
The result is NaN when s² = 0, that is when every value in the window is equal.
optInTimePeriod must be at least 4: the (n−2)(n−3) denominators are undefined below it. The bound is enforced by the parameter range, so a shorter period is refused rather than silently degraded.
Notes
- This is
G2, the form ExcelKURTandscipy.stats.kurtosis(bias=False)compute. The other form in circulation is the biasedg2 = m₄/m₂² − 3over population moments, a different estimator rather than a rounding convention:G2 = (n−1)((n+1)·g2 + 6) / ((n−2)(n−3)). - A point mass has no defensible excess kurtosis, so the degenerate window is NaN rather than a number:
0would assert normality and−1.2uniformity. This is deliberately unlikeVAR, which floors to zero — a variance of zero says something true about the window. - The result is at most
n, the value of one reading apart fromn−1equal ones, so a window dominated by one outlier is legitimately far above 0.
Inputs
inReal— The series to measure
Outputs
outReal— Excess kurtosis of the trailing window, or NaN where the window has no spread
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 30 | 4–10000 | Number of trailing values in the window |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ✅ Can Output NaN or ±Inf i |
| ☐ Identity at Period 1 |
Implementation
TA-Lib Definition: kurtosis.c · kurtosis.yaml
| Native | File |
|---|---|
| C | ta_KURTOSIS.c |
| Rust | kurtosis.rs |
| Java | Core_KURTOSIS.java |
| C# | Core_KURTOSIS.cs |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Excess Kurtosis, Sample Excess Kurtosis, KURT
See Also
References
- Joanes, D. N. and Gill, C. A. "Comparing measures of sample skewness and kurtosis." Journal of the Royal Statistical Society: Series D, 47(1), 1998, 183-189 — the
g1/g2,G1/G2,b1/b2families and which is unbiased under which assumption. - NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.11 — the biased population form.
- Microsoft, KURT function — the
G2form, and#DIV/0!for fewer than four points or zero standard deviation.