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
ENH: GLM, discrete nonlinear prediction confint for ppf and sf #4745
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.)
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.
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.)
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)
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)
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)
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.
Activity
josef-pkt commentedon Jun 15, 2018
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.
josef-pkt commentedon Feb 17, 2019
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
distributionhelper 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.)josef-pkt commentedon Jun 11, 2021
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
josef-pkt commentedon Nov 11, 2021
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.95or
min(y : cdf_low(y) >= 0.95)josef-pkt commentedon Feb 20, 2025
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)
josef-pkt commentedon Feb 20, 2025
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,
scaleas 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.