コード例 #1
0
ファイル: test_unitroot.py プロジェクト: chengshaozhe/arch
    def test_tstat(self):
        exog, endog = lagmat(self.inflation, 12, original='sep', trim='both')
        icbest, sel_lag = _autolag(OLS, endog, exog, 1, 11, 't-stat')
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, 't-stat')
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2

        exog, endog = lagmat(self.y, 12, original='sep', trim='both')
        icbest, sel_lag = _autolag(OLS, endog, exog, 1, 11, 't-stat')
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, 't-stat')
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2
コード例 #2
0
ファイル: test_unitroot.py プロジェクト: syncoding/arch
    def test_tstat(self):
        exog, endog = lagmat(self.inflation, 12, original="sep", trim="both")
        _, sel_lag = _autolag(OLS, endog, exog, 1, 11, "t-stat")
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, "t-stat")
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2

        exog, endog = lagmat(self.y, 12, original="sep", trim="both")
        _, sel_lag = _autolag(OLS, endog, exog, 1, 11, "t-stat")
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, "t-stat")
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2
コード例 #3
0
ファイル: test_unitroot.py プロジェクト: esvhd/arch
    def test_tstat(self):
        exog, endog = lagmat(self.inflation, 12, original='sep', trim='both')
        icbest, sel_lag = _autolag(OLS, endog, exog, 1, 11, 't-stat')
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, 't-stat')
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2

        exog, endog = lagmat(self.y, 12, original='sep', trim='both')
        icbest, sel_lag = _autolag(OLS, endog, exog, 1, 11, 't-stat')
        icbest2, sel_lag2 = _autolag_ols(endog, exog, 0, 12, 't-stat')
        assert np.isscalar(icbest2)
        assert np.isscalar(sel_lag2)
        assert sel_lag == sel_lag2
コード例 #4
0
ファイル: test_unitroot.py プロジェクト: chengshaozhe/arch
 def test_tstat_exogenous(self):
     exog, endog = lagmat(self.z, 12, original='sep', trim='both')
     exog = np.concatenate([self.x[12:], exog], axis=1)
     icbest, sel_lag = _autolag_ols(endog, exog, 2, 12, 't-stat')
     direct = np.zeros(exog.shape[1])
     for i in range(3, exog.shape[1]):
         res = OLS(endog, exog[:, :i]).fit()
         direct[i] = res.tvalues[-1]
     crit = stats.norm.ppf(0.95)
     assert np.max(np.argwhere(np.abs(direct[2:]) > crit)) == sel_lag
コード例 #5
0
ファイル: test_unitroot.py プロジェクト: chengshaozhe/arch
 def test_bic_exogenous(self):
     exog, endog = lagmat(self.z, 12, original='sep', trim='both')
     exog = np.concatenate([self.x[12:], exog], axis=1)
     icbest, sel_lag = _autolag_ols(endog, exog, 2, 12, 'bic')
     direct = np.zeros(exog.shape[1])
     direct.fill(np.inf)
     for i in range(3, exog.shape[1]):
         res = OLS(endog, exog[:, :i]).fit()
         direct[i] = res.bic
     assert np.argmin(direct[2:]) == sel_lag
コード例 #6
0
ファイル: test_unitroot.py プロジェクト: esvhd/arch
 def test_tstat_exogenous(self):
     exog, endog = lagmat(self.z, 12, original='sep', trim='both')
     exog = np.concatenate([self.x[12:], exog], axis=1)
     icbest, sel_lag = _autolag_ols(endog, exog, 2, 12, 't-stat')
     direct = np.zeros(exog.shape[1])
     for i in range(3, exog.shape[1]):
         res = OLS(endog, exog[:, :i]).fit()
         direct[i] = res.tvalues[-1]
     crit = stats.norm.ppf(0.95)
     assert np.max(np.argwhere(np.abs(direct[2:]) > crit)) == sel_lag
コード例 #7
0
ファイル: test_unitroot.py プロジェクト: esvhd/arch
 def test_bic_exogenous(self):
     exog, endog = lagmat(self.z, 12, original='sep', trim='both')
     exog = np.concatenate([self.x[12:], exog], axis=1)
     icbest, sel_lag = _autolag_ols(endog, exog, 2, 12, 'bic')
     direct = np.zeros(exog.shape[1])
     direct.fill(np.inf)
     for i in range(3, exog.shape[1]):
         res = OLS(endog, exog[:, :i]).fit()
         direct[i] = res.bic
     assert np.argmin(direct[2:]) == sel_lag