コード例 #1
0
ファイル: try_chisquare.py プロジェクト: id774/sandbox
# -*- coding: utf-8 -*-

import chisquare
import scipy as sp

array = sp.array([[435, 165],
                  [265, 135]])
ch2, p = chisquare.chisquare_test(array)

print("カイ二乗値は %(ch2)s" % locals())
print("確率は %(p)s" % locals())

if p < 0.05:
    print("有意な差があります")
else:
    print("有意な差がありません")
コード例 #2
0
ファイル: test_chisquare.py プロジェクト: id774/sandbox
def test_chisquare_test():
    array = sp.array([[435, 165],
                      [265, 135]])
    (ch2, pval) = chisquare.chisquare_test(array)
    assert_almost_equal(ch2, 4.46, 2)
    assert_almost_equal(pval, 0.03, 2)