Standard Errors assume that the covariance matrix of the errors is correctly specified

1,293 views
Skip to first unread message

Mark Hansen

unread,
Jan 22, 2021, 9:51:16 AM1/22/21
to pystatsmodels
I see this note every time I run an OLS regression with statsmodels. See example attached. I'm not sure exactly what this means. How can I specify the covariance matrix of the errors?  And what is the default used by statsmodels?




2021-01-22_09-20-38.png

josef...@gmail.com

unread,
Jan 22, 2021, 10:32:42 AM1/22/21
to pystatsmodels
On Fri, Jan 22, 2021 at 9:51 AM Mark Hansen <ma...@rarekarma.com> wrote:
>
> I see this note every time I run an OLS regression with statsmodels. See example attached. I'm not sure exactly what this means. How can I specify the covariance matrix of the errors? And what is the default used by statsmodels?

Hi,

This is a bit of advertising for using standard errors that are robust
to unequal variances across observations or correlation between
observations, mainly for fields where they are not yet popular.

The default in statsmodels are the usual standard errors that assume
that variance is constant, that there is no correlation of errors in
the linear model and in general assumes correctly specified model,
i.e. likelihood function.
Robust standard errors can be selected using the `cov_type` option
when calling `fit` of a model.

For example, in a simple two sample mean t-tests we have the option to
assume that the variance across two samples are the same, or we allow
them to be different.
Heteroscedasticity robust standard errors allow unequal variance in
regression similar to the simple t-test.

Even with incorrectly specified correlation and variance we can still
consistently estimate the parameters for the mean function like y=X*b
in OLS and GLM, but the usual nonrobust standard errors, p-values and
confidence intervals for the parameters are wrong. Using robust
standard errors provides correct inference for the parameters even if
there is heteroscedasticity and correlation.
Choosing robust standard errors does not change the parameter
estimate, and therefore not the predictions, it only fixes inference
for those.

Our documentation is still not very good for this.
https://stats.stackexchange.com/questions/452/always-report-robust-white-standard-errors
https://stackoverflow.com/questions/30553838/getting-statsmodels-to-use-heteroskedasticity-corrected-standard-errors-in-coeff
https://stackoverflow.com/questions/23420454/newey-west-standard-errors-for-ols-in-python/23421518

Some textbooks in econometrics (for economists) recommend using robust
standard errors by default, but that would be too confusing for
statsmodels users that are not in one of the robust standard error
fields.

Josef

>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/d2332114-7895-439a-8b18-665d95143b43n%40googlegroups.com.

Mark Hansen

unread,
Jan 25, 2021, 9:25:56 AM1/25/21
to pystatsmodels
Josef, thanks for that explanation. Very helpful!
Reply all
Reply to author
Forward
0 new messages