ngreifer / WeightIt

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

Extracting propensity scores from weightthem objects with a continuous exposure #30

Closed dannysack closed 2 years ago

dannysack commented 2 years ago

Hey, this is an excellent package, thank you so much!

I am trying to do a sensitivity analysis where I compare the effect estimate generated from the weight them object for a continuous exposure weighted sample to the effect estimate that includes the propensity score as a covariate (without weighing it). I am doing so using imputed data, however, using weightthem. Even after including include.obj = TRUE as suggested in #3, I do not see any components of the output object that include propensity scores for such a sensitivity analysis (I am posting here because the weightthem documentation suggests that additional arguments beyond what is specified in the documentation are implemented via weightit).

As an example:

Generate weights: ols_wt <- weightthem(X ~ Z1 + Z2 + Z3, datasets = imp_data, method = "ps", approach = "within")

Model 1: with(ols_wt, glm(Y ~ X, family = binomial))

Model 2: with(imp_data, glm(Y ~ X + PS, family = binomial))

Does the propensity score exist in the weightthem object or will I just need to create it myself (which is not a problem, I just want to make sure I'm not missing anything and would rather use the propensity score used to generate the weights so I know I'm comparing related quantities)?

Thanks so much!

Danny

ngreifer commented 2 years ago

Hi Danny,

For continuous treatments, I don't include a generalized propensity score (GPS) in the output because it doesn't have the same interpretation as a propensity score for categorical treatments and can't really be used like the propensity score in regression adjustment as you are proposing. See Hirano & Imbens (2005). If you want to implement a Hirano & Imbens style GPS regression, you will have to program it yourself or look in another package. If you want to perform a sensitivity analysis, I recommend using other types of weights rather than other methods of adjusting for the GPS.

dannysack commented 2 years ago

Thanks, Noah!