示例#1
0
    def setup_class(cls,
                    true,
                    order,
                    trend,
                    error_cov_type,
                    cov_type='approx',
                    **kwargs):
        cls.true = true
        # 1960:Q1 - 1982:Q4
        dta = webuse('manufac', 'http://www.stata-press.com/data/r12/')

        dta.index = dta.month
        dta['dlncaputil'] = dta['lncaputil'].diff()
        dta['dlnhours'] = dta['lnhours'].diff()

        endog = dta.ix['1972-02-01':, ['dlncaputil', 'dlnhours']]

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            cls.model = varmax.VARMAX(endog,
                                      order=order,
                                      trend=trend,
                                      error_cov_type=error_cov_type,
                                      **kwargs)

        cls.results = cls.model.smooth(true['params'], cov_type=cov_type)
示例#2
0
def t_est_webuse():
    # test copied and adjusted from iolib/tests/test_foreign
    from statsmodels.iolib.tests.results.macrodata import macrodata_result as res2
    #base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    base_gh = "http://statsmodels.sourceforge.net/devel/_static/"
    res1 = webuse('macrodata', baseurl=base_gh, as_df=False)
    assert_array_equal(res1 == res2, True)
示例#3
0
    def __init__(self,
                 true,
                 order,
                 trend,
                 error_cov_type,
                 cov_type='oim',
                 **kwargs):
        self.true = true
        # 1960:Q1 - 1982:Q4
        dta = webuse('manufac', 'http://www.stata-press.com/data/r12/')

        dta.index = dta.month
        dta['dlncaputil'] = dta['lncaputil'].diff()
        dta['dlnhours'] = dta['lnhours'].diff()

        endog = dta.ix['1972-02-01':, ['dlncaputil', 'dlnhours']]

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            self.model = varmax.VARMAX(endog,
                                       order=order,
                                       trend=trend,
                                       error_cov_type=error_cov_type,
                                       **kwargs)

        self.results = self.model.filter(true['params'], cov_type=cov_type)
示例#4
0
def test_webuse():
    # test copied and adjusted from iolib/tests/test_foreign
    from statsmodels.iolib.tests.results.macrodata import macrodata_result as res2
    #base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    base_gh = "http://statsmodels.sourceforge.net/devel/_static/"
    res1 = webuse('macrodata', baseurl=base_gh, as_df=False)
    assert_array_equal(res1 == res2, True)
示例#5
0
def t_est_webuse_pandas():
    # test copied and adjusted from iolib/tests/test_foreign
    from pandas.util.testing import assert_frame_equal
    from statsmodels.datasets import macrodata
    dta = macrodata.load_pandas().data
    base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    res1 = webuse('macrodata', baseurl=base_gh)
    res1 = res1.astype(float)
    assert_frame_equal(res1, dta)
示例#6
0
def test_webuse():
    # test copied and adjusted from iolib/tests/test_foreign
    from statsmodels.iolib.tests.results.macrodata import macrodata_result as res2
    base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        raise SkipTest('Unable to retrieve file - skipping test')
    res1 = webuse('macrodata', baseurl=base_gh, as_df=False)
    assert_array_equal(res1, res2)
示例#7
0
def test_webuse_pandas():
    # test copied and adjusted from iolib/tests/test_foreign
    from pandas.util.testing import assert_frame_equal
    from statsmodels.datasets import macrodata
    dta = macrodata.load_pandas().data
    base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    res1 = webuse('macrodata', baseurl=base_gh)
    res1 = res1.astype(float)
    assert_frame_equal(res1, dta)
示例#8
0
def test_webuse_pandas():
    # test copied and adjusted from iolib/tests/test_foreign
    from pandas.util.testing import assert_frame_equal
    from statsmodels.datasets import macrodata
    dta = macrodata.load_pandas().data
    base_gh = "http://github.com/statsmodels/statsmodels/raw/master/statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        raise SkipTest('Unable to retrieve file - skipping test')
    res1 = webuse('macrodata', baseurl=base_gh)
    res1 = res1.astype(float)
    assert_frame_equal(res1, dta)
