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))
def test_fuller_error(self, data): with pytest.raises(ValueError): IVLIML(data.dep, data.exog, data.endog, data.instr, fuller=np.array([1]))
def test_kappa_error_exception(data): with pytest.raises(ValueError): IVLIML(data.dep, data.exog, data.endog, data.instr, kappa=np.array([1]))
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