scipy.stats.kurtosistest¶
-
scipy.stats.
kurtosistest
(a, axis=0, nan_policy='propagate')[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:
kurtosis = 3(n-1)/(n+1)
.Parameters: - a : array
array of the sample data
- axis : int 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. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default is ‘propagate’.
Returns: - statistic : float
The computed z-score for this test.
- pvalue : float
The 2-sided p-value for the hypothesis test
Notes
Valid only for n>20. The Z-score is set to 0 for bad entries. This function uses the method described in [1].
References
[1] (1, 2) 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)
>>> np.random.seed(28041990) >>> s = np.random.normal(0, 1, 1000) >>> kurtosistest(s) KurtosistestResult(statistic=1.2317590987707365, pvalue=0.21803908613450895)