效应量

Python 推断基础

Paul Savala

Assistant Professor of Mathematics

什么是效应量?

一位医生折断一支香烟。

  • 效应量:衡量两个变量关系强度的指标

各种垃圾食品的集合。

Python 推断基础

为何衡量效应量

  • 衡量关系强度
  • 吸烟:大效应量
  • 不良饮食:小效应量
Python 推断基础

P 值

 

  • 是否存在关系?
  • 源自假设检验

效应量

 

  • 关系有多强?
  • 独立于假设检验
Python 推断基础

均值的效应量——Cohen 的 d

$n_1 = \text{第一组样本量}$

$n_2 = \text{第二组样本量}$

$s_1 = \text{第一组标准差}$

$s_2 = \text{第二组标准差}$

$\overline{x}_1 = \text{第一组均值}$

$\overline{x}_2 = \text{第二组均值}$

$s = \displaystyle\sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1 + n_2 - 2}}$

Cohen 的 $d = \displaystyle\frac{\overline{x}_1 - \overline{x}_2}{s}$

Python 推断基础

解读 Cohen 的 d

  • 0.01 - 极小
  • 0.20 - 小
  • 0.50 - 中
  • 0.80 - 大
  • 1.20 - 极大

Cohen 的 $d = 0.6$

中到大效应量

1 https://books.google.com/books?id=2v9zDAsLvA0C&pg=PP1 https://doi.org/10.22237%2Fjmasm%2F1257035100
Python 推断基础

相关的效应量

r, p_value = stats.pearsonr(
    btc_sp_df['Close_BTC'], 
    btc_sp_df['Close_SP500']
    )

print(r**2)
0.82

$R^2:$ 已知一个变量后可解释另一个变量变异的百分比

一个散点图,横轴为标普500收盘价,纵轴为比特币收盘价。图形大致线性,正斜率。

Python 推断基础

分类变量的效应量

  • $\chi^2$ = 列联表的卡方统计量
  • $n$ = 数据点总数
  • $d$ = 自由度 = $min(\text{行}-1, \text{列}-1)$

Cramer 的 $V = \displaystyle\sqrt{\frac{\chi^2/n}{d}}$

Python 推断基础

计算 Cramer 的 V

chi2, p, d, e = stats.chi2_contingency(
    contingency_table)

dof = min(6-1, 2-1) = 1 n = 3394
v = np.sqrt((chi2 / n) / dof)
v = 0.52

一个表格,列出男性与女性及其职位名称,显示各职位的男女人数。

1 https://en.wikipedia.org/wiki/Degrees_of_freedom_(statistics)
Python 推断基础

解读 Cramer 的 V

Cramer's V = 0.52, Degrees of Freedom = 1

一个表格,显示自由度 1 至 5,对应达到小、中、大效应量所需的 Cramer's V 值。小:0.1、0.07、0.06、0.05、0.04;中:0.3、0.21、0.17、0.15、0.13;大:0.5、0.35、0.29、0.25、0.22。

1 https://www.statology.org/interpret-cramers-v
Python 推断基础

让我们来练习!

Python 推断基础

Preparing Video For Download...