Skip to content

Performance: faster pvalues for studentized range distribution #9476

Open

Description

@josef-pkt

scipy/scipy#22319

scipy computes cdf through numerical integration with relatively strong requirement for tolerance.
ppf is not implemented and needs function inversion.

This is much slower than using values from a table according to the scipy issue
We could reduce tolerance for cdf computation (scipy has no option), but it still requires function inversion to get pvalues.

So, we could add an option to tukey_hsd to use the old tables as alternative to scipy version.

Also we could extend the approximation tables by using the values computed by scipy studentized_range.

Activity

  1. josef-pkt commented on Jan 21, 2025

    @josef-pkt
    MemberAuthor

    another speedup

    tukey_hsd has (now redundant) critical value ppf computation
    #4379 (comment)
    computing pvalues (cdf) is enough and in contrast to ppf does not need function inversion.

    correction
    computing q_crit is not redundant, It is used for confints which are always computed.

  2. josef-pkt commented on Jan 23, 2025

    @josef-pkt
    MemberAuthor

    @Ronny-PDT

    What results are you using from tukey-hsd?
    only pvalues and rejection decision or also confidence intervals and summary table?

    Currently we are always computing the critical values q_crit, which is the ppf value. That requires function inversion in addition to numerical integration. If we only compute p-values in the minimal return case, then we only need to compute the cdf value once without needing the additional function inversion for ppf.

    Currently this is difficult to change because all results are always computed (by the underlying helper function).
    I'm currently looking at enhancements and possible refactorings in #4379

  3. Ronny-PDT commented on Jan 23, 2025

    @Ronny-PDT
  4. josef-pkt commented on Jan 23, 2025

    @josef-pkt
    MemberAuthor

    Thanks

    I will try to refactor it to make critical values lazy and computed only on demand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions