[SciPy-Dev] Adding mode parameter to scipy.stats.ansari

Tirth Patel tirthasheshpatel at gmail.com
Tue Mar 16 10:52:29 EDT 2021


Hi all,

I have been working on gh-13650
(https://github.com/scipy/scipy/pull/13650) with Mr. Matt Haberland.
We had a discussion on what should be the behavior when the mode
parameter is passed to the Ansari-Bradley test (`scipy.stats.ansari`).
In the comment on gh-13650
(https://github.com/scipy/scipy/pull/13650#discussion_r594926432), Mr.
Haberland suggested:

  - "auto" would check for ties. if ties are present or both sample
sizes are large, the asymptotic method would be used
  - "exact" would not check for anything; it would just respect the
user's decision. (should we check and throw a warning about ties
here?)

The question is whether to emit a warning or not when `mode="exact"`
is passed and ties are present in the data. The normal approximation
corrects for ties and so it may be more correct than the exact method.
So, it may be helpful to prompt the user with a warning suggesting
him/her to use the approximate method instead. IMO, throwing a warning
seems helpful. In an earlier comment I made
(https://github.com/scipy/scipy/pull/13650#discussion_r589946142), I
suggested falling back to the approximate method even when
`mode="exact"` is passed (like R does). But now that I think of it,
Mr. Haberland is right: It would be better to use the exact method as
the user requested for it (and we wouldn't be technically wrong doing
that, right?). Anyway, would appreciate others' views on this, thanks!

-- 
Kind Regards,
Tirth Patel


More information about the SciPy-Dev mailing list