Ticket #965 (new defect)
Opened 8 months ago
special.smirnovi has discontinuity close to 1
| Reported by: | josefpktd | Owned by: | pv |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.8.0 |
| Component: | scipy.special | Version: | 0.7.0 |
| Keywords: | Cc: |
Description
The ppf-cdf roundtrip test in stats.ksone fails for small values of q and n, the reason is that special.smirnovi, which is called by ppf (and is actually the inverse survival function isf of ksone) has numerical imprecision and jumps to zero for values of q close to one.
>>> special.smirnovi(10, 0.99112) 0.04083470983933999 >>> special.smirnovi(10, 0.9912) 0.0 >>> special.smirnovi(100, 0.99912) 0.001874207718765326 >>> special.smirnovi(100, 0.9992) 0.0 >>> special.smirnovi(1000, 0.999912) 0.0021494510640487807 >>> special.smirnovi(1000, 0.99992) 0.0
the easiest way to check, is the roundtrip
>>> for q in np.arange(0.996,0.9999, 0.0005): ... print q, special.smirnov(100, special.smirnovi(100, q)) - q ... 0.996 1.07247544179e-013 0.9965 -1.27786670134e-013 0.997 1.38777878078e-013 0.9975 -1.33559829862e-013 0.998 0.000368737268672 0.9985 0.000611731688214 0.999 0.0007185452484 0.9995 0.0005
I think this might be the unimportant side of the ppf for the kolmogorov-smirnov test and in this case only a lower priority error.
Note: See
TracTickets for help on using
tickets.
