Skip to content

SUMM: robust covariances: connect to models, default options #1158

Open

Description

@josef-pkt

there are several issues open for robust covariances:

specific here a comparison to Stata for possible options

related issues:
#44 add cov_p as argument to f_test and t_test, closed
#276 replacing cov inplace or create new instance or choose in fit()
#1418 and PR #1867 and #1870 add cov_type to fit method
#1922 followup issue to #1870 for details of interface in fit (and other todos)

model specific issues:
#1738 GLM (reference, and score_obs)
#1074 add robust cov to WLS (and others) (includes references)
#1095 robust cov for QMLE, #1750 same question GLM related
#863 (cluster) robust for MLE models
#1209 HCx after WLS, definition of hatmatrix
#1906 and PR #1916 GEE refactoring cov_type to fix a bug, should be refactored to follow same pattern
#1104 fvalue is wrong with unspecified heteroscedasticity - replaced by Wald test

      llnull likelihood ratio test for nonzero slope coefficients not yet replace by Wald test

#1016 refactor into cached attributes (among unrelated issues)

see also https://groups.google.com/d/msg/pystatsmodels/t5DmAO62lwQ/ZeY54VgSl6UJ

cov_types

which types of robust covariance matrices do we support,
Besides those currently in statsmodels.stats.sandwich_covariance:

Stata

regress uses HC1 by default after robust
ivreg2 uses HC1 with option small and HC0 without small
regress robust and ivreg2 small use t distribution in parameter table
ivreg2 default (without small) uses normal distribution in parameter table
reference for generic MLE sandwiches
U:20.21.2 Correlated errors, other sections in U, and P:_robust

Implementation

I made a start in https://github.com/josef-pkt/statsmodels/compare/robust_cov PR #1189
creating a new results instance in a results method
However, it would be better if the cov_params_default were set in the results __init__
problem: I don't have access to the Results Wrapper from inside the results when I create a new results instance, or how do we get access?
-> add to fit method as main access and selection point

I think cov_type='nonrobust' should be treated the same way as the robust covariances, currently we never store normalized_cov_params * scale

RLM and QuantileReg currently specify the type of robust cov in fit.

Econometrics

  • subclasses of RegressionResults (GLSAR, GLSHet, IV2SLS, ...) : for which are the results are valid?
  • result statistics and diagnostic tests : which ones are still valid?
    I needed to change the calculations for fvalue but there might be more.
    Likelihood ratio tests, compare_f
  • Extensions beyond OLS: Can I just use wresid for WLS, (F)GLS?
    yes, to get cov_params and parameter inference, I'm not sure about other statistical results
    see issue hat matrix, HC2, HC3 for WLS versus Stata #1209

Activity

  1. josef-pkt commented on Dec 19, 2013

    @josef-pkt
    MemberAuthor

    where is the issue for standardizing keyword arguments, cov_type across models in fit

    GEE uses covariance_type

  2. josef-pkt commented on Aug 23, 2014

    @josef-pkt
    MemberAuthor

    added new label topic_covtype

    cov_type is now available in regression model, discrete models and GLM
    GEE uses now partially the same pattern and naming (not yet fully refactored, lazy calculation)

    I need to go through the list of issues to see what's left to do.

  3. josef-pkt commented on Aug 26, 2014

    @josef-pkt
    MemberAuthor

    aside score in Stata is the score_factor to be multiplied with exog in the case of inner linear combination of exog,
    I used score_factor and hessian_factor in GLM.
    for issues that standardize score_obs and related

  4. jseabold commented on Sep 26, 2014

    @jseabold
    Member

    Is this just an issue to collect issues? What's the status of all of this?

  5. modified the milestones: 0.7, 0.6 on Sep 26, 2014
  6. josef-pkt commented on Sep 26, 2014

    @josef-pkt
    MemberAuthor

    Yes, I started to use SUMM issues to get an overview over issues related to a topic.
    I'm more than "halfway" through the robust covariances, but there is still a lot to do. The issues are a collection of references, definitions and refactorings that are required in various places, and "agile" development until I ended up with the current pattern.
    I need at least one more full round through all (non-tsa) models to have this finished in a consistent way.

    I haven't written anything for the release notes yet.

  7. modified the milestones: 0.8, 0.7 on Feb 6, 2015
  8. josef-pkt commented on Feb 19, 2016

    @josef-pkt
    MemberAuthor

    looking over the fence: sandwich options in fit or after in Julia
    https://github.com/JuliaStats/GLM.jl/issues/42 (avoids cross-linking on github)

  9. josef-pkt commented on Oct 23, 2019

    @josef-pkt
    MemberAuthor

    this needs triage to see what still remains here,
    maybe make

    • an updated list of todos, and
    • a list with closed issues that contain references and explanations

    most of this has been implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions