當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python statsmodels.omni_normtest()用法及代碼示例

借助statsmodels.omni_normtest()方法,我們可以獲得綜合測試的正態性,為此我們使用chi^2得分statsmodels.omni_normtest()方法。

用法: statsmodels.omni_normtest(array)
返回:Return the omnibus test for normality.

範例1:
在這個例子中,我們可以通過使用statsmodels.omni_normtest()方法,我們可以使用chi^2分數計算綜合測試的正態性。



# import numpy and statsmodels 
import numpy as np 
from statsmodels.stats.stattools import omni_normtest 
   
g = np.array([1, 2, 3, 4, 5, 6, 7, 8]) 
# Using statsmodels.omni_normtest() method 
gfg = omni_normtest(g) 
   
print(gfg)

輸出:

NormaltestResult(statistic=1.7004056883060088, pvalue=0.42732824212143383)

範例2:

# import numpy and statsmodels 
import numpy as np 
from statsmodels.stats.stattools import omni_normtest 
   
g = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) 
# Using statsmodels.omni_normtest() method 
gfg = omni_normtest(g) 
   
print(gfg)

輸出:

NormaltestResult(statistic=2.02697581498966, pvalue=0.362950830342156)




相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 statsmodels.omni_normtest() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。