예제 #1
0
def test_against_direct_model(data):
    keys = list(data.keys())
    if not isinstance(data[keys[0]], Mapping):
        return
    if 'weights' in data[keys[0]]:
        return
    y = []
    x = []
    data_copy = OrderedDict()
    for i in range(min(3, len(data))):
        data_copy[keys[i]] = data[keys[i]]
        y.append(data[keys[i]]['dependent'])
        x.append(data[keys[i]]['exog'])

    direct = simple_sur(y, x)
    mod = SUR(data_copy)
    res = mod.fit(method='ols')
    assert_allclose(res.params.values[:, None], direct.beta0)

    res = mod.fit(method='gls')
    assert_allclose(res.params.values[:, None], direct.beta1)
예제 #2
0
def test_against_direct_model(data):
    keys = list(data.keys())
    if not isinstance(data[keys[0]], Mapping):
        return
    if "weights" in data[keys[0]]:
        return
    y = []
    x = []
    data_copy = {}
    for i in range(min(3, len(data))):
        data_copy[keys[i]] = data[keys[i]]
        y.append(data[keys[i]]["dependent"])
        x.append(data[keys[i]]["exog"])

    direct = simple_sur(y, x)
    mod = SUR(data_copy)
    res = mod.fit(method="ols")
    assert_allclose(res.params.values[:, None], direct.beta0)

    res = mod.fit(method="gls")
    assert_allclose(res.params.values[:, None], direct.beta1)