抽样与偏差

Python 推断基础

Paul Savala

Assistant Professor of Mathematics

偏差

  • 有偏样本:某一群体在样本中出现频率高/低于总体

一群穿不同颜色上衣的人,但样本只包含穿绿色上衣的人。

Python 推断基础

有偏样本

all_salaries = [75000, 82000, ...]
friends_salaries = [93000, 87000, 103000, 101000]

np.mean(friends_salaries)
96000
Python 推断基础

抽样分布

sampling_distribution = []

for i in range(100):
random_sample = np.random.choice(salaries, size=10) sample_mean = np.mean(random_sample)
sampling_distribution.append(sample_mean)
plt.hist(sampling_distribution) plt.xlabel('Mean salary') plt.ylabel('Percent of samples') plt.title('Sampling distribution of mean salaries') plt.show()
Python 推断基础

显示平均薪资抽样分布的直方图。大致呈钟形,中心约在八万二千美元,最小约七万美元,最大约九万五千美元。

Python 推断基础

依赖样本

  • 样本影响点估计
  • 点估计影响推断
  • 样本影响 p 值计算
Python 推断基础

不依赖样本

  • 总体统计量
    • 不受所取样本影响
  • 检验结论
    • 给定 p 值后,结论不受所取样本影响
Python 推断基础

Passons à la pratique !

Python 推断基础

Preparing Video For Download...