statsmodels.regression.linear_model.OLSResults.get_robustcov_results¶

OLSResults.
get_robustcov_results
(cov_type='HC1', use_t=None, **kwds)¶ create new results instance with robust covariance as default
Parameters: cov_type : string
the type of robust sandwich estimator to use. see Notes below
use_t : bool
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.
kwds : depends on cov_type
Required or optional arguments for robust covariance calculation. see Notes below
Returns: results : results instance
This method creates a new results instance with the requested robust covariance as the default covariance of the parameters. Inferential statistics like pvalues 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’ and optional keyword argument ‘scale’ which uses
a predefined scale estimate with default equal to one.
 ‘HC0’, ‘HC1’, ‘HC2’, ‘HC3’ and no keyword arguments:
heteroscedasticity robust covariance
‘HAC’ and keywords
 maxlag integer (required) : number of lags to use
 kernel string (optional) : kernel, default is Bartlett
 use_correction bool (optional) : If true, use small sample
 correction
‘cluster’ and required keyword groups, integer group indicator
 groups array_like, integer (required) :
 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 adjusted. If False, then df_resid of the results instance is not adjusted.
 ‘hacgroupsum’ Driscoll and Kraay, heteroscedasticity and
autocorrelation robust standard errors in panel data keywords
 time array_like (required) : index of time periods
 maxlag integer (required) : number of lags to use
 kernel string (optional) : kernel, default is Bartlett
 use_correction False or string in [‘hac’, ‘cluster’] (optional) :
 If False the the sandwich covariance is calulated 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)
 adjustment to df_resid, see cov_type ‘cluster’ above #TODO: we need more options here
 ‘hacpanel’ 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 timeseries of an individual or group can be either specified by group indicators or by increasing time periods.
keywords
 either groups or time : array_like (required) groups : indicator for groups time : index of time periods
 maxlag integer (required) : number of lags to use
 kernel string (optional) : kernel, default is Bartlett
 use_correction False or string in [‘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 #TODO: we need more options here
Reminder: use_correction in “hacgroupsum” and “hacpanel” is not bool, needs to be in [False, ‘hac’, ‘cluster’]
TODO: Currently there is no check for extra or misspelled keywords, except in the case of cov_type HCx