Kurtosis function in Julia

863 views Asked by At

So I've been playing around with Julia, and I've discovered that the function to calculate the kurtosis of a probability distribution is implemented differently between Julia and MATLAB.

In Julia, do:

using Distributions
dist = Beta(3, 5)
x = rand(dist, 10000)
kurtosis(x) #gives a value approximately around -0.42

In MATLAB do:

x = betarnd(3, 5, [1, 10000]);
kurtosis(x) %gives something approximately around 2.60

What's happening here? Why is the kurtosis different between the two languages?

1

There are 1 answers

0
Alexander Morley On BEST ANSWER

As explained here: http://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm

We often use excess Kurtosis (Kurtosis - 3) so that the (Excess) Kurtosis of a normal distribution becomes zero. As shown in the distributions.jl docs that is what is used by kurtosis(x) in Julia.

Matlab does not use the excess measure (there is even a note in the docs that mentions this potential issue).