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
Confidence Interval in Maximum Likelihood Estimation #6779
We are considering to use statsmodels for some statistical analysis - but not sure whether we can get confidence interval as part of output from Maximum Likelihood Estimation in statsmodels? It's not described in the documentation - if not possible as part of output - any suggestions how to easily calculate the confidence interval (currently interested in 68% and 95% confidence intervals). Thanks!
(Wald) confidence intervals for the parameter estimates should be available in all models as results.conf_int method which takes an alpha keyword argument for 1 - alpha coverage.
The method is defined in LikelihoodModelResults and inherited by (almost ?) all model results.
Profile likelihood and score confint are not available yet.
(The former could be easily added for pure MLE models, the latter will not be available for some time yet as generic method that works for most models.)
Thanks for the reply - here is the expected result (confidence intervals are given in green and light red) - at this stage, we were exploring whether this can be achieved with statsmodels. Otherwise, would be stuck with R (or another python package if there is any other which can output the confidence interval) - the model will be used for lots of different parameters (but hopefully this detail is enough?):
Upper and lower 68% and 95% confidence intervals for each extreme value in the fitted GEV distribution - similar to Boostrapping. I think I missed to mention that it's general extreme-value distribution ...
Are the blue and light red points, from parameter estimates from 6 different models or some kind of predictions from a joint model?
Are those confidence intervals for some kind of mean or parameter estimate or for predictions of an extreme value distribution?
I don't see yet how this fits into estimation of a model.
Prediction intervals are model or distribution specific and need specialized code. Currently we don't have ready made support for extreme value analysis. (I haven't looked at that in 8 to 10 years.)
Also, if you have a reference to an R function that does what you need, then it might be easier to tell whether that's relatively easy to replicate in statsmodels
the package we use in R is called extRemes, and the fitting function is "fevd", the function to calculate the associated confidence intervals is called "ci"
Activity
josef-pkt commentedon Jun 4, 2020
(Wald) confidence intervals for the parameter estimates should be available in all models as
results.conf_intmethod which takes analphakeyword argument for1 - alphacoverage.The method is defined in
LikelihoodModelResultsand inherited by (almost ?) all model results.Or do you mean some other confidence intervals?
josef-pkt commentedon Jun 4, 2020
Profile likelihood and score confint are not available yet.
(The former could be easily added for pure MLE models, the latter will not be available for some time yet as generic method that works for most models.)
kisabaev commentedon Jun 4, 2020
Thanks for the reply - here is the expected result (confidence intervals are given in green and light red) - at this stage, we were exploring whether this can be achieved with statsmodels. Otherwise, would be stuck with R (or another python package if there is any other which can output the confidence interval) - the model will be used for lots of different parameters (but hopefully this detail is enough?):
david-waterworth commentedon Jun 4, 2020
Isn't that a prediction interval?
kisabaev commentedon Jun 5, 2020
Upper and lower 68% and 95% confidence intervals for each extreme value in the fitted GEV distribution - similar to Boostrapping. I think I missed to mention that it's general extreme-value distribution ...
josef-pkt commentedon Jun 5, 2020
Are the blue and light red points, from parameter estimates from 6 different models or some kind of predictions from a joint model?
Are those confidence intervals for some kind of mean or parameter estimate or for predictions of an extreme value distribution?
I don't see yet how this fits into estimation of a model.
Prediction intervals are model or distribution specific and need specialized code. Currently we don't have ready made support for extreme value analysis. (I haven't looked at that in 8 to 10 years.)
josef-pkt commentedon Jun 5, 2020
Also, if you have a reference to an R function that does what you need, then it might be easier to tell whether that's relatively easy to replicate in statsmodels
kisabaev commentedon Jun 5, 2020
the package we use in R is called extRemes, and the fitting function is "fevd", the function to calculate the associated confidence intervals is called "ci"
josef-pkt commentedon Jun 6, 2020
If you need more support for extreme value analysis, then I think R is still the better choice.
One problem is also that MLE for GEV only works if there are good starting values.
Based on some brief search packages like scikit-extremes https://github.com/kikocorreoso/scikit-extremes might not be mature enough yet.
A problem for statsmodels is that lmoments code is either in Fortran (license compatible by Hosking) or not license compatible in the python translation.
https://groups.google.com/d/msg/pystatsmodels/xnH_EeJAzak/hO0fjMe2m6YJ
issue #5185
kisabaev commentedon Jun 7, 2020
Thanks @josef-pkt for the clarification - at least we now know that it may be best to stick with R for the time being.