Statistical Thinking in Python (Part 1)
Justin Bois
Teaching Professor at the California Institute of Technology
The outcome of rolling a single fair die is
rng.binomial(4, 0.5)
2
rng.binomial(4, 0.5, size=10)
array([4, 3, 2, 1, 1, 0, 3, 2, 3, 0])
samples = rng.binomial(60, 0.1, size=10000)
n = 60
p = 0.1
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
x, y = ecdf(samples)
_ = plt.plot(x, y, marker='.', linestyle='none')
plt.margins(0.02)
_ = plt.xlabel('number of successes')
_ = plt.ylabel('CDF')
plt.show()
Statistical Thinking in Python (Part 1)