Propensity Scores
基本的概念
| 符号 | 说明 |
|---|---|
| X | covariate, 用于决策何种treatment |
| \(Z \in \{0, 1 \}\) | Treatment |
| \(r_{ni}\) | 第\(n\)个实例, \(z_n=i\) 下的反应(outcome) |
Strongly ignorable treatment assignment:
即满足条件可交换性:
\]
Balancing Score:
一个关于随机变量\(X\)的函数\(b(X)\)被称为balancing score, 若:
\]
Propensity Score:
\]
重要的结果
\(X \perp Z | b(X)\)
一个函数\(b(X)\)是balancing score, 当且仅当存在一个映射\(f\)使得\(e(X) = f((b(X))\).
\(\Leftarrow\)
当, \(b(x) \not= b\)的时候, 显然\(P(Z=z, X=x|b(X)=b)=0\), 此时满足条件独立性, 故只需考虑\(b(x) = b\)的情况.
P(Z=z, X=x|b(X)=b)
&= P(Z=z| X=x, b(X) = b) \: P(X=x|b(X)=b) \\
&= P(Z=z| X=x) \: P(X=x|b(X)=b) \\
&\mathop{=}\limits^{?}P(Z=z|b(X)=b) \: P(X=x|b(X)=b).
\end{array}
\]
显然最后一个等式成立, 只需满足:
\]
注: 最后一个等式成立, 是因为\(e(x') = f(b(x')) = f(b)\).
又
P(Z=z|b(X)=b)
&= \sum_{x' \in \{b(X) = b\}}P(Z=z|X=x', b(X)=b)\: P(X=x'|b(X)=b) \\
&= \sum_{x' \in \{b(X) = b\}}P(Z=z|X=x')\: P(X=x'|b(X)=b) \\
&= \sum_{x' \in \{b(X) = b\}} e(x')^z \cdot (1 - e(x'))^{1-z} \: P(X=x'|b(X)=b) \\
&= e(x')^z \cdot (1 - e(x'))^{1-z}\\
&= P(Z=z|X=x).
\end{array}
\]
注: 显然上面的证明是要求\(Z \in \{0, 1\}\)的, 即二元的treatment.
除非有额外的条件, 比如:
\]
对所有的\(x, x' \in \{x| b(X) = b\}\).
\(\Rightarrow\)
首先, 如果\(b(X)\)本身从\(X\)的一个单射, 那么显然存在这样的\(f\).
若\(b()\)不是单射, 且不存在\(f\)使得\(e(X) = f(b(X))\), 则一定存在\(x, x'\)使得
\]
此时:
P(Z=1|X=x, b(x)) \not= P(Z=z|X=x', b(x')).
\]
故\(b(X)\)不是balancing score, 矛盾.
注: 显然\(e(X)\)以及\(b(X) = X\)均为balancing score.
\((r_0, r_1) \perp Z | b(X)\)
若:
\]
则:
\]
不等式的证明是显然的.
只需证明:
\]
P(Z=1|r_0, r_1, b(X)=b)
&= \mathbb{E}_{x} \mathbb{E}_{z} [[Z|X=x, r_0, r_1,b(X)=b)] |r_0, r_1,b(X)=b] \\
&= \mathbb{E}_{x} \mathbb{E}_{z} [[Z|X=x)] |r_0, r_1,b(X)=b] \\
&= \mathbb{E}_{x} [e(X) |r_0, r_1,b(X)=b] \\
&= e(X)
\end{array}
\]
最后一个等式成立, 是因为, \(b(X)=b \rightarrow e(X) = f(b)\).
倘若上面的额外的条件成立, 即
\]
则有:
P(Z=z|r_0, r_1, b(X)=b)
&= \sum_{x' \in \{b(X) = b\}} P(Z=z, X=x'|r_0, r_1, b(X)=b) \\
&= \sum_{x'} P(Z=z|r_0, r_1, X=x', b(X)=b)\: P(X=x'|r_0, r_1, b(X)=b) \\
&= \sum_{x'} P(Z=z|X=x')\: P(X=x'|r_0, r_1, b(X)=b) \\
&= \sum_{x'} p(z)\: P(X=x'|r_0, r_1, b(X)=b) \\
&= p(z) = P(Z=z|X=x) = P(Z=z|b(X)=b).
\end{array}
\]
总结为:
若:
\]
且:
\]
则:
\]
应用
假设\(X\)包含所有地confounders, 即
\]
Propensity Score Matching
既然, 在\(e(x)\)下:
\]
那么:
\]
这个期望的过程可以分解为:
- 随机采样\(e(x)\);
- 在所有\(e(X)=e(x)\)的样本中, 随机选择\(Z=0\)和\(Z=1\)的样本;
通过此过程构造的新的数据集, 显然只需要将treated group中的群体对\(r\)取平均减去control group中的平均就能得到最后的treatment effect的估计了.
通过 propensity score matching 重采样构造的数据集满足:
\]
因为对于每一个treated group 中有一个样本\(e(x) = e\), 在control group中就有一个对应的\(e(x') = e\).
propensity score matching 重采样的实际方式可以简化为:
- 从treated group 中随机采样一个样本\((x,z,r)\);
- 计算其propensity score \(e(x)\);
- 从control group 中找到一个对应的\((x',z',r')\) 满足\(e(x')=e(x)\);
- 若存在多个\(x'\), 在其中随机采样一个.
上述采样过程中, 会遇到的问题:
不存在\(x'\), 这种情况是很容易遇到的, 一般, 我们可以选取\(x'\)使得\(e(x')\)最接近\(e(x)\), 这种方式一般称为greedy matching; 或者, 我们可以指定一个threshold, 在threshold内的\(\{x'\}\)中采样, 若一个都没有, 则舍弃\(x\).
\(x, x'\)被选中之后, 是否仍有机会被采样, 这是俩种策略;
Stratification on the Propensity Score
即将\(e(X)\)的值域分割成互斥的K个部分, 每个部分所包含的样本数量相近.
然后对每一个部分计算treatment effect, 最后再平均(加权平均, 权重为样本数量).
一般情况下, \(K=5\), 就能使得每一个stratum内的\(e(X)\)的值非常接近, 这就能够近似保证:
\]
在每一个stratum内成立.
那么, 此时我们只需通过取平均就能直接计算出每一个stratum的treatment effect.
Inverse Probability of Treatment Weighting Using the Propensity Score
这个实际上就是普通的 IP weighting.
评估
显然, 我们多半需要从已有的数据中估计出 propensity score, 比如用常见的逻辑斯蒂回归模型. 自然地, 我们需要判断我们拟合的模型是否正确.
既然propensity score 也是一个 balancing score, 那么如果拟合的比较正确, 就应该有:
\]
也就是说, 我们需要判断, 在每一个\(e(x)\)下, \(X, Z\)是否独立.
对于matching, 若条件独立满足, 则有:
=\mathbb{E}_{e(x)}\{\mathbb{E}[X|Z=0, e(x)] | Z=0 \}
\]
一个期望里用了条件独立, 第二个条件期望相等是因为matching 保证:
\]
故, 我们只需要比较treated group 和 control group的一阶矩的差别:
\]
在实际中, 比较的是如下的标准化的:
\]
一般\(d < 0.1\)就可以认为这个propensity score拟合的不错.
对于stratification, 我们只需对每一个strata判断上面的结果.
对于IP weighing, 说实话没读懂:
For IPTW this assessment involves comparing treated and untreated subjects in the sample weighted by the inverse probability of treatment.
Propensity Scores的更多相关文章
- Chapter 15 Outcome Regression and Propensity Scores
目录 15.1 Outcome regression 15.2 Propensity scores 15.3 Propensity stratification and standardization ...
- Causal Inference
目录 Standardization 非参数情况 Censoring 参数模型 Time-varying 静态 IP weighting 无参数 Censoring 参数模型 censoring 条件 ...
- [LeetCode] Rank Scores 分数排行
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ra ...
- Codeforces Round #370 (Div. 2) D. Memory and Scores DP
D. Memory and Scores Memory and his friend Lexa are competing to get higher score in one popular c ...
- Faster RCNN 运行自己的数据,刚开始正常,后来就报错: Index exceeds matrix dimensions. Error in ori_demo (line 114) boxes_cell{i} = [boxes(:, (1+(i-1)*4):(i*4)), scores(:, i)];
function script_faster_rcnn_demo() close all; clc; clear mex; clear is_valid_handle; % to clear init ...
- LeetCode Database: Rank Scores
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ra ...
- LeetCode:Rank Scores
做到这题时卡了不少时间,参考了别人的解法,觉得挺不错的,还挺巧妙. SELECT s2.Score,s1.Rank From ( SELECT S1.Score, COUNT(*) as Rank F ...
- (Problem 22)Names scores
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-tho ...
- Memory and Scores
Memory and Scores 题目链接:http://codeforces.com/contest/712/problem/D dp 因为每轮Memory和Lexa能取的都在[-k,k],也就是 ...
随机推荐
- Shell 管道指令pipe
目录 管道命令pipe 选取命令 cut.grep cut 取出需要的信息 grep 取出需要行.过滤不需要的行 排序命令 sort.wc.uniq sort 排序 假设三位数,按十位数从小到大,个位 ...
- LeetCode一维数组的动态和
一维数组的动态和 题目描述 给你一个数组 nums.数组「动态和」的计算公式为:runningSum[i] = sum(nums[0]...nums[i]). 请返回 nums 的动态和. 示例 1: ...
- 面试一定会问到的-js事件循环
这篇文章讲讲浏览器的事件循环(nodejs中的事件循环稍有不同),事件循环是js的核心之一,因为js是单线程,所以异步事件实现就是依赖于事件循环机制,理解事件循环可让我们更清晰的处理js异步事件和应对 ...
- oracle 锁查询
--v$lock中 id1 在锁模式是 TX 时保存的是 实物id 的前2段SELECT * FROM (SELECT s.SID, TRUNC(id1 / power(2, 16)) rbs, bi ...
- 实时数据同步inotify+rsync
inotify inotify是一个实时监控服务,他能实时监控服务器中的目录的变化,发现目录中变化后,在配合rsync服务推送到备份服务器上 inotify要求内核要在2.6.13或之上,通过noti ...
- 实现将rsyslog将日志记录与MySQL中
准备两个节点 node3: rsyslog node2: 数据库 准备相应的包 [root@node3 php-fpm.d]#yum install rsyslog-mysql 将数据拷贝到数据 ...
- spring的核心容器ApplicationContext
//bean.xml配置文件 <?xml version="1.0" encoding="UTF-8"?><beans xmlns=" ...
- AT1980 [AGC001B] Mysterious Light 题解
# 题意:高桥 くん 有一个边长为 N 的三枚镜子构成的正三角形 , 顶点为 a, b, c. 他有一个超级步枪 , 放在 AB 段的P点上,使得 AP=X . 并沿着平行于 BC 的方向发射一道光 ...
- Gitlab用户在组中有五种权限
Gitlab用户在组中有五种权限:Guest.Reporter.Developer.Master.Owner Guest:可以创建issue.发表评论,不能读写版本库 Reporter:可以克隆代码, ...
- 转:Android控件属性
Android功能强大,界面华丽,但是众多的布局属性就害苦了开发者,下面这篇文章结合了网上不少资料,花费本人一个下午搞出来的,希望对其他人有用. 第一类:属性值为true或false android: ...