Sign in

Kurtosis

Kurtosis is the fourth standardised moment: it measures how much of a distribution's variance comes from rare, extreme values.

Overview

Two samples can have the same mean and the same variance and still behave very differently. In one, the variance comes from many moderate deviations. In the other, most values sit close to the mean and a few lie very far out. Kurtosis tells these apart. It raises each standardised deviation to the fourth power, so values far from the mean count enormously and values near it count almost nothing. A normal distribution scores 3, and the excess form subtracts 3 so that normal reads as zero. Heavier tails than normal are called leptokurtic, lighter tails platykurtic, and normal-like tails mesokurtic. It describes tail weight, not how pointed the peak is.

A short history

Karl Pearson introduced kurtosis in 1905, together with the terms leptokurtic, mesokurtic and platykurtic, to describe how a frequency curve departs from the normal curve beyond its skewness. It was long taught as a measure of peakedness. Later writers, including Peter Westfall in 2014, showed that it really measures the weight of the tails: how much of the variance is due to rare, extreme values.

How it works

  1. Drop NaN entries and subtract the mean from every value.
  2. Compute the second central moment, the mean of the squared deviations, and the fourth, the mean of the deviations to the fourth power.
  3. Divide the fourth moment by the square of the second. This is Pearson's kurtosis, which is 3 for a normal distribution.
  4. Subtract 3 to get the excess kurtosis when fisher is true.
  5. When bias is false, apply the sample-size correction, which needs at least four values.
  6. Classify: leptokurtic if the excess is above tolerance, platykurtic if it is below minus tolerance, mesokurtic in between.
  7. With describe, divide the corrected estimate by its standard error to get a z score for whether the tails differ from a normal's.

Watch out for

  • The estimate is dominated by the most extreme points, because deviations are raised to the fourth power. One outlier can move it from negative to strongly positive.
  • It needs a few hundred observations to be stable. On small samples the value changes a lot from one sample to the next.
  • High kurtosis does not mean a sharp peak. A distribution can be flat in the middle and still have heavy tails.
  • Software differs on whether it reports excess kurtosis or Pearson's, so a value of 3 can mean normal in one tool and heavy tails in another.
  • The standard error used for the z score assumes a normal sample, so the z score is a test of normal tails and nothing more general.

Use cases

When to use it

When outliers and tail risk matter: checking the normality assumption before a test, choosing a loss that tolerates extreme errors, or judging how far a mean can be trusted.

In industry

Financial risk
Risk analysts measure the kurtosis of daily returns because fat tails mean that large losses happen far more often than a normal model predicts.
Machine condition monitoring
Vibration signals from bearings are tracked by kurtosis: sharp impacts from an early defect raise it before the overall vibration level changes.
Signal processing
Independent component analysis uses kurtosis as a measure of how far a signal is from Gaussian when separating mixed sources.

Choosing it: what must hold

  • A numeric variable with a reasonably large sample, since the fourth moment is very sensitive to a few values.
  • Clarity about whether you report kurtosis, which is 3 for a normal distribution, or excess kurtosis, which is 0.
  • An interest in tail behaviour and outlier proneness, not in the height of the peak.

When to choose something else

IfUse instead
The sample is small or you need a robust measure of tailsQuantile based summaries from quartiles and IQR, or a count of points beyond the fences
The question is about asymmetry, not tail weightSkewness, covered in distribution analysis
You need a formal check against the normal distributionA normality test and Q-Q plot from distribution analysis

