Distributions

norm and expon pdf/cdf/rvs.

scipy.stats.norm(loc, scale) is a frozen Gaussian. pdf / cdf / rvs.

Goal

Print pdf at the mean and five samples.

from scipy import stats
dist = stats.norm(loc=18, scale=3)
print('pdf 18', round(dist.pdf(18), 4))
print('cdf 21', round(dist.cdf(21), 4))
from scipy import stats
print(stats.norm(loc=18, scale=3).rvs(5, random_state=0).round(2))
from scipy import stats
d = stats.expon(scale=2)
print(d.mean(), d.ppf(0.9))
from scipy import stats
x = np.linspace(8, 28, 80)
plt.plot(x, stats.norm(18, 3).pdf(x))
plt.title('Nairobi max C model')
plt.show()
print('ok')