9.1 Uniform Distribution
The uniform probability distribution with minimum min and maximum max is given by:
for
- probability area under from to
- mean or and
- standard deviation is
The syntax for cumulative probability, , inverse, mean and standard deviation:
from scipy import stats
stats.uniform.cdf(x,min,max-min) # cumulative prob P(X<x)
stats.uniform.ppf(p,min,max-min) # inverse of cdf or percentiles
stats.uniform.mean(min,max-min) # mean of X
stats.uniform.std(min,max-min) # std of X
Example: The amount of time, in minutes, that a person waits for a bus, in a bus station, is uniformly distributed between zero and 15 minutes, inclusive.
- What is the probability that a person waits fewer than 12.5 minutes?
from scipy import stats
stats.uniform.cdf(12.5,0,15)
Show expected output
0.8333333333333334Interpretation: The probability of waiting less than 12.5 minutes is 0.8333333333333334
Example: The amount of time, in minutes, that a person waits for a bus, in a bus station, is uniformly distributed between zero and 15 minutes, inclusive.
- On the average, how long must a person wait? Find the mean, μ, and the standard deviation, ÃÆ’.
stats.uniform.mean(0,15) # mean
Show expected output
7.5Interpretation: The mean waiting time is 7.5
stats.uniform.std(0,15) # std
Show expected output
4.330127018922194Interpretation: The mean waiting time is 7.5 with a standard deviation of 4.33.
Example: The amount of time, in minutes, that a person waits for a bus is uniformly distributed between zero and 15 minutes, inclusive.
- Ninety percent of the time, the length of time a person must wait falls below what value?
stats.uniform.ppf(.9,0,15)
Show expected output
13.5Interpretation: Ninety percent of the waiting time is less than or equal to 13.5
Adapted from Python for Introductory Statistics, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.