You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tolerance and prediction intervals for regression results #6979
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.
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)
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.
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)
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?
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,
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.
Activity
josef-pkt commentedon Aug 22, 2020
prediction intervals under normality (or t) assumption and confidence intervals for the predicted mean are available in
get_predictionfor 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?
josef-pkt commentedon Dec 11, 2020
I'm closing this
#2015 is a more general issue, and there are other issues for specific cases or details
josef-pkt commentedon Mar 16, 2022
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)
josef-pkt commentedon Mar 19, 2022
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.
josef-pkt commentedon Mar 22, 2022
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.
MoritzImendoerffer commentedon Jun 5, 2022
Hi Josef, great to see that there is movement. Are you currently working on this topic?
josef-pkt commentedon Jun 5, 2022
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?
josef-pkt commentedon Nov 22, 2022
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
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
josef-pkt commentedon Nov 16, 2024
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.