# statsmodels.regression.linear_model.OLSResults.get_robustcov_results¶

OLSResults.get_robustcov_results(cov_type=`'HC1'`, use_t=`None`, **kwargs)

Create new results instance with robust covariance as default.

Parameters:
cov_type`str`

The type of robust sandwich estimator to use. See Notes below.

use_tbool

If true, then the t distribution is used for inference. If false, then the normal distribution is used. If use_t is None, then an appropriate default is used, which is True if the cov_type is nonrobust, and False in all other cases.

**kwargs

Required or optional arguments for robust covariance calculation. See Notes below.

Returns:
`RegressionResults`

This method creates a new results instance with the requested robust covariance as the default covariance of the parameters. Inferential statistics like p-values and hypothesis tests will be based on this covariance matrix.

Notes

The following covariance types and required or optional arguments are currently available:

• ‘fixed scale’ uses a predefined scale

`scale`: float, optional

Argument to set the scale. Default is 1.

• ‘HC0’, ‘HC1’, ‘HC2’, ‘HC3’: heteroscedasticity robust covariance

• no keyword arguments

• ‘HAC’: heteroskedasticity-autocorrelation robust covariance

`maxlags`integer, required

number of lags to use

`kernel`{callable, str}, optional

kernels currently available kernels are [‘bartlett’, ‘uniform’], default is Bartlett

`use_correction`: bool, optional

If true, use small sample correction

• ‘cluster’: clustered covariance estimator

`groups`array_like[int], required :

Integer-valued index of clusters or groups.

`use_correction`: bool, optional

If True the sandwich covariance is calculated with a small sample correction. If False the sandwich covariance is calculated without small sample correction.

`df_correction`: bool, optional

If True (default), then the degrees of freedom for the inferential statistics and hypothesis tests, such as pvalues, f_pvalue, conf_int, and t_test and f_test, are based on the number of groups minus one instead of the total number of observations minus the number of explanatory variables. df_resid of the results instance is also adjusted. When use_t is also True, then pvalues are computed using the Student’s t distribution using the corrected values. These may differ substantially from p-values based on the normal is the number of groups is small. If False, then df_resid of the results instance is not adjusted.

• ‘hac-groupsum’: Driscoll and Kraay, heteroscedasticity and autocorrelation robust covariance for panel data # TODO: more options needed here

`time`array_like, required

index of time periods

`maxlags`integer, required

number of lags to use

`kernel`{callable, str}, optional

The available kernels are [‘bartlett’, ‘uniform’]. The default is Bartlett.

`use_correction`{False, ‘hac’, ‘cluster’}, optional

If False the the sandwich covariance is calculated without small sample correction. If use_correction = ‘cluster’ (default), then the same small sample correction as in the case of covtype=’cluster’ is used.

`df_correction`bool, optional

The adjustment to df_resid, see cov_type ‘cluster’ above

• ‘hac-panel’: heteroscedasticity and autocorrelation robust standard errors in panel data. The data needs to be sorted in this case, the time series for each panel unit or cluster need to be stacked. The membership to a time series of an individual or group can be either specified by group indicators or by increasing time periods. One of `groups` or `time` is required. # TODO: we need more options here

`groups`array_like[int]

indicator for groups

`time`array_like[int]

index of time periods

`maxlags`int, required

number of lags to use

`kernel`{callable, str}, optional

Available kernels are [‘bartlett’, ‘uniform’], default is Bartlett

`use_correction`{False, ‘hac’, ‘cluster’}, optional

If False the sandwich covariance is calculated without small sample correction.

`df_correction`bool, optional

Adjustment to df_resid, see cov_type ‘cluster’ above

Reminder: `use_correction` in “hac-groupsum” and “hac-panel” is not bool, needs to be in {False, ‘hac’, ‘cluster’}.

Last update: Sep 01, 2023
{"ft_lang_label":"__label__en","ft_lang_prob":0.7091866,"math_prob":0.80099046,"size":4079,"snap":"2023-40-2023-50","text_gpt3_token_len":930,"char_repetition_ratio":0.13251534,"word_repetition_ratio":0.101604275,"special_character_ratio":0.20225546,"punctuation_ratio":0.15519765,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9769209,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-24T12:51:58Z\",\"WARC-Record-ID\":\"<urn:uuid:d826f56c-81ad-4b1a-b0a4-229f3835ce71>\",\"Content-Length\":\"77762\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7e4de768-eff0-4739-b6ff-4cb1eaa3a392>\",\"WARC-Concurrent-To\":\"<urn:uuid:847b3dcf-d9e3-4537-8c94-61ad6502a8d8>\",\"WARC-IP-Address\":\"185.199.108.153\",\"WARC-Target-URI\":\"https://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.OLSResults.get_robustcov_results.html\",\"WARC-Payload-Digest\":\"sha1:QPPHSICB4SMNBSDGXHNLXW5OHELAOOOE\",\"WARC-Block-Digest\":\"sha1:6KK64XFDGYK7QFQZQE7IZOGUHIUVNIHO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506646.94_warc_CC-MAIN-20230924123403-20230924153403-00388.warc.gz\"}"}