Skip to content

Inverse gamma quantile poorly written #1392

@jzmaddock

Description

@jzmaddock

From scipy/scipy#25096 we have a number of issues:

  • The quantile and quantile from complement should do the same thing and return the same value, as it stands it looks like the call to guess_ig is incorrect in the complement case, even though ironically, this is the case that succeeds.
  • The guess returned by guess_ig is terrible in this case. Looks like the equality between the gamma and inverse gamma on https://en.wikipedia.org/wiki/Inverse-gamma_distribution could be used for a better guess, or maybe does that even just take us to the correct answer anyway?
  • The bounds used by the root finder are too broad, this is probably a general issue for a lot of these distributions, and is the root cause of the non-convergence in the original bug report. Maybe we should bracket the root first, perhaps by extracting the bracketing code from bracket_and_find_root so we can use that with other root finders? The code in bracket_and_find_root is a "known good" so it would be good to reuse, plus it lets us fix issues in one place only. It would be good to have a robust general bracketing routine, even if we choose to reimplement this distro in terms of the gamma (assuming that's an option).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions