scipy.stats.kurtosistest

scipy.stats.kurtosistest(a, axis=0, nan_policy='propagate', alternative='two-sided')[source]

Test whether a dataset has normal kurtosis.

This function tests the null hypothesis that the kurtosis of the population from which the sample was drawn is that of the normal distribution.

Parameters
aarray

Array of the sample data.

axisint or None, optional

Axis along which to compute test. Default is 0. If None, compute over the whole array a.

nan_policy{‘propagate’, ‘raise’, ‘omit’}, optional

Defines how to handle when input contains nan. The following options are available (default is ‘propagate’):

  • ‘propagate’: returns nan

  • ‘raise’: throws an error

  • ‘omit’: performs the calculations ignoring nan values

alternative{‘two-sided’, ‘less’, ‘greater’}, optional

Defines the alternative hypothesis. The following options are available (default is ‘two-sided’):

  • ‘two-sided’: the kurtosis of the distribution underlying the sample is different from that of the normal distribution

  • ‘less’: the kurtosis of the distribution underlying the sample is less than that of the normal distribution

  • ‘greater’: the kurtosis of the distribution underlying the sample is greater than that of the normal distribution

New in version 1.7.0.

Returns
statisticfloat

The computed z-score for this test.

pvaluefloat

The p-value for the hypothesis test.

Notes

Valid only for n>20. This function uses the method described in [1].

References

1

see e.g. F. J. Anscombe, W. J. Glynn, “Distribution of the kurtosis statistic b2 for normal samples”, Biometrika, vol. 70, pp. 227-234, 1983.

Examples

>>> from scipy.stats import kurtosistest
>>> kurtosistest(list(range(20)))
KurtosistestResult(statistic=-1.7058104152122062, pvalue=0.08804338332528348)
>>> kurtosistest(list(range(20)), alternative='less')
KurtosistestResult(statistic=-1.7058104152122062, pvalue=0.04402169166264174)
>>> kurtosistest(list(range(20)), alternative='greater')
KurtosistestResult(statistic=-1.7058104152122062, pvalue=0.9559783083373583)
>>> rng = np.random.default_rng()
>>> s = rng.normal(0, 1, 1000)
>>> kurtosistest(s)
KurtosistestResult(statistic=-1.475047944490622, pvalue=0.14019965402996987)