Math foundations

  1. Central moments

    mk=1n∑i=1n(xi−xˉ)km_k = \frac{1}{n} \sum_{i=1}^{n} (x_i - \bar{x})^{k}

    The average kk-th power of the deviations from the mean. m2m_2 is the population variance. m4m_4 gives heavy weight to values far from the mean.

  2. Excess kurtosis

    g2=m4m22−3g_2 = \frac{m_4}{m_2^{2}} - 3

    Dividing by m22m_2^{2} removes the unit and the scale, so only the shape remains. Subtracting 3 makes a normal distribution score zero.

  3. Sample-size corrected estimate

    G2=n−1(n−2)(n−3)[(n+1) g2+6]G_2 = \frac{n-1}{(n-2)(n-3)} \Big[ (n+1)\, g_2 + 6 \Big]

    The plain estimate g2g_2 runs low on small samples. This version is unbiased for normal data and is what most statistics packages report.

  4. Standard error under normality

    SE(G2)=24 n (n−1)2(n−3)(n−2)(n+3)(n+5)\mathrm{SE}(G_2) = \sqrt{\frac{24\, n\, (n-1)^{2}}{(n-3)(n-2)(n+3)(n+5)}}

    How much G2G_2 varies from sample to sample when the data really are normal. For large nn it is close to 24/n\sqrt{24/n}.

  5. The z score

    z=G2SE(G2)z = \frac{G_2}{\mathrm{SE}(G_2)}

    The corrected estimate in units of its standard error. A size beyond about 2 suggests the tails differ from those of a normal distribution.

Symbols

xix_i
the i-th value
xˉ\bar{x}
the mean of the values
nn
number of values
m2,m4m_2, m_4
second and fourth central moments
g2g_2
the plain (biased) excess kurtosis
G2G_2
the sample-size corrected excess kurtosis
zz
the corrected estimate divided by its standard error

Worked by hand

Five values: 1, 2, 3, 4, 5. The mean is 3 and the deviations are -2, -1, 0, 1, 2.

m2=4+1+0+1+45=2m_2 = \frac{4 + 1 + 0 + 1 + 4}{5} = 2
m4=16+1+0+1+165=6.8m_4 = \frac{16 + 1 + 0 + 1 + 16}{5} = 6.8
m4m22=6.84=1.7\frac{m_4}{m_2^{2}} = \frac{6.8}{4} = 1.7
g2=1.7−3=−1.3g_2 = 1.7 - 3 = -1.3

The excess kurtosis is -1.3. Evenly spread values have no extreme points relative to their spread, so they are platykurtic, with lighter tails than a normal distribution.

Visual example

Loading the example.

Try this

  • Switch from the flat shape to the heavy tails and watch the excess kurtosis go from negative to strongly positive.
  • On the normal shape, add one value 6 standard deviations out: a single point turns the sample leptokurtic.
  • Draw new samples at n = 20 and see how far the estimate jumps from one draw to the next.

Code sample

import numpy as np
from impl import Kurtosis
from config import KurtosisConfig

k = Kurtosis(KurtosisConfig(fisher=True, bias=True))
print(k.kurtosis([1, 2, 3, 4, 5]))                                   # -1.3
print(k.classify(np.random.default_rng(0).laplace(size=10_000)))     # leptokurtic
print(k.describe(np.random.default_rng(0).normal(size=1000)))
Read the implementation (83 lines)
"""Kurtosis: how heavy the tails of a distribution are compared with a normal distribution.

NumPy only. Excess kurtosis is m4 / m2^2 - 3, where m2 and m4 are the second and fourth central moments. Positive
means heavier tails and more outliers than a normal (leptokurtic), negative means lighter tails (platykurtic),
near zero means normal-like tails (mesokurtic).
"""
from __future__ import annotations

import math

import numpy as np

try:
    from .config import KurtosisConfig
except ImportError:  # run from the template's own folder
    from config import KurtosisConfig


