Skip to content

Tolerance and prediction intervals for regression results #6979

Open

Description

@MoritzImendoerffer

Dear All,

have you planned adding tolerance and prediction intervals?

e.g. https://cran.r-project.org/web/packages/tolerance/tolerance.pdf
If someone else feels there is a need for that, I am willing to share my time to implement such intervals for statsmodels OLS.

Activity

  1. josef-pkt commented on Aug 22, 2020

    @josef-pkt
    Member

    prediction intervals under normality (or t) assumption and confidence intervals for the predicted mean are available in get_prediction for OLS/WLS and GLM (not yet for discrete models)
    https://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.RegressionResults.get_prediction.html

    Is there anything that needs to be added?

  2. josef-pkt commented on Dec 11, 2020

    @josef-pkt
    Member

    I'm closing this

    #2015 is a more general issue, and there are other issues for specific cases or details

  3. added this to the 0.12 milestone on Jan 27, 2021
  4. modified the milestones: 0.12, 0.13 on Sep 9, 2021
  5. josef-pkt commented on Mar 16, 2022

    @josef-pkt
    Member

    reopening for stats

    I ran into tolerance intervals for Poisson while looking at confidence intervals for poisson 1 and 2 sample. #8166

    Current issues like #2015, #4745 and similar are for models. However, we can add those also to statsmodels.stats and it might be easier to get started there with standalone functions.

    good starting point for poisson and binomial is Krishnamoorthy 2011
    (articles for negbin tolerance limits don't have the mean dispersion parameterization, NB is treated only as one-parameter distribution with probability of success with fixed second parameter)

    Hahn, Gerald J, and William Q Meeker. 2010. Statistical Intervals: A Guide for Practitioners.

    Hahn, Gerald J., and Ramesh Chandra. 1981. “Tolerance Intervals for Poisson and Binomial Variables.” Journal of Quality Technology 13 (2): 100–110. https://doi.org/10.1080/00224065.1981.11980998.

    Krishnamoorthy, K., and Thomas Mathew. 2009. Statistical Tolerance Regions: Theory, Applications, and Computation. Wiley Series in Probability and Statistics. Hoboken, NJ, USA: John Wiley & Sons, Inc. https://doi.org/10.1002/9780470473900.

    Krishnamoorthy, K., Yanping Xia, and Fang Xie. 2011. “A Simple Approximate Procedure for Constructing Binomial and Poisson Tolerance Intervals.” Communications in Statistics - Theory and Methods 40 (12): 2243–58. https://doi.org/10.1080/03610921003786848.

    Cai, Tianwen Tony, and Hsiuying Wang. 2009. “TOLERANCE INTERVALS FOR DISCRETE DISTRIBUTIONS IN EXPONENTIAL FAMILIES.” Statistica Sinica 19: 905–23.
    (not sure if this is helpful to get started, uses edgeworth expansion for GLM families with quadratic variance functions)

  6. josef-pkt commented on Mar 19, 2022

    @josef-pkt
    Member

    browsing and searching a bit through the "tolerance interval" literature:

    Our prediction interval for OLS confint_obs includes the uncertainty from the estimation of the mean parameters, but it does not include the uncertainty from the estimated (residual) variance.
    This is based just on the standard formula in the regression literature.

    The literature for tolerance intervals for normal distribution includes uncertainty about the estimated variance.

    We have similar problems for GLM/discrete/other distribution with dispersion parameters.
    e.g
    GLM-NB2 takes dispersion parameter as given - one parameter family.
    Discrete NBP estimates the dispersion parameter, but we loose one-parameter endpoint transformation to create confidence, prediction or tolerance intervals.

  7. josef-pkt commented on Mar 22, 2022

    @josef-pkt
    Member

    for linear and nonlinear regression

    Young has non-central t distribution for linear regression
    Carrol, Ruppert have delta-method (and bootstrap) for nonlinear, heteroscedastic regression
    (onesided interval is just deltamethod on quantile function)

    Carroll, Raymond J., and David Ruppert. 1991. “Prediction and Tolerance Intervals with Transformation and/or Weighting.” Technometrics 33 (2): 197–210. https://doi.org/10.2307/1269046.

    Young, Derek S. 2013. “Regression Tolerance Intervals.” Communications in Statistics - Simulation and Computation 42 (9): 2040–55. https://doi.org/10.1080/03610918.2012.689064.

  8. MoritzImendoerffer commented on Jun 5, 2022

    @MoritzImendoerffer
    Author

    Hi Josef, great to see that there is movement. Are you currently working on this topic?

  9. josef-pkt commented on Jun 5, 2022

    @josef-pkt
    Member

    hi @MoritzImendoerffer

    I'm not working on it directly, but I'm adding it as part of more general PRs.
    However, currently I know how to implement tolerance intervals for one parameter distributions like poisson and binomial counts. I don't know enough or have not decided how to implement tolerance intervals for multi-parameter distributions, for example how to include scale/dispersion uncertainty in negative binomial and continuous families in GLM like Gamma.

    Tolerance interval for poisson is in #8166 which is a PR where I tried to figure out what other features to add besides hypothesis tests and simple confidence intervals. Tolerance intervals for Binomial counts will follow soon in another PR.

    Do you have any specific cases, distributions and methods in mind that could be higher priority than waiting for me to get back to this again?

  10. modified the milestones: 0.13, 0.14 on Jun 20, 2022
  11. josef-pkt commented on Nov 22, 2022

    @josef-pkt
    Member

    another idea:

    add a transformation to linearity to ppf, isf quantile computation and then use endpoint transformation

    context control charts for beta distribution
    endog and quantiles are bounded in (0, 1), variable is continuous

    • we can use delta method for ppf/isf to get confint for quantiles of y
    • we could use deltamethod for a function z(params) = g(ppf(alpha, params)) so that z is closer to normality than y and then use endpoint transformation confint using quantiles y = g^{-1} (z) .
      One possibility in the beta case would be using logit transformation as g

    advantage: confint for quantiles, tolerance interval is in interval (0, 1)

    Similar transformation would apply for other (commonly used) distributions. We might be able to use the mean link, if the first distribution parameter is mean.
    If we use the mean link, then we are computing a confint for the linear predictor quantile of the mean that takes variance/dispersion uncertainty into account. ??? sounds a bit strange,

    Lima-Filho, Luiz M. A., Tarciana Liberal Pereira, Tatiene C. Souza, and Fábio M. Bayer. “Process Monitoring Using Inflated Beta Regression Control Chart.” PLOS ONE 15, no. 7 (July 30, 2020): e0236756. https://doi.org/10.1371/journal.pone.0236756.

    use ppf based on a quick look for prediction interval, control limits

  12. josef-pkt commented on Nov 16, 2024

    @josef-pkt
    Member

    another (random) idea

    use numerical optimization:
    we need the largest predicted quantile, ppf for parameters in an alpha ellipse.
    If we have two parameters, the the alpha ellipse is defined by chisquare (or F) wald_test.

    This means we could find the extreme points of the tolerance interval using constrained optimization, where the constraint is to be in or on the confidence region (hyper) ellipse.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions