8

Does anyone know of an implementation (other than the SAS macro) of the doubly robust estimation method found in:

Funk, M.J., Westreich, D. et al (2011). Doubly robust estimation of causal effects. American Journal of Epidemiology, 173 (7): 761-767.[DOI]?

Michael R. Chernick
  • 39,640
  • 28
  • 74
  • 143
ADB
  • 81
  • 1
  • 2
  • 1
    Is there a particular language you would *like* it in? – Fomite Aug 29 '12 at 02:53
  • Implementations in any languages are welcome. I can't use the SAS macro because I don't have the SAS program. – ADB Aug 29 '12 at 02:58
  • @Michael Thank you, not sure how the typo sneaked in there – jonsca Aug 30 '12 at 21:59
  • @jonsca You do a lot of editing and I have checked many of your edits when the requests come to me. Generally you do a very nice job. This one was very good too, just one typo sneaked in. – Michael R. Chernick Aug 30 '12 at 22:16

5 Answers5

12

Doubly robust estimation is not actually particularly hard to implement in the language of your choice. All you are actually doing is controlling for variables in two ways, rather than one- the idea being that as long as one of the two models used for control is correct, you've successfully controlled for confounding.

The easiest way to do it, in my mind, is to use Inverse-Probability-of-Treatment (IPTW) weights to weight the data set, then also include variables in a normal regression model. This is how the authors approach the problem in the paper linked above. There are other options as well, usually built off propensity scores used for either matching or as a covariate in the model.

There are lots of introductions to IPTW in whatever statistical language you prefer. I'd provide code snippets, but all of mine are in SAS, and would likely read very much like the authors.

Briefly, what you do is model the probability of exposure based on your covariates using something like logistic regression and estimate the predicted probability of exposure based on that model. This gives you a propensity score. The Inverse Probability of Treatment Weight is, as the name suggests, 1/Propensity Score. This sometimes produces extreme values, so some people stabilize the weight by substituting the marginal probability of exposure (obtained by a logistic regression model of the outcome and no covariates) for 1 in the equation above.

Instead of treating each subject in your analysis as 1 subject, you now treat them as n copies of a subject, where n is their weight. If you run your regression model using those weights and including covariates, out comes a doubly robust estimate.

A word of caution however: While doubly (or triply, etc.) robust estimation gives you more chances to specify the correct covariate model, it does not guarantee you will do so. And more importantly, cannot save you from unmeasured confounding.

Fomite
  • 21,264
  • 10
  • 78
  • 137
  • Thanks for the answer. Is there a free/trial version of SAS? – ADB Aug 29 '12 at 03:06
  • @ADB Hopefully someone will come along with an implementation in R - I'd do it, but I've got some urgent deadlines coming up. If you're in a place where you have access to statisticians or just folks who like coding, this should be *very* straightforward to implement in whatever package you have. On the scale of "I'll buy you lunch" in terms of the appropriate bribe :) – Fomite Aug 29 '12 at 03:10
  • 1
    @ADB This [vignette](http://cran.r-project.org/web/packages/twang/vignettes/twang.pdf) for the [twang](http://cran.r-project.org/web/packages/twang/index.html) package in R has a nice overview of propensity score analysis and doubly robust estimators. – jthetzel Aug 29 '12 at 12:48
  • @Fomite I think you meant "...some people stabilize the weight by substituting the marginal probability of exposure (obtained by a logistic regression model of the **treatment** and no covariates) for 1 in the equation above." – suckrates Mar 03 '19 at 11:03
4

It looks like there was an implementation in Stata even before the article you cited was published: http://www.stata-journal.com/article.html?article=st0149.

StasK
  • 29,235
  • 2
  • 80
  • 165
2

The tmle R package implemented the Targeted Minimum Loss Based Estimator, which is double robust and efficient under conditions. It has the additional advantage that it is a substitution estimator, as opposed to the Augmented IPTW (which is the one I assume you are referring to).

chl
  • 50,972
  • 18
  • 205
  • 364
Ivan Diaz
  • 21
  • 1
1

I have the estimator described in Funk et al. 2011 (augmented inverse probability weights), implemented in the zEpid Python 3 library within the AIPTW class. Details and syntax are HERE. The library also includes TMLE, in case you wanted to use both approaches

pzivich
  • 1,430
  • 1
  • 5
  • 15
0

There is an R package which implements this DR estimator of the ATE (as well as some other things), the npcausal package: https://github.com/ehkennedy/npcausal

The function that fits a DR estimator is ate()

Ashley Naimi
  • 406
  • 2
  • 8