def test_webuse():
    # test copied and adjusted from iolib/tests/test_foreign
    from statsmodels.iolib.tests.results.macrodata import macrodata_result
    res2 = np.array([list(row) for row in macrodata_result])
    base_gh = "https://github.com/statsmodels/statsmodels/raw/master/" \
              "statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        pytest.skip('Unable to retrieve file - skipping test')
    try:
        res1 = webuse('macrodata', baseurl=base_gh, as_df=False)
    except IGNORED_EXCEPTIONS:
        pytest.skip('Failed with HTTPError or URLError, these are random')
    assert_array_equal(res1, res2)
示例#10
0
def test_webuse():
    # test copied and adjusted from iolib/tests/test_foreign
    from statsmodels.iolib.tests.results.macrodata import macrodata_result
    res2 = np.array([list(row) for row in macrodata_result])
    base_gh = "https://github.com/statsmodels/statsmodels/raw/master/" \
              "statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        pytest.skip('Unable to retrieve file - skipping test')
    try:
        res1 = webuse('macrodata', baseurl=base_gh, as_df=False)
    except (HTTPError, URLError, SSLError, timeout):
        pytest.skip('Failed with HTTPError or URLError, these are random')
    assert_array_equal(res1, res2)
def test_webuse_pandas():
    # test copied and adjusted from iolib/tests/test_foreign
    from pandas.util.testing import assert_frame_equal
    from statsmodels.datasets import macrodata
    dta = macrodata.load_pandas().data
    base_gh = "https://github.com/statsmodels/statsmodels/raw/master/" \
              "statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        pytest.skip('Unable to retrieve file - skipping test')
    try:
        res1 = webuse('macrodata', baseurl=base_gh)
    except IGNORED_EXCEPTIONS:
        pytest.skip('Failed with HTTP Error, these are random')
    res1 = res1.astype(float)
    assert_frame_equal(res1, dta.astype(float))
示例#12
0
def test_webuse_pandas():
    # test copied and adjusted from iolib/tests/test_foreign
    from pandas.util.testing import assert_frame_equal
    from statsmodels.datasets import macrodata
    dta = macrodata.load_pandas().data
    base_gh = "https://github.com/statsmodels/statsmodels/raw/master/" \
              "statsmodels/datasets/macrodata/"
    internet_available = check_internet(base_gh)
    if not internet_available:
        pytest.skip('Unable to retrieve file - skipping test')
    try:
        res1 = webuse('macrodata', baseurl=base_gh)
    except (HTTPError, URLError, SSLError, timeout):
        pytest.skip('Failed with HTTP Error, these are random')
    res1 = res1.astype(float)
    assert_frame_equal(res1, dta.astype(float))
示例#13
0
    def setup_class(cls, true, order, trend, error_cov_type, cov_type="approx", **kwargs):
        cls.true = true
        # 1960:Q1 - 1982:Q4
        dta = webuse("manufac", "http://www.stata-press.com/data/r12/")

        dta.index = dta.month
        dta["dlncaputil"] = dta["lncaputil"].diff()
        dta["dlnhours"] = dta["lnhours"].diff()

        endog = dta.ix["1972-02-01":, ["dlncaputil", "dlnhours"]]

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            cls.model = varmax.VARMAX(endog, order=order, trend=trend, error_cov_type=error_cov_type, **kwargs)

        cls.results = cls.model.smooth(true["params"], cov_type=cov_type)
示例#14
0
    def setup_class(cls, true, order, trend, error_cov_type, cov_type='oim',
                 **kwargs):
        cls.true = true
        # 1960:Q1 - 1982:Q4
        dta = webuse('manufac', 'http://www.stata-press.com/data/r12/')

        dta.index = dta.month
        dta['dlncaputil'] = dta['lncaputil'].diff()
        dta['dlnhours'] = dta['lnhours'].diff()

        endog = dta.ix['1972-02-01':, ['dlncaputil', 'dlnhours']]

        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            cls.model = varmax.VARMAX(endog, order=order, trend=trend,
                                       error_cov_type=error_cov_type, **kwargs)

        cls.results = cls.model.smooth(true['params'], cov_type=cov_type)