pythonmatlabkurtosis

kurtosis function show different values in python and matlab


Python 3.5 MATLAB 2013b

I have a simple array.

MATLAB:

x = [1,2,3,4,5];
kurtosis(x)

1.7

Python:

def mykurtosis(x):
    return scipy.stats.kurtosis(x)

x = [1,2,3,4,5]
print(mykurtosis(x))

-1.3

Why it shows different outputs ?

Is it the right way to define in Python ?


Solution

  • You're using Fisher's definition, you intend to use Pearson’s definition of kurtosis:

    IN: scipy.stats.kurtosis([1,2,3,4,5], axis=0, fisher=False)
    OUT: 1.7