

def test_chisquare():
    res1 = Holder()
    res2 = Holder()
    res1.statistic = 2.084086388178453
    res1.parameter = 4
    res1.p_value = 0.72029651761105
    res1.method = 'Chi-squared test for given probabilities'
    freq.data_name = 'freq'
    res1.observed = np.array([1048, 660, 510, 420, 362])
    res1.expected = np.array([1020, 690, 510, 420, 360])
    res1.residuals = np.array([0.876714007519206, (- 1.142080481440321), (- 2.517068894406109e-15), (- 2.773674830645328e-15), 0.105409255338946])
    res2.statistic = 0.01492063492063492
    res2.parameter = 4
    res2.p_value = 0.999972309849908
    res2.method = 'Chi-squared test for given probabilities'
    res2.data_name = 'freq'
    res2.observed = np.array([1048, 660, 510, 420, 362])
    res2.expected = np.array([1050, 660, 510, 420, 360])
    res2.residuals = np.array([(- 0.06172133998483677), 0, (- 2.517068894406109e-15), (- 2.773674830645328e-15), 0.105409255338946])
    freq = np.array([1048, 660, 510, 420, 362])
    pr1 = np.array([1020, 690, 510, 420, 360])
    pr2 = np.array([1050, 660, 510, 420, 360])
    for (pr, res) in zip([pr1, pr2], [res1, res2]):
        (stat, pval) = chisquare(freq, pr)
        assert_almost_equal(stat, res.statistic, decimal=12)
        assert_almost_equal(pval, res.p_value, decimal=13)

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/tests/test_gof.py test_chisquare/VarMisuse@45/74 `res1`->`freq`