Skip to content

ENH: AIC for M-estimators, QMLE, over dispersion, effective degrees of freedom #6516

Open

Description

@josef-pkt

Claeskens, Gerda, and Nils Lid Hjort. "Model selection and model averaging." Cambridge Books (2008).

chapter 2 has a good discussion of AIC including for the cases of misspecified likelihood and M-estimators.

The penalization uses J^{-1} H for the number of parameters, which is the same or similar to effective degrees of freedom in penalized estimation (IIRC)

Takeuchi information criterion TIC is the misspecification robust version of AIC, similar to sandwich cov_types.
Search for it finds relevant theoretical literature.

GAM uses effective degrees of freedom, edf as sum of hat_matrix_diag (i.e. trace of hat matrix), so it doesn't use a generic version using hessian and score_cov.

other relevant area is Influence classes GLM, MLE and generic, where I might have used something similar. Issues?

Activity

  1. josef-pkt commented on Feb 15, 2020

    @josef-pkt
    MemberAuthor
  2. josef-pkt commented on Feb 15, 2020

    @josef-pkt
    MemberAuthor

    Hansen, Niels Richard, and Alexander Sokol. 2014. “Degrees of Freedom for Nonlinear Least Squares Estimation.” ArXiv:1402.2997 [Math, Stat], December. http://arxiv.org/abs/1402.2997.
    (doesn't seem to be published)

    p.11 defines effective degrees of freedom as in TIC, referencing Claeskens, Hjort

  3. josef-pkt commented on Feb 15, 2020

    @josef-pkt
    MemberAuthor

    looks interesting: bias correcting penalization based on TIC
    Dixon, Matthew, and Tyler Ward. 2018. “Takeuchi’s Information Criteria as a Form of Regularization.” ArXiv:1803.04947 [Stat], April. http://arxiv.org/abs/1803.04947.

    I didn't read it, has logistic regression as example case
    maybe a bit similar to Firth penalization #3561

  4. josef-pkt commented on Oct 26, 2020

    @josef-pkt
    MemberAuthor

    Konishi, Sadanori, and Genshiro Kitagawa. 1996. “Generalised Information Criteria in Model Selection.” Biometrika 83 (4): 875–90. https://doi.org/10.1093/biomet/83.4.875.

    has a section for generalized info criterion for penalized MLE
    another example case are robust M-estimators (RLM)

    GIC reduces to TIC for MLE models

  5. josef-pkt commented on Oct 30, 2020

    @josef-pkt
    MemberAuthor

    GBIC for misspecified models used log det of H = A^{-1} B, and a second version that has both log det and trace of H
    GAIC =(?) TIC has only trace of H

    Lv, Jinchi, and Jun S. Liu. 2014. “Model Selection Principles in Misspecified Models.” Journal of the Royal Statistical Society. Series B (Statistical Methodology) 76 (1): 141–67.

  6. josef-pkt commented on Oct 30, 2020

    @josef-pkt
    MemberAuthor

    confusion continuous

    Gao, Xin, and Raymond J. Carroll. 2017. “Data Integration with High Dimensionality.” Biometrika 104 (2): 251–72. https://doi.org/10.1093/biomet/asx023.

    They use TIC on currently selected model as effective df in BIC, no penalization term is included.
    focus is on selection consistency and not shrinkage estimation.

  7. josef-pkt commented on Nov 12, 2020

    @josef-pkt
    MemberAuthor

    maybe related generalized leverage #4257 (comment)

    I still need a generic definition of "influence function", I still don't know which one is used in different cases, eg. in robust literature, for asymptotics, for local influence

  8. josef-pkt commented on Dec 9, 2020

    @josef-pkt
    MemberAuthor

    Trying out a GLM example

    TIC, ratio of information matrix (based on HC0) includes the excess dispersion, i.e. misspecification and not really effective degrees of freedom

    2 sample Poisson, i.e. exog is 2 dummy variables

    scale_d is scale based on pearson chi2

    correctly specified

    np.trace(ratio_im), ratio_im.shape, scale_d
    (2.0150105061411914, (2, 2), 1.001032580514438)
    

    misspecified
    with random effect that is not taken into account, i.e. large overdispersion

    np.trace(ratio_im), ratio_im.shape, scale_d
    (15.135744856510684, (2, 2), 8.635246466751608)
    

    in the overdispersion case TIC might induce a similar ranking of GLM models as quasi-IC QIC
    (except QIC is reparameterized and divides by scale)

    np.trace(ratio_im), scale_d * len(res_glm.params)
    (15.135744856510684, 17.270492933503217)
    
  9. josef-pkt commented on Dec 9, 2020

    @josef-pkt
    MemberAuthor

    implementation aside:
    GLM has weights which need to be taken into account when computing cov(score_obs) or score_obs @ score_obs.
    For score_obs this seems to be automatic, score_factor includes iweights (= freq_weights * var_weights).
    So HC0 should be good.
    in my current example I cross checked with cov_params for cov_type="HC0"

    But it will be safer to reuse cov_params for nonrobust cov_types, so that we don't have to duplicate code for cov(score)

    If cov_typ = nonrobust, then we use HC0 as definition for TIC and im_ratio
    If cov_type is a robust version, then we use the one corresponding to cov_type, e.g. ratio_im = cov_params @ hessian (maybe negative hessian)

    im_ratio or ratio_im

    for unit test for TIC

    vgam in R has TIC
    using their first example at http://search.r-project.org/library/VGAM/html/vglm.html
    GLM Poisson, I get agreement of my TIC with theirs at diff 1.45e-07, which might be at least as good as convergence tolerance
    according to their docs, TIC in vgam uses EIM, with canonical link it doesn't make a difference to using OIM hessian (except for numerical noise).

    the following works for Poisson and GLM Poisson with identical results (up to numerical precision and tolerance)
    models fit with cov_type nonrobust and with cov_type HC0 have the same TIC value and im_ratio

    def im_ratio(results):
        res = getattr(results, "_results", results)  # shortcut
        hess = res.model.hessian(res.params)
        if res.cov_type == "nonrobust":
            score_obs = res.model.score_obs(res.params)
            cov_score = score_obs.T @ score_obs
            hessneg_inv = np.linalg.inv(-hess)
            im_ratio = hessneg_inv @ cov_score
        else:
            im_ratio = res.cov_params() @ (-hess)
        return im_ratio
    
    def tic(results):
        tic = - 2 * (results.llf - np.trace(im_ratio(results)))
        return tic
    
  10. josef-pkt commented on Dec 9, 2020

    @josef-pkt
    MemberAuthor

    GBIC based on Lv, Liu cited in comment above
    not verified yet

    bic function is based on GLM bic_llf

    def bic(results):
        self = getattr(results, "_results", results)
        k_params = self.df_model + 1
        nobs = self.df_model + self.df_resid + 1
        bic = -2 * self.llf + (k_params) * np.log(nobs)
        return bic
    
    def gbic(results, gbicp=False):
        """generalized BIC for misspecified models
        
        References
        ----------
        Lv, Jinchi, and Jun S. Liu. 2014. “Model Selection Principles in Misspecified Models.” 
        Journal of the Royal Statistical Society. Series B (Statistical Methodology) 76 (1): 141–67.
        
        """
        self = getattr(results, "_results", results)
        k_params = self.df_model + 1
        nobs = k_params + self.df_resid
        imr = im_ratio(results)
        imr_logdet = np.linalg.slogdet(imr)[1]
        gbic = -2 * self.llf + k_params * np.log(nobs) - imr_logdet  # LL equ. (20)
        gbicp = gbic + np.trace(imr)  # LL equ. (23)
        return gbic, gbicp
    
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions