5d8b81e16143d6eea9e86a586fe737854c03c772,linearmodels/tests/panel/test_panel_ols.py,,test_panel_time_lvsd_weighted,#Any#,475
Before Change
res2 = ols_mod.fit("robust")
assert_results_equal(res, res2, test_fit=False)
clusters = mod.reformat_clusters(data.vc1)
res = mod.fit(cov_type="clustered", clusters=clusters)
res2 = ols_mod.fit("clustered", clusters=clusters.dataframe)
assert_results_equal(res, res2, test_fit=False)
clusters = mod.reformat_clusters(data.vc2)
res = mod.fit(cov_type="clustered", clusters=clusters)
res2 = ols_mod.fit("clustered", clusters=clusters.dataframe)
assert_results_equal(res, res2, test_fit=False)
After Change
def test_panel_time_lvsd_weighted(data):
mod = PanelOLS(data.y, data.x, time_effect=True, weights=data.w)
res = mod.fit()
y = mod.dependent.dataframe
x = mod.exog.dataframe
w = mod.weights.dataframe
d = mod.dependent.dummies("time", drop_first=mod.has_constant)
d_cols = d.columns
d = d.values
if mod.has_constant:
z = np.ones_like(y)
root_w = np.sqrt(w.values)
wd = root_w * d
wz = root_w * z
d = d - z @ np.linalg.lstsq(wz, wd)[0]
xd = np.c_[x.values, d]
xd = pd.DataFrame(xd, index=x.index, columns=list(x.columns) + list(d_cols))
ols_mod = IV2SLS(y, xd, None, None, weights=w)
res2 = ols_mod.fit("unadjusted")
assert_results_equal(res, res2, test_fit=False)
res = mod.fit(cov_type="robust")
res2 = ols_mod.fit("robust")
assert_results_equal(res, res2, test_fit=False)
clusters = data.vc1
ols_clusters = mod.reformat_clusters(clusters)
res = mod.fit(cov_type="clustered", clusters=clusters)
res2 = ols_mod.fit("clustered", clusters=ols_clusters.dataframe)
assert_results_equal(res, res2, test_fit=False)
clusters = data.vc2
ols_clusters = mod.reformat_clusters(clusters)
res = mod.fit(cov_type="clustered", clusters=clusters)
res2 = ols_mod.fit("clustered", clusters=ols_clusters.dataframe)
assert_results_equal(res, res2, test_fit=False)
In pattern: SUPERPATTERN
Frequency: 6
Non-data size: 6
Instances
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_time_lvsd_weighted
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_both_lvsd
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_other_lvsd
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_time_lvsd
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_both_lvsd_weighted
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_time_lvsd_weighted
Project Name: bashtage/linearmodels
Commit Name: 5d8b81e16143d6eea9e86a586fe737854c03c772
Time: 2017-04-07
Author: kevin.k.sheppard@gmail.com
File Name: linearmodels/tests/panel/test_panel_ols.py
Class Name:
Method Name: test_panel_entity_lvsd_weighted