Foundations of Inference in Python
Paul Savala
Assistant Professor of Mathematics
Example:
from scipy import stats import numpy as np
ci = stats.norm.interval(loc=80000, # Mean
scale=10000/np.sqrt(100), # Standard error
alpha=0.95) # Confidence level
print(ci)
(78040.04, 81959.96)
Valid inference requires a normal sampling distribution
population = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] sample_means = []
for i in range(1000):
sample_5 = np.random.choice(population, size=5)
sample_means.append(sample_5.mean())
plt.hist(sample_means)
(and what it doesn't tell us)
Foundations of Inference in Python