ENH: stats: Add the Irwin-Hall distribution gh-20481

GH discussion here: ENH: stats: Add the Irwin-Hall distribution by nimish · Pull Request #20481 · scipy/scipy · GitHub@mdhaber

This enhancement adds the Irwin-Hall distribution, also known as the uniform sum distribution, which is straightforwardly the sum of an integer amount of standard uniform distributions.

i.e. \sum^{n}_{k=1}U_k where U_k \sim U(0, 1) and are independent.

Applications include Rao’s Spacing Test, a more powerful alternative to the Rayleigh test when the data are not unimodal, and radar. I plan on adding Rao’s test after this.

Conveniently, the pdf and cdf are the n-fold convolution of the ones for the standard uniform distribution, which is also the definition of the cardinal B-splines. This means that the implementation is strikingly simple, except for the moments which are best calculated from the cumulants. Adding that will be a separate feature because scipy needs more cumulant infrastructure (which I’ll look at adding) before it’d make sense over the generic method.

@nimish thanks for working on this distribution

I left a note about the general nth moment in the thread on github:

1 Like

Thanks @rlucas7 – I had some code that used this method: Moments from cumulants · GitHub since it only needs binomial coefficients and Bernoulli numbers (for uniform/IH) which are already in scipy

In general the loop bit can be applied to any random variable with the cumulants swapped out for the correct ones