'Create new results instance with specified covariance estimator as
default
Note: creating new results instance currently not supported.
Parameters
cov_type : string
the type of covariance matrix estimator to use. See Notes below
kwargs : depends on cov_type
Required or optional arguments for covariance calculation.
See Notes below.
Returns
results : results instance
This method creates a new results instance with the requested
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:
- \'opg\' for the outer product of gradient estimator
- \'oim\' for the observed information matrix estimator, calculated
using the method of Harvey (1989)
- \'approx\' for the observed information matrix estimator,
calculated using a numerical approximation of the Hessian matrix.
Uses complex step approximation by default, or uses finite
differences if `approx_complex_step=False` in the `cov_kwds`
dictionary.
- \'robust\' for an approximate (quasi-maximum likelihood) covariance
matrix that may be valid even in the presense of some
misspecifications. Intermediate calculations use the \'oim\'
method.
- \'robust_approx\' is the same as \'robust\' except that the
intermediate calculations use the \'approx\' method.
- \'none\' for no covariance matrix calculation.'

def _get_robustcov_results(self, cov_type='opg', **kwargs):

    use_self = kwargs.pop('use_self', False)
    if use_self:
        res = self
    else:
        raise NotImplementedError
        res = self.__class__(self.model, self.params, normalized_cov_params=self.normalized_cov_params, scale=self.scale)
    res.cov_type = cov_type
    res.cov_kwds = {}
    approx_complex_step = self._cov_approx_complex_step
    if approx_complex_step:
        approx_type_str = 'complex-step'
    elif self._cov_approx_centered:
        approx_type_str = 'centered    finite    differences'
    else:
        approx_type_str = 'finite    differences'
    k_params = len(self.params)
    if (k_params == 0):
        res.cov_params_default = np.zeros((0, 0))
        res._rank = 0
        res.cov_kwds['description'] = 'No    parameters    estimated.'
    elif (cov_type == 'custom'):
        res.cov_type = kwargs['custom_cov_type']
        res.cov_params_default = kwargs['custom_cov_params']
        res.cov_kwds['description'] = kwargs['custom_description']
        res._rank = np.linalg.matrix_rank(res.cov_params_default)
    elif (cov_type == 'none'):
        res.cov_params_default = (np.zeros((k_params, k_params)) * np.nan)
        res._rank = np.nan
        res.cov_kwds['description'] = 'Covariance    matrix    not    calculated.'
    elif (self.cov_type == 'approx'):
        res.cov_params_default = res.cov_params_approx
        res.cov_kwds['description'] = ('Covariance    matrix    calculated    using    numerical    (%s)    differentiation.' % approx_type_str)
    elif (self.cov_type == 'oim'):
        res.cov_params_default = res.cov_params_oim
        res.cov_kwds['description'] = ('Covariance    matrix    calculated    using    the    observed    information    matrix    (%s)    described    in    Harvey    (1989).' % approx_type_str)
    elif (self.cov_type == 'opg'):
        res.cov_params_default = res.cov_params_opg
        res.cov_kwds['description'] = ('Covariance    matrix    calculated    using    the    outer    product    of    gradients    (%s).' % approx_type_str)
    elif ((self.cov_type == 'robust') or (self.cov_type == 'robust_oim')):
        res.cov_params_default = res.cov_params_robust_oim
        res.cov_kwds['description'] = ('Quasi-maximum    likelihood    covariance    matrix    used    for    robustness    to    some    misspecifications;    calculated    using    the    observed    information    matrix    (%s)    described    in    Harvey    (1989).' % approx_type_str)
    elif (self.cov_type == 'robust_approx'):
        res.cov_params_default = res.cov_params_robust
        res.cov_kwds['description'] = ('Quasi-maximum    likelihood    covariance    matrix    used    for    robustness    to    some    misspecifications;    calculated    using    numerical    (%s)    differentiation.' % approx_type_str)
    else:
        raise NotImplementedError('Invalid    covariance    matrix    type.')
    return res
