Introduction to Statistics in Python
Maggie Matsui
Content Developer, DataCamp
$$P(4 \le \text{wait time} \le 7) = ~~ ?$$
$$P(4 \le \text{wait time} \le 7) = ~~ ?$$
$$P(4 \le \text{wait time} \le 7) = 3 \times 1/12 = 3/12$$
$$ P(\text{wait time} \le 7)$$
from scipy.stats import uniform
uniform.cdf(7, 0, 12)
0.5833333
$$ P(\text{wait time} \ge 7) = 1 - P(\text{wait time} \le 7)$$
from scipy.stats import uniform
1 - uniform.cdf(7, 0, 12)
0.4166667
$$ P(4 \le \text{wait time} \le 7)$$
$$ P(4 \le \text{wait time} \le 7)$$
$$ P(4 \le \text{wait time} \le 7)$$
from scipy.stats import uniform
uniform.cdf(7, 0, 12) - uniform.cdf(4, 0, 12)
0.25
$$P(0 \le \text{wait time} \le 12) = ~~ ?$$
$$P(0 \le \text{outcome} \le 12) = 12 \times 1/12 = 1$$
from scipy.stats import uniform
uniform.rvs(0, 5, size=10)
array([1.89740094, 4.70673196, 0.33224683, 1.0137103 , 2.31641255,
3.49969897, 0.29688598, 0.92057234, 4.71086658, 1.56815855])
Normal distribution
Exponential distribution
Introduction to Statistics in Python