Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robust Linear Regression Results in Python and Stata Do Not Agree

My groupmates and I were doing this assignment that involves running a regression on Fama-French 3 factor model. I used python Statsmodels module and they used Stata and we share the same set of data. For Ordinary Least Squares regression, we got the same answers. But robust regression results for some reason don't agree.

Here is the result from Stata: enter image description here

Here is the result from Statsmodels: enter image description here

Just wondering what could be the cause of this issue? Any way to resolve it? I also tried different methods (HuberT, RamsayE etc) in Statsmodels and none of them had the same answers as the result from Stata. Any help is appreciated.

like image 565
Daniel Xin Li Avatar asked Dec 13 '22 20:12

Daniel Xin Li


1 Answers

The equivalent of Stata's

regress ..., robust

in statsmodels is

OLS(...).fit(cov_type='HC1')

The options for the robust sandwich covariance matrices are here http://www.statsmodels.org/devel/generated/statsmodels.regression.linear_model.RegressionResults.get_robustcov_results.html, but the use is through the fit keywords.

There is an incomplete FAQ answer for differences in robust standard errors between Stata and statsmodels. https://github.com/statsmodels/statsmodels/issues/1923

statsmodel.robust and RLM refer to outlier robust estimation. This is an M-estimator and the covariance has the original Huber sandwich form.

Here is the main page for statsmodels.robust http://www.statsmodels.org/devel/rlm.html and the documentation for RLM http://www.statsmodels.org/devel/generated/statsmodels.robust.robust_linear_model.RLM.html

like image 191
Josef Avatar answered Jan 22 '23 03:01

Josef