Skip to content

ENH: GLM, discrete nonlinear prediction confint for ppf and sf #4745

Open

Description

@josef-pkt

just an idea to get a rough measure on a confidence interval for prediction in GLM or single index models.

get_prediction for GLM estimates a confidence interval for the mean prediction.
ppf and sf are nonlinear functions of the predicted mean, e.g. Poisson

get a upper confidence bound on the sf and a lower confidence bound on ppf, eg.

confint_low, confint_upp = results.get_prediction(alpha=alpha_parameter_uncertainty)
alpha = 0.05
poisson.sf(alpha, confint_upp)
poisson.ppf(alpha, confint_low)

This "should" be a bound on the double alpha confidence interval for an observation, taking both parameter uncertainty and randomness of endog into account.
In terms of implementation this is just one side of the nonlinear function endpoint transformation confint.

The application would be to get some indication for outliers in asymmetric distributions that does not rely on some transformed residuals, such as resid_anscombe or resid_deviance.
(I'm currently looking at studentized residuals and thresholds for outlier_influence in Binomial #4732)

(There should be related issues, but I only used MonteCarlo before for predictive distribution with parameter uncertainty.)

Activity

  1. josef-pkt commented on Jun 15, 2018

    @josef-pkt
    MemberAuthor

    Another idea if we don't have linear single index structure. Above we have single index (linpred) to reduce the dimension from k_params to 1, and then two nested monotonic functions.

    In general we would have confidence ellipsoids on the original params, and we would need to find the largest or the smallest value of a nonlinear function (R^k -> R) that is in the confidence ellipsoid.
    With a monotonic function, the max or min would always be at the edge of the ellipsoid.

  2. added this to the 0.11 milestone on Feb 17, 2019
  3. josef-pkt commented on Feb 17, 2019

    @josef-pkt
    MemberAuthor

    bump

    an application for this would be Poisson or other count control charts #5503 #4191

    The "posterior" (except I'm not doing Bayesian) predictive distribution is a mixture of Poisson with normal mixing probability.
    We can use delta method for nonlinear prediction as mentioned above.
    Alternatively, we can simulate and use quasi monte carlo integration to get properties of the mixture distribution, e.g. #5502 uses halton sequences, or we can use gauss-hermite quadrature #5499 at least in the 1-dimensional case (when we have a single index model).
    We can add distribution helper functions that compute just one statistic, like the control limits for the control charts, from a simulated mixture distribution. (In my earlier experiment for Poisson prediction under parameter uncertainty, I tried to simulate the entire distribution and that results in an API that is to complicated.)

  4. modified the milestones: 0.11, josef on Oct 5, 2019
  5. josef-pkt commented on Jun 11, 2021

    @josef-pkt
    MemberAuthor

    This article has "tolerance limits" which are prediction intervals for individual observations.
    simpler case, no exog, only one parameter

    basic idea is the quantile function evaluated using the upper confint bound of the parameter estimate, respectively the lower bound for lower prediction limit.
    This can be used for single linpred models like Poisson (or GLM with fixed extra parameters), but not for multiparameter problems like NegativeBinomial, ... . We might need delta method directly for the quantile function to include the uncertainty from those extra parameters.
    They use either asymptotic confint or bootstrap resampling of observations to calibrate "tolerance limits".

    also has some references, that should help.

    Young, D. S., M. Naghizadeh Qomi, and A. Kiapour. "Approximate confidence and tolerance limits for the discrete Pareto distribution for characterizing extremes in count data." Statistica Neerlandica 73, no. 1 (2019): 4-21.

    maybe we can add support for the confint in 2 parameter case #7182 (I didn't check if this applies here)

    context: discretized count distributions #7479, PR #7488

  6. josef-pkt commented on Nov 11, 2021

    @josef-pkt
    MemberAuthor

    bump again
    I'm getting closer to this with PR #7870

    Note: if we want the upper interval limit for the quantile, then we need to use the lower limit of the cdf conf_int.
    e.g using graph of cdf(y) with confint cdf_low(y) and cdf_upp(y)

    cdf(y | theta) is continuous in theta for fixed y. So. delta method applies for confint of cdf at y,
    e.g. discrete cases like NegativeBinomial and GeneralizedPoisson.

    To get upper limit on quantile, we need to "invert" the lower confidence graph.
    e.g. find y : cdf_low(y) = 0.95
    or min(y : cdf_low(y) >= 0.95)

  7. modified the milestones: josef, 0.14 on Nov 11, 2021
  8. josef-pkt commented on Feb 20, 2025

    @josef-pkt
    MemberAuthor

    related crossvalidated question: https://stats.stackexchange.com/questions/661580/prediction-intervals-for-glm

    aside: two parameter family: mean and variance/dispersion
    We might get pretty good tolerance intervals using the upper limit of the dispersion interval and the usual upper and lower limit for the mean.

    For parameterization as in LEF/GLM there will be little correlation between mean and dispersion parameter even if we estimate them jointly, and it might not be too bad in non-LEF like negbin-P.

    But in GLM we don't have standard errors for dispersion/scale (and NB dispersion parameter is assumed to be fixed and provided by the user). It would be useful in MLE count models.
    (I guess it will not be possible for two-part models like ZIP, ZINB)

  9. josef-pkt commented on Feb 20, 2025

    @josef-pkt
    MemberAuthor

    what we can do:
    Our GLM is one-parameter LEF with fixed or auxiliary scale, dispersion parameters.
    Under this assumption we can add a method for one-parameter tolerance intervals to the results class, ignoring uncertainty from dispersion.

    Related: prediction interval in OLS also takes residual variance, scale as fixed and does not take the uncertainty from estimating the variance into account.

    The same for discrete Poisson.
    Binary models like Logit, Probit only have the trivial [0, 1] prediction or tolerance interval.
    NBP and GPP are mean-dispersion with possible option for using upper confidence bound for dispersion.

    ZI and Hurdle models (and discretized count models) will not fit in this pattern.

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