Calculates the kurtosis of a given set of data.

View versions (1)

Interface

#include <codecogs/statistics/moments/kurtosis.h>

using namespace Statistics::Moments;

A fundamental task in many statistical analyses is to characterize the location and variability of a data set. A further characterization of the data includes skewness and kurtosis.

Kurtosis is a measure of whether the data are peaked or flat relative to a normal distribution. That is, data sets with high kurtosis tend to have a distinct peak near the mean, decline rather rapidly, and have heavy tails.

Data sets with low kurtosis tend to have a flat top near the mean rather than a sharp peak. A uniform distribution would be the extreme case.

The kurtosis for a standard normal distribution is three. For this reason, excess kurtosis is defined as

\eta_2 =\frac{\sum_{i=1}^n (x_i-\overline{x})^4} {(N-1)\sigma^4}
(1)

where x is the actual population and \sigma is the standard deviation. This way the standard normal distribution has a kurtosis of zero. Positive kurtosis indicates a peaked distribution and negative kurtosis indicates a flat distribution.

References

NIST/SEMATECH e-Handbook of Statistical Methods, www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm

Example 1

#include <codecogs/statistics/moments/kurtosis.h>
#include <iostream>

int main()
{
  float x[5] = {3.4 , 7.1 , 1.5 , 8.6 , 4.9};
  double kurt = Stats::Moments::kurtosis<float>(5, x);
  std::cout << "The population kurtosis is: " << kurt << std::endl;
  return 0;
}

Output:

The population kurtosis is: -0.928457

Parameters

n
the size of the population
data
the actual population data given as an array

Returns

the kurtosis of the given set of data
GPL Licence — free for non commercial use. See Licence details.