示例#1
0
def test_gmm_cue_optimization_options(data):
    mod = IVGMMCUE(data.dep, data.exog, data.endog, data.instr)
    res_none = mod.fit(display=False)
    opt_options = dict(method="BFGS", options={"disp": False})
    res_bfgs = mod.fit(display=False, opt_options=opt_options)
    opt_options = dict(method="L-BFGS-B", options={"disp": False})
    res_lbfgsb = mod.fit(display=False, opt_options=opt_options)
    assert res_none.iterations > 2
    assert res_bfgs.iterations > 2
    assert res_lbfgsb.iterations >= 1

    mod2 = IVGMM(data.dep, data.exog, data.endog, data.instr)
    res2 = mod2.fit()
    assert res_none.j_stat.stat <= res2.j_stat.stat
    assert res_bfgs.j_stat.stat <= res2.j_stat.stat
    assert res_lbfgsb.j_stat.stat <= res2.j_stat.stat
示例#2
0
def test_gmm_cue_starting_vals(data):
    mod = IVGMM(data.dep, data.exog, data.endog, data.instr)
    sv = mod.fit().params
    mod = IVGMMCUE(data.dep, data.exog, data.endog, data.instr)
    mod.fit(starting=sv, display=False)

    with pytest.raises(ValueError):
        mod.fit(starting=sv[:-1], display=True)
示例#3
0
def test_gmm_cue(data):
    mod = IVGMMCUE(data.dep, data.exog, data.endog, data.instr)
    res = mod.fit(display=False)
    assert res.iterations > 2
    mod2 = IVGMM(data.dep, data.exog, data.endog, data.instr)
    res2 = mod2.fit()
    assert res.j_stat.stat <= res2.j_stat.stat

    mod = IVGMMCUE(data.dep, data.exog, data.endog, data.instr, center=False)
    res = mod.fit(display=False)
    mod2 = IVGMM(data.dep, data.exog, data.endog, data.instr, center=False)
    res2 = mod2.fit()
    assert res.j_stat.stat <= res2.j_stat.stat