Function Repository Resource:

KurtosisAround

Source Notebook

Calculate the kurtosis of a list along with its uncertainty

Contributed by: Sander Huisman

ResourceFunction["KurtosisAround"][{x1,x2,x3,}]

gives an Around object describing the kurtosis and corresponding uncertainty of the xi.

Details

The standard error of the kurtosis is defined as: , 
where n is the number of samples, and the first radical is the standard error of the skewness.
The "Value" property of the Around object is calculated using the built-in Kurtosis function.

Examples

Basic Examples (1) 

Calculate the kurtosis of some numbers:

In[1]:=
ResourceFunction["KurtosisAround"][{1.1, 2.2, 2.6, 1.4, 2.2, 2.3}]
Out[1]=

Scope (2) 

KurtosisAround works with symbolic expressions:

In[2]:=
ResourceFunction["KurtosisAround"][{a, b, c, d}]
Out[2]=

KurtosisAround also works with quantities with units, though the answer is dimensionless:

In[3]:=
values = {Quantity[1, "Meters"], Quantity[1.1, "Meters"], Quantity[0.98, "Meters"], Quantity[0.99, "Meters"]};
ResourceFunction["KurtosisAround"][values]
Out[4]=

The kurtosis is independent of the units:

In[5]:=
ResourceFunction["KurtosisAround"][UnitConvert[values, "Feet"]]
Out[5]=

Properties and Relations (1) 

The standard error has an asymptote of where n is the number of data points:

In[6]:=
Asymptotic[
 2 Sqrt[(6 n (n - 1))/((n - 2) (n + 1) (n + 3))] Sqrt[(
  n^2 - 1)/((n - 3) (n + 5))], n -> \[Infinity]]
Out[6]=

Possible Issues (3) 

KurtosisAround applied to symbolic expressions can get unwieldy fast:

In[7]:=
ResourceFunction[
 "KurtosisAround"][{a, b, c, d, e, f, g, h, i, j, k, l}]
Out[7]=

At least four value are needed to give a plausible error estimate:

In[8]:=
ResourceFunction["KurtosisAround"][{1, 2, 3}]
Out[8]=

Try with 4 values:

In[9]:=
ResourceFunction["KurtosisAround"][{1, 2, 3, 8}]
Out[9]=

Kurtosis can be Indeterminate, in which case there will not be an Around result:

In[10]:=
ResourceFunction["KurtosisAround"][{0, 0, 0, 0, 0}]
Out[10]=

Neat Examples (1) 

Study the kurtosis and its uncertainty for a sequence of values and compare it to the theoretical value of the distribution (dashed):

In[11]:=
SeedRandom[4321];
dist = SkewNormalDistribution[2, 3, 3];
vals = RandomVariate[dist, 10^7];
values = Table[{n, ResourceFunction["KurtosisAround"][Take[vals, n]]}, {n, Round[10^Range[1.25, Log10@Length[vals], 1/6]]}];
ListLogLinearPlot[values, PlotRange -> {{10, 10^7}, {1, 4}}, GridLines -> {{}, {Kurtosis[dist]}}, GridLinesStyle -> Dashed, AxesLabel -> {"Number of values", "Estimate of the kurtosis"}, ImageSize -> 500]
Out[12]=

Publisher

SHuisman

Version History

  • 1.0.0 – 21 November 2022

Source Metadata

Related Resources

License Information