逆概率加权(IPW)是一种用于解释由于非随机选择观测值或人群信息的非随机缺失而造成的缺失和选择偏差的方法。

原理:这种方法可以通过对观察值的加权来修正分析,使其具有被选中的概率。IPW是基于这样一个假设,即整个研究人群都有可以预测纳入概率(非遗漏)的个体信息,因此,在考虑到这些信息后,我们可以仅从非遗漏的观察值开始对整个目标人群进行推断。计算的程序如下:首先,我们考虑整个研究人群,用逻辑回归模型计算非失访信息的概率,其中响应是非失访,协变量是其可能的预测因素。每个受试者的权重是由预测概率的倒数给出的。然后使用加权模型只对非失踪的观察值进行分析。IPW方法首先生成了一个留在研究中的模型。计算该模型的预测值,而IPW是该预测的留在研究中的概率的倒数。例如,一个一直留在研究中的受试者,但根据该模型,只有1%的机会留在随访中,他的权重为100。理由是他们不仅代表自己,还代表99个 "类似 "他们的人,这些人在随访样本中没有代表。
局限性:IPW是一种允许将选择过程嵌入估计分析中的技术,但它在 "纠正 "选择偏差方面的有效性取决于是否有足够的信息,对整个人口来说,预测非失访概率。通过对所有模型应用稳定的逆概率加权删来解决因数据缺失和失访而产生的潜在选择偏差,并提供了可推广到初始目标人群的结果。加权的应用可以减轻这种非随机选择和缺失造成的偏差,因此,可以将具有完3.整数据和随访的人口子集的结果推广到最初的目标人口。

IPW只能处理那些可以用观察到的信息来预测的数据缺失情况。如果数据缺失取决于结果的未来时间,而这显然是不可观察的,那么我们就不能在不做推测性假设的情况下以可靠的方式捕捉这种依赖关系。
当你使用IPW的技术时,最好是使用稳定的IP权重。它们的可变性较小,因此能产生一个更有效的估计。这就是稳定的IP权重的计算方法。

R实现:

#Simulate data with continuous confounder and outcome, binomial exposure.
#Marginal causal effect of exposure on outcome: 10.
n <- 1000
simdat <- data.frame(l = rnorm(n, 10, 5))
a.lin <- simdat$l - 10
pa <- exp(a.lin)/(1 + exp(a.lin))
simdat$a <- rbinom(n, 1, prob = pa)
simdat$y <- 10*simdat$a + 0.5*simdat$l + rnorm(n, -10, 5)
simdat[1:5,]
library(ipw)
#Estimate ipw weights.
temp <- ipwpoint(
  exposure = a,
  family = "binomial",
  link = "logit",
  numerator = ~ 1,
  denominator = ~ l,
  data = simdat)
summary(temp$ipw.weights)

#Plot inverse probability weights
graphics.off()
ipwplot(weights = temp$ipw.weights, logscale = FALSE,
        main = "Stabilized weights", xlim = c(0, 8))

#Examine numerator and denominator models.
summary(temp$num.mod)
summary(temp$den.mod)

#Paste inverse probability weights
simdat$sw <- temp$ipw.weights

#Marginal structural model for the causal effect of a on y
#corrected for confounding by l using inverse probability weighting
#with robust standard error from the survey package.
require("survey")
msm <- (svyglm(y ~ a, design = svydesign(~ 1, weights = ~ sw,
                                         data = simdat)))
coef(msm)
confint(msm)

ref:1.Inverse probability treatment weighting | R-bloggers

2.Narduzzi, Silvia, Martina Nicole Golini, Daniela Porta, Massimo Stafoggia, and Francesco Forastiere. "Inverse probability weighting (IPW) for evaluating and" correcting" selection bias." Epidemiologia e prevenzione 38, no. 5 (2014): 335-341.

3. Oulhote, Y., Lanphear, B., Braun, J.M., Webster, G.M., Arbuckle, T.E., Etzel, T., Forget-Dubois, N., Seguin, J.R., Bouchard, M.F., MacFarlane, A. and Ouellet, E., 2020. Gestational exposures to phthalates and folic acid, and autistic traits in Canadian children. Environmental health perspectives, 128(2), p.027004.

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