Skip to content

Confidence Interval in Maximum Likelihood Estimation #6779

Open

Description

@kisabaev

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!

https://www.statsmodels.org/stable/examples/notebooks/generated/generic_mle.html

Activity

  1. josef-pkt commented on Jun 4, 2020

    @josef-pkt
    Member

    (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.

    Or do you mean some other confidence intervals?

  2. josef-pkt commented on Jun 4, 2020

    @josef-pkt
    Member

    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.)

  3. kisabaev commented on Jun 4, 2020

    @kisabaev
    Author

    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?):

    image

  4. david-waterworth commented on Jun 4, 2020

    @david-waterworth

    Isn't that a prediction interval?

  5. kisabaev commented on Jun 5, 2020

    @kisabaev
    Author

    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 ...

  6. josef-pkt commented on Jun 5, 2020

    @josef-pkt
    Member

    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.)

  7. josef-pkt commented on Jun 5, 2020

    @josef-pkt
    Member

    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

  8. kisabaev commented on Jun 5, 2020

    @kisabaev
    Author

    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"

  9. josef-pkt commented on Jun 6, 2020

    @josef-pkt
    Member

    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

  10. kisabaev commented on Jun 7, 2020

    @kisabaev
    Author

    Thanks @josef-pkt for the clarification - at least we now know that it may be best to stick with R for the time being.

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

    comp-extremestype-enh

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions