Beispiel #1
0
def test_liml_direct(data):
    mod = IVLIML(data.dep, data.exog, data.endog, data.instr)
    nobs = data.dep.shape[0]
    ninstr = data.exog.shape[1] + data.instr.shape[1]
    res = mod.fit()
    get_all(res)
    mod2 = IVLIML(data.dep, data.exog, data.endog, data.instr, kappa=res.kappa)
    res2 = mod2.fit()
    assert_allclose(res.params, res2.params)
    mod3 = IVLIML(data.dep, data.exog, data.endog, data.instr, fuller=1)
    res3 = mod3.fit()
    assert_allclose(res3.kappa, res.kappa - 1 / (nobs - ninstr))
Beispiel #2
0
 def test_fuller_error(self, data):
     with pytest.raises(ValueError):
         IVLIML(data.dep,
                data.exog,
                data.endog,
                data.instr,
                fuller=np.array([1]))
Beispiel #3
0
def test_kappa_error_exception(data):
    with pytest.raises(ValueError):
        IVLIML(data.dep,
               data.exog,
               data.endog,
               data.instr,
               kappa=np.array([1]))
Beispiel #4
0
 def test_kappa_fuller_warning(self, data):
     with warnings.catch_warnings(record=True) as w:
         IVLIML(data.dep,
                data.exog,
                data.endog,
                data.instr,
                kappa=0.99,
                fuller=1)
     assert len(w) == 1