借助statsmodels.jarque_bera()
方法,我們可以得到jarque bera檢驗的正態性,它是基於偏度和峰度的檢驗,並且具有漸近分布。
用法:statsmodels.jarque_bera(residual, axis)
返回: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)
相關用法
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 statsmodels.jarque_bera() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。