Ejemplo n.º 1
0
    def test_ttest_tvalues(self):
        # test that t_test has same results a params, bse, tvalues, ...
        smt.check_ttest_tvalues(self.results)

        res = self.results
        mat = np.eye(len(res.params))

        tt = res.t_test(mat[0])
        string_confint = lambda alpha: "[%4.3F      %4.3F]" % (alpha / 2, 1 -
                                                               alpha / 2)
        summ = tt.summary()  # smoke test for #1323
        assert_allclose(tt.pvalue, res.pvalues[0], rtol=5e-10)
        assert_(string_confint(0.05) in str(summ))

        # issue #3116 alpha not used in column headers
        summ = tt.summary(alpha=0.1)
        ss = "[0.05       0.95]"  # different formatting
        assert_(ss in str(summ))

        summf = tt.summary_frame(alpha=0.1)
        pvstring_use_t = 'P>|z|' if res.use_t is False else 'P>|t|'
        tstring_use_t = 'z' if res.use_t is False else 't'
        cols = [
            'coef', 'std err', tstring_use_t, pvstring_use_t, 'Conf. Int. Low',
            'Conf. Int. Upp.'
        ]
        assert_array_equal(summf.columns.values, cols)
    def test_ttest_tvalues(self):
        # test that t_test has same results a params, bse, tvalues, ...
        smt.check_ttest_tvalues(self.results)

        res = self.results
        mat = np.eye(len(res.params))

        tt = res.t_test(mat[0])
        string_confint = lambda alpha: "[%4.3F      %4.3F]" % (
                                       alpha / 2, 1- alpha / 2)
        summ = tt.summary()   # smoke test for #1323
        assert_allclose(tt.pvalue, res.pvalues[0], rtol=5e-10)
        assert_(string_confint(0.05) in str(summ))

        # issue #3116 alpha not used in column headers
        summ = tt.summary(alpha=0.1)
        ss = "[0.05       0.95]"   # different formatting
        assert_(ss in str(summ))

        summf = tt.summary_frame(alpha=0.1)
        pvstring_use_t = 'P>|z|' if res.use_t is False else 'P>|t|'
        tstring_use_t = 'z' if res.use_t is False else 't'
        cols = ['coef', 'std err', tstring_use_t, pvstring_use_t,
                'Conf. Int. Low', 'Conf. Int. Upp.']
        assert_array_equal(summf.columns.values, cols)
Ejemplo n.º 3
0
 def test_ttest(self):
     smt.check_ttest_tvalues(self.res1)
Ejemplo n.º 4
0
 def test_ttest(self):
     smt.check_ttest_tvalues(self.res1)
Ejemplo n.º 5
0
 def test_t_test(self):
     import statsmodels.tools._testing as smt
     #self.result_b.pvalues
     #self.result_b._cache['pvalues'] += 1  # use to trigger failure
     smt.check_ttest_tvalues(self.result_b)
     smt.check_ftest_pvalues(self.result_b)