linearmodels.iv OLS and statsmodels.formula.api OLS does not give same results

  analysis, python, statistics

I run the OLS both from the statsmodels and linearmodels.iv as follows. They are supposed to be the same but the results are VERY different. Can you please tell me what you think of the reason?

`dep=[‘y’]

exog=[‘a’, ‘b’, ‘c’]

endog=[‘d’]

instr=[‘e’]

res_ols = IV2SLS(data.y, data[exog + endog], None, None).fit(cov_type = "clustered", clusters=data[‘member_id’])

print(res_ols)

model1 = smf.ols(formula=’y ~ a + C(b) + C(c) +C(d)’ , data=data).fit(cov_type=’cluster’, cov_kwds={‘groups’: data[‘member_id’]})

print(model1.summary())`

Thanks.

Source: Python Questions

LEAVE A COMMENT