Stereo Wrote:I'd like to go on record saying that the distribution of the sum of uniform distributions is not fun to work withI actually did this sometime in the past and came up with this crazy formula in terms of the unit step function H(x) (which I actually didn't know about until now, but came up with my own name/silly symbol for. regardless I'll use H(x) in this post). I used the result I got to make this (which still has some sloppy arithmetic in it, but I haven't touched it in very long and don't plan to).
You can probably do it algebraically using multiple variable integrals of the p.d.f. (uniform distribution is P(x) = H(x) +(-1)H(x-1) ) so you end up with something like integral y = -inf to inf P(x)P(y) dy But just the fact that it's a piecewise function makes it annoying to work with.
Which, in 2 variables, just ends up being a triangle. P(x) = xH(x) - 2(x-1)H(x-1) + (x-2)H(x-2) But that limits you to finding 2hko probabilities. As a diagram, this would be like the diagonal area under a square, where the square has uniform height.
In the long run just running a few thousand simulations will probably get you close enough, and be a lot easier to write.
Generally how I went through it:
P(x) for a uniform distribution is H(x) - H(x-1) as you said. Call this P_1(x), where P_n(x) is the number of uniform distributions you're summing.
P_2(x), then, is just integral of P_1(t) from x-1 to x. You come up with (same as in your post):
P_2(x) = xH(x) - 2(x-1)H(x-1) + (x-2)H(x-2)
After doing this a few times I saw a pattern...
P_3(x) = 1/2x^2 H(x) - 3/2(x-1)^2 H(x-1) + 3/2(x-2)^2 H(x-2) - 1/2(x-3)^2 H(x-3)
P_4(x) = 1/6x^3 H(x) - 4/6(x-1)^3 H(x-1) + 6/6(x-2)^3 H(x-2) - 4/6(x-3)^3 H(x-3) + 1/6(x-4)^3 H(x-4)
And so, assuming the pattern holds, you come up with an expression in summation notation for any P_n(x). Integrating this gets P_n+1(x) so it works.
I actually worked this with a uniform distribution between variables a and b too, rather than with a unit distribution, which made it much more annoying to deal with. In hindsight the H(x) makes it so much easier.


