
Just because the density is zero when $x > b$, it doesn't mean that the integral from $(-\infty, x)$ is itself zero, because as we can see, there are points within the interval of integration for which the density is positive.įor example, if I say to you to calculate the integral of $g(x) = 1-x$ from $x = 0$ to $x = 1$, what would you write? $$\int_,$$ what would the integral of $h$ be from $x = 0$ to $x = 2$? It's the same as the above, because the area under the curve of $h$ from $x = 1$ to $x = 2$ is zero, so you've not added any area, but the total area is not zero because you still had area from $x = 0$ to $x = 1$. Implementation In the following table a is the lower parameter of the distribution, b is the upper parameter, x is the random variate, p is the probability and q 1-p. In other words, the interval $(a,b)$ is a subset of the interval $(-\infty, x)$ if $x > b$. The uniform distribution is implemented with simple arithmetic operators and so should have errors within an epsilon or two.

Bonus: You can double check the solution to each example by using the Uniform Distribution Calculator. The probability that a randomly selected NBA game lasts more than 150 minutes is 0.4.

#CDF FOR UNIFORM DISTRIBUTION PDF#
But your reasoning in the final case is not quite correct, because the integral is taken over an interval that includes parts of the PDF that are nonzero. stats import uniform calculate uniform probability uniform.
