Skip to content

ENH/Design: diagnostics based on grouping observations by prediction #4262

Open

Description

@josef-pkt

(another idea for diagnostic checks that should work in a relatively general way)

split observations into subgroups or strata by a predicted value, e.g. linear prediction in GLM or parametric survival models, and then run some less restrictive analysis on the subgroups and check whether the results for subgroups are consistent with the overall result.
This is an extension of analyzing subgroups if there are only a few exog patterns with discrete exog.

related ideas:

  • Hosmer-Lemeshow test for gof in logit with some continuous exog works that way
  • treatment effect estimation using subgroups, similar to or special case of propensity score matching
  • data coarsening: general argument for discretization from authors of zelig in R
  • parametric survival model, see below

parametric survival modelling

Collett, D. 2003. Modelling Survival Data in Medical Research. 2nd ed. Chapman & Hall/CRC Texts in Statistical Science Series. Boca Raton, Fla: Chapman & Hall/CRC.

page 241: split observations by risk score, i.e. linear predictor, and then run nonparametric analysis (Kaplan-Meier) for each subgroup to check whether parametric assumptions are ok.

possible problem: how many groups to use, e.g. problems of Hosmer-Lemeshow test if number of groups is kept small when sample size increases.
(possible idea: balance power and precision)

related #3904 Andrews has an Econometrica article for chisquare test similar to Hosmer-Lemeshow
The theory allows essentially arbitrary splitting by endog or exog.

Activity

  1. josef-pkt commented on Feb 20, 2018

    @josef-pkt
    MemberAuthor

    predicted probabilities in count models might be another application for this
    AFAIR, I mainly compared averaged predicted probabilities with overall frequencies, and maybe checked the same averages for a binary exog, e.g. averaged predicted probabilities by gender.

    This could be extended to splitting into subgroups by a continuous variable (endog or exog)

    aside: There are a lot of similarities between "parametric" countmodels and parametric survival models, in the sense that in both cases we are interested in the entire distribution, quantiles, probabilites, and not just in mean as in QMLE. Another case, use a 4 parameter distribution to better approximate or estimate quantiles #4256.
    (And a long time ago? ??? modelling higher moments, skew, kurtosis, related to GARCH or tsa with higher moments, two Swiss authors?)

  2. josef-pkt commented on Oct 11, 2020

    @josef-pkt
    MemberAuthor

    df for Hosmer-Lemeshow

    g groups, c choices

    • binary: df = (g - 2) for insample, Stata uses df = g for outsample
    • multinomial: df = (g−2) *(c−1), reduces to (g-2) for binary c=2, (Fagerland, Hosmer, Bofin SIM 2008)
    • ordinal: df = (g - 2) * (c - 1) + (c - 2) , reduces to (g-2) for binary c=2, (Hosmer, ... ?)
  3. josef-pkt commented on Oct 17, 2023

    @josef-pkt
    MemberAuthor

    bump for count models

    plot the expected and observed frequency histogram for subgroups split by fittedvalues.
    Currently I only have added plot for full training data, and some examples where I split data by a binary exog (gender).

    This would help to see how the shape of the distribution changes with the covariate parameterized mean and how well it fits the data.
    motivation: looking at regression for generalized waring distribution. It has 3 parameters and one varies as function of the mean given by link function of linear predictor. It's not obvious to me which of the 3 parameters should vary with the mean and regressors.
    The split plot would show if the model can match the distribution shape on both low and high means.
    (scipy has PR for beta negative binomial distribution which is another name for generalized Waring distribution)

  4. added this to the 0.15 milestone on Oct 17, 2023
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions