ngreifer / WeightIt

WeightIt: an R package for propensity score weighting
https://ngreifer.github.io/WeightIt/
102 stars 12 forks source link

Understanding `get_cont_weights` #49

Closed lorenzoFabbri closed 1 year ago

lorenzoFabbri commented 1 year ago

This is not an issue/bug. I am just trying to understand how the weights are estimated from the PS, in the case of continuous exposures. In the get_cont_weights function (line 866) , the PS is subtracted from the treatment values, and the result is used to the estimate the weights. Why so? I looked into the referenced literature but could not find anything.

ngreifer commented 1 year ago

The denominator of the weights is the conditional density of the treatment given the covariates evaluated at the observed values of the treatment. The conditional density of the treatment given the covariates is the density of the errors of the treatment model. The GPS are predicted values from the treatment model, and subtracting them from the treatment gives us the residuals of the treatment model. The distribution of the residuals is an estimate of the distribution of errors, which is equal to the conditional distribution of the treatment given the covariates.

This is described in Zhu et al. (2015, p4):

Screenshot 2023-06-19 at 5 52 41 PM

and in Robins et al. (2000):

Screenshot 2023-06-19 at 5 58 01 PM

where $a_{0i}$ is the observed treatment and $\hat\alpha_0 + \hat\alpha1 l{0i}$ is the linear predictor in the treatment model with covariate $l_{0}$.