Python中的 statsmodels.jarque_bera()
借助statsmodels.jarque_bera()
方法,我们可以得到 jarque bera 正态性检验,它是基于偏度和峰度的检验,具有渐近分布。
Syntax : statsmodels.jarque_bera(residual, axis)
Return : Return the jarque bera test statistics, pvalue, skewness, and the kurtosis.
示例 #1:
在这个例子中我们可以看到,通过使用statsmodels.jarque_bera()
方法,我们可以通过这个方法得到 jarque bera 测试统计、pvalue、偏度和峰度。
# import numpy and statsmodels
import numpy as np
from statsmodels.stats.stattools import jarque_bera
g = np.array([1, 2, 3])
# Using statsmodels.jarque_bera() method
gfg = jarque_bera(g)
print(gfg)
输出 :
(0.28125, 0.8688150562628432, 0.0, 1.5)
示例 #2:
# import numpy and statsmodels
import numpy as np
from statsmodels.stats.stattools import jarque_bera
g = np.array([1, 2, 3, -1, -2, -3])
# Using statsmodels.jarque_bera() method
gfg = jarque_bera(g)
print(gfg)
输出 :
(0.5625000000000003, 0.7548396019890072, 0.0, 1.4999999999999996)