I calculated a simple OLS Regression like this: model = sm.OLS(y,X)
, results = model.fit()
I found that my residuals are heteroskedastic. That's why I calculated a robust covariance matrix in order to get robust standard errors and calculate new t-stats according to those robust standard errors. The robust covariance-matrix I calculated by using:
robust_cov = sm.stats.sandwich_covariance.cov_white_simple(results, use_correction=True)
From which I could extract robust standard errors:
robust_se = sm.stats.sandwich_covariance.se_cov(robust_cov)
Now I would like to use the robust_se
to calculate new t-stats but I have no clue how to do that.
I have stumbled upon a question which I think should actually explain well enough how to solve my problem: Getting statsmodels to use heteroskedasticity corrected standard errors in coefficient t-tests
Unfortunately, I don't quite understand the explanation. Respectively, I tried to do results = model_ols.fit(cov_type='HC0')
(and HC1, HC2, HC3) as mentioned in the question above. But that leaves me with exactly the same standard erros and t-stats as in the original model.
Can anyone give me a hint what I do wrong?