# kurtosis

Kurtosis

## Syntax

`k = kurtosis(X)k = kurtosis(X,flag)k = kurtosis(X,flag,dim)`

## Description

`k = kurtosis(X)` returns the sample kurtosis of `X`. For vectors, `kurtosis(x)` is the kurtosis of the elements in the vector `x`. For matrices `kurtosis(X)` returns the sample kurtosis for each column of `X`. For N-dimensional arrays, `kurtosis` operates along the first nonsingleton dimension of `X`.

`k = kurtosis(X,flag)` specifies whether to correct for bias (`flag` is `0`) or not (`flag` is `1`, the default). When `X` represents a sample from a population, the kurtosis of `X` is biased, that is, it will tend to differ from the population kurtosis by a systematic amount that depends on the size of the sample. You can set `flag` to `0` to correct for this systematic bias.

`k = kurtosis(X,flag,dim)` takes the kurtosis along dimension `dim` of `X`.

`kurtosis` treats `NaN`s as missing values and removes them.

## Examples

```X = randn([5 4]) X = 1.1650 1.6961 -1.4462 -0.3600 0.6268 0.0591 -0.7012 -0.1356 0.0751 1.7971 1.2460 -1.3493 0.3516 0.2641 -0.6390 -1.2704 -0.6965 0.8717 0.5774 0.9846 k = kurtosis(X) k = 2.1658 1.2967 1.6378 1.9589```

collapse all

### Algorithms

Kurtosis is a measure of how outlier-prone a distribution is. The kurtosis of the normal distribution is 3. Distributions that are more outlier-prone than the normal distribution have kurtosis greater than 3; distributions that are less outlier-prone have kurtosis less than 3.

The kurtosis of a distribution is defined as

$k=\frac{E{\left(x-\mu \right)}^{4}}{{\sigma }^{4}}$

where μ is the mean of x, σ is the standard deviation of x, and E(t) represents the expected value of the quantity t. `kurtosis` computes a sample version of this population value.

 Note   Some definitions of kurtosis subtract 3 from the computed value, so that the normal distribution has kurtosis of 0. The `kurtosis` function does not use this convention.

When you set `flag` to 1, the following equation applies:

${k}_{1}=\frac{\frac{1}{n}\sum _{i=1}^{n}{\left({x}_{i}-\overline{x}\right)}^{4}}{{\left(\frac{1}{n}\sum _{i=1}^{n}{\left({x}_{i}-\overline{x}\right)}^{2}\right)}^{2}}$

When you set `flag` to 0, the following equation applies:

${k}_{0}=\frac{n-1}{\left(n-2\right)\left(n-3\right)}\left(\left(n+1\right){k}_{1}-3\left(n-1\right)\right)+3$

This bias-corrected formula requires that `X` contain at least four elements.