C3_W1_Assignment Ex 4 - Uniform PDF

I was getting an error in the Ex. 6, but it was due to a partial error in the uniform distribution. Not sure why this happened… It took me a while to figure it out the reason.

uniform_pdf

when evalutaing the scipy.stats module against the implemented formula

Any ideias why this happens?

PDF of uniform distribution is the same for all values in [a, b].
In this case, the pdf of 5.4 falls in [2, 10] and so the value is .125.
Odds are good that you’re considering a=2 and b=10 which is wrong.

Please look here where the parameters loc and scale are used to create uniform distribution of form [loc, loc + scale]. So, the parameter b should be fixed accordingly.

1 Like

Thanks for the explanation! I did not see that.
Regards