KURTOSIS

This function measures tail heaviness and peakedness of a distribution using sample kurtosis.

If m_2 and m_4 are the second and fourth central moments,

ext{Pearson kurtosis} = \frac{m_4}{m_2^2}, \quad ext{Fisher kurtosis} = \frac{m_4}{m_2^2} - 3

Setting fisher=true returns the excess kurtosis (normal distribution near 0), while fisher=false returns Pearson kurtosis (normal distribution near 3).

Excel Usage

=KURTOSIS(data, fisher, bias)
  • data (list[list], required): 2D array of numeric values. Non-numeric values are ignored.
  • fisher (bool, optional, default: true): If True, Fisher’s definition is used (normal ==> 0.0). If False, Pearson’s definition is used (normal ==> 3.0).
  • bias (bool, optional, default: true): If False, calculations are corrected for statistical bias.

Returns (float): Kurtosis of the data, or error message (str) if input is invalid.

Example 1: Fisher kurtosis with bias (default)

Inputs:

data
1
2
3
4

Excel formula:

=KURTOSIS({1;2;3;4})

Expected output:

-1.36

Example 2: Pearson kurtosis with bias

Inputs:

data fisher
1 false
2
3
4

Excel formula:

=KURTOSIS({1;2;3;4}, FALSE)

Expected output:

1.64

Example 3: Fisher kurtosis with bias correction

Inputs:

data fisher bias
1 true false
2
3
4

Excel formula:

=KURTOSIS({1;2;3;4}, TRUE, FALSE)

Expected output:

-1.2

Example 4: Pearson kurtosis with bias correction

Inputs:

data fisher bias
1 false false
2
3
4

Excel formula:

=KURTOSIS({1;2;3;4}, FALSE, FALSE)

Expected output:

1.8

Python Code

from scipy.stats import kurtosis as scipy_kurtosis

def kurtosis(data, fisher=True, bias=True):
    """
    Compute the kurtosis (Fisher or Pearson) of a dataset.

    See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kurtosis.html

    This example function is provided as-is without any representation of accuracy.

    Args:
        data (list[list]): 2D array of numeric values. Non-numeric values are ignored.
        fisher (bool, optional): If True, Fisher's definition is used (normal ==> 0.0). If False, Pearson's definition is used (normal ==> 3.0). Default is True.
        bias (bool, optional): If False, calculations are corrected for statistical bias. Default is True.

    Returns:
        float: Kurtosis of the data, or error message (str) if input is invalid.
    """
    def to2d(x):
        return [[x]] if not isinstance(x, list) else x

    try:
      data = to2d(data)

      if not isinstance(data, list) or not all(isinstance(row, list) for row in data):
        return "Error: Invalid input: data must be a 2D list."

      if not isinstance(fisher, bool):
        return "Error: Invalid input: fisher must be a boolean."

      if not isinstance(bias, bool):
        return "Error: Invalid input: bias must be a boolean."

      flat = []
      for row in data:
        for x in row:
          try:
            val = float(x)
            flat.append(val)
          except (TypeError, ValueError):
            continue

      if len(flat) < 2:
        return "Error: Invalid input: data must contain at least two numeric values."

      result = scipy_kurtosis(flat, fisher=fisher, bias=bias, nan_policy='omit')
      return float(result)
    except Exception as e:
      return f"Error: {str(e)}"

Online Calculator

2D array of numeric values. Non-numeric values are ignored.
If True, Fisher's definition is used (normal ==> 0.0). If False, Pearson's definition is used (normal ==> 3.0).
If False, calculations are corrected for statistical bias.