class Kurtosis:
    """Sample kurtosis, its standard error and its lepto/meso/platykurtic class."""

    def __init__(self, config: KurtosisConfig | None = None) -> None:
        self.config = config or KurtosisConfig()

    @staticmethod
    def _clean(values) -> np.ndarray:
        x = np.asarray(values, dtype=float).ravel()
        x = x[~np.isnan(x)]
        if x.size < 2:
            raise ValueError("at least two values are needed")
        return x

    def excess(self, values) -> float:
        """Excess kurtosis (normal = 0), with or without the sample-size correction set by config.bias.

        values: array-like, flattened; NaN entries are dropped.
        """
        x = self._clean(values)
        n = x.size
        deviations = x - x.mean()
        m2 = float(np.mean(deviations**2))
        if m2 == 0:
            raise ValueError("kurtosis is undefined for constant data")
        g2 = float(np.mean(deviations**4)) / m2**2 - 3.0
        if self.config.bias:
            return g2
        if n < 4:
            raise ValueError("the bias-corrected estimate needs at least four values")
        return (n - 1.0) / ((n - 2.0) * (n - 3.0)) * ((n + 1.0) * g2 + 6.0)

    def kurtosis(self, values) -> float:
        """Kurtosis in the convention chosen by config.fisher: excess (normal = 0) or Pearson (normal = 3)."""
        excess = self.excess(values)
        return excess if self.config.fisher else excess + 3.0

    def classify(self, values) -> str:
        """"leptokurtic" (heavy tails), "platykurtic" (light tails) or "mesokurtic" (normal-like)."""
        excess = self.excess(values)
        if excess > self.config.tolerance:
            return "leptokurtic"
        if excess < -self.config.tolerance:
            return "platykurtic"
        return "mesokurtic"

    @staticmethod
    def standard_error(n: int) -> float:
        """Standard error of the corrected excess kurtosis G2 for a normal sample of size n (n >= 4)."""
        if n < 4:
            raise ValueError("n must be at least 4")
        return math.sqrt(24.0 * n * (n - 1.0) ** 2 / ((n - 3.0) * (n - 2.0) * (n + 3.0) * (n + 5.0)))

    def describe(self, values) -> dict:
        """Kurtosis, excess kurtosis, class, sample size and (for n >= 4) the standard error and z score.

        The z score is G2 divided by its standard error; beyond about 2 in size the tails differ from a normal's.
        """
        x = self._clean(values)
        out = {"n": int(x.size), "kurtosis": self.kurtosis(x), "excess": self.excess(x), "kind": self.classify(x)}
        if x.size >= 4:
            corrected = Kurtosis(KurtosisConfig(fisher=True, bias=False, tolerance=self.config.tolerance)).excess(x)
            out["standard_error"] = self.standard_error(x.size)
            out["z"] = corrected / out["standard_error"]
        return out
Repository
Not published yet
Needs
Python 3.10 and NumPy
Tests
7, run with python3 -m unittest -v

Practice

Call Kurtosis().kurtosis on the five values above and confirm -1.3. Then draw 10 000 values from a normal, a uniform and a Laplace distribution with NumPy and run classify and describe on each. Add one value of 50 to the normal sample and see how far the excess kurtosis moves.

Check on learning

  1. Adding a single extreme value to 1000 normal values barely changes the variance but changes the kurtosis a great deal. Why?
    A way to think about it

    Compare what one deviation of size 10 contributes to a sum of squares and to a sum of fourth powers.

  2. A fair coin coded as 0 and 1 has an excess kurtosis of -2, the lowest possible. What about this distribution makes its tails as light as they can be?
    A way to think about it

    Every value sits exactly one standard deviation from the mean. Ask whether any value is extreme relative to the spread.

  3. Daily returns of a stock show an excess kurtosis of 8. If you modelled them as normal, which risks would you understate?
    A way to think about it

    Under a normal model a move of five standard deviations almost never happens. Heavy tails say such moves are far more common.

  4. With 20 observations G2G_2 is 0.9 and its standard error about 0.99. What can you conclude about the tails?
    A way to think about it

    Compute the z score. Then think about how wide the range of plausible values is with so few points.

  5. Why is it wrong to read high kurtosis as a sharp peak, even though many peaked distributions do have high kurtosis?
    A way to think about it

    Values near the mean contribute almost nothing to m4m_4. The number is set by the tails, and the peak is a side effect of fixing the variance.