Skip to content

Causal inference with time-varying mediators

Adan Becerra writes to Tyler VanderWeele:

I have a question about your paper “Mediation analysis for a survival outcome with time-varying exposures, mediators, and confounders” that I was hoping that you could help my colleague (Julia Ward) and me with. We are currently using Medicare claims data to evaluate the following general mediation among dialysis patients with atrial fibrillation:

Race -> Warfarin prescriptions -> Stroke within 1 year.

where Warfarin prescriptions is a time-varying mediator (using part D claims with number supplied as days) and there are time-dependent confounders. Even though the exposure doesn’t vary over time, this is an extension of Van der Laans time dependent mediation method because yours also includes time dependent confounders. However, I would also like to account for death as a competing risk via a sub-hazard. Am I correct that the G-formula cannot do this? If so, are you aware of any methods that could do this? I found the following paper that implements a marginal structural subdistribution hazard models, but this doesn’t do mediation (at least I don’t think so).

Becerra also cc-ed me, adding:

I recognize that you have stated on the blog before that you are hesitant to use mediation analyses but they are very common in epi/clinical epi but any help would be much appreciated.

I replied that the two arrows in the above diagram have different meanings. The first arrow is a comparison, comparing people of different races. The second arrow is causal, comparing what would happen if people are prescribed Warfarin or not.

To put it another way, the first arrow is a between-person comparison, whereas the second arrow is implicitly a within-person comparison.

I assume they’d also want another causal arrow, going from Warfarin prescription -> taking Warfarin -> Stroke. But maybe they’re assuming that getting the prescription is equivalent to taking the drug in this case. Anyway, it seems to me that prescription of the drug is not a “mediator” but rather is the causal variable (in the diagram) or an instrument (in the more elaborate diagram, where prescription is the instrument and taking the drug is the causal variable).

This sort of thing comes up a lot when someone proposes a method I don’t fully understand. Perhaps because I don’t really understand it, I end up thinking about the problem in a different way.

Becerra responded:

I see your point about the first arrow maybe not being causal. In fact, Tyler and Whitney Robinson wrote a whole paper on the topic:

We also discuss a stronger interpretation of the “effect of race” (stronger in terms of assumptions) involving the joint effects of race-associated physical phenotype (e.g. skin color), parental physical phenotype, genetic background and cultural context when such variables are thought to be hypothetically manipulable and if adequate control for confounding were possible.

So according to this it seems like there is a way of estimating the causal effect of race. but let’s suppose my exposure wasn’t race just so I can highlight the real issue in this analysis. My concern is that I haven’t been able to find a method thay does mediation analyses with time varying mediators and exposures and confounders for a survival outcome with a sub hazard competing risk a la Fine and Grey. in the dialysis population death is a huge competing risk for stroke.

However, I am no expert in this and I too am afraid I may be missing something which is why I reached out. When I saw Tyler’s original paper I thought it would work but I can’t see how to incorporate the sub hazard.

Is there such a thing as time varying instruments? In this analysis I’m using part D claims in Medicare (so I don’t really know if they took the drug) and patients can go on and off the drugs as well as initiate other drugs (like beta blockers calcium channel blockers etc). I’m really uniterested in warfarin so I’m concerned about time varying confounding due to other drugs.

Doesn’t seem to me like a static yes no instrument would work but I’ve never fit an IV model so what do I know.

I did just see some instrumental variable models with sub hazards so I’ll look there.

And then VanderWeele replied:

Yes, as Andrew noted, if you have “race” as your exposure then this should not be interpreted causally with respect to race. You can (as per the VanderWeele and Robinson, 2014) still interpret the “indirect effect” estimate as e.g. by what portion you would reduce the existing racial disparity if you intervened on warfarin to equalize its distribution in the black population to what it is in the white population, and the “direct effect” as the portion of the disparity that would still remain after that intervention.

We do have a paper on mediation with a survival outcome with a time-varying mediator, but alas it will not handle competing risk and sub-hazards. That would require further methods development.

I’ve never worked on this sort of problem myself. If I did so, I think I’d start by modeling the probability of stroke given drug prescriptions and individual-level background variables including ethnicity, age, sex, previous health status, etc. Maybe with some measurement error model if claims data are imperfect.


  1. Adan Becerra says:

    Just wanted to clarify that in the potential outcomes framework it is hard to estimate causal effect of race but we can estimate the causal effect of unequal race relations per the Robinson and Vanderweele paper. In our analysis racial minorities had higher rates of stroke compared to Whites and were less likely to be prescribed warfarin. So we wanted to use mediation to answer the following question: what portion of excess strokes in minorities could be prevented if their warfarin distributions were equalized to that in the White population.

    Even though Vanderweeles method doesn’t account for competing risk we ended up using it and estimated interventional direct and indirect effects and the %mediated using the survival mediational g formula. There is a SAS macro that they developed which makes estimation pretty easy.

  2. Once again it seems to me that what is needed in these causal models is a mechanistic description. At time t stroke risk per unit time is determined by some physiological factors… and warfarin prescription is determined by some cultural factors. once warfarin is prescribed it becomes a physiological factor… Simulate a trajectory through time for each patient in which stroke risk goes to 1 at time of stroke (if any), also death risk similarly…

    once you have a reasonable time dependency structure involving the appropriate physiological risks, you can talk about the counterfactual for if each patient were prescribed warfarin at the same time point where a white patient were prescribed…

    the non dynamic version is obviously problematic because “whether you were rxed warfarin isn’t a single thing, it’s at what point in your life it was prescribed that matters. a day before you throw a clot and die isn’t the same thing as 5 years earlier when your chart indicates that it’s prudent.

    • Adan Becerra says:

      Yes because warfarin is time varying because patients are prescribed this drug multiple times over follow up and the amount of pills can vary. the survival mediational g formula simulates the potential outcomes at each day of follow up

      • Not only is dose varying etc, but also inherently risk of stroke/death is a quantity whose instantaneous value changes in time as a function of the physiological stuff. A day of exposure to say very high levels of particulate pollution due to living in the middle of a forest fire infested county in CA is different in terms of clot formation from a day of cruising around on a sailboat in the crystal clear air of the Bahamas, and everything in-between.

        • Adan Becerra says:

          Yes I agree. This is why you also we also accounted for other time varying confounders. We also measured what other drugs these patients were taking (beta blockers calcium channel blockers etc)and we also adjusted for time varying cardiovascular procedures including catheter ablation and cardioversion. Dialysis patients with atrial fibrillation take multiple drugs/treatments and must be accounted for.

  3. yyw says:

    What do we hope to get out of the study? If it is to inform policy, it seems that studying each stage separately is sufficient.

    • Adan Becerra says:

      The objective of the study is to measure how many strokes we could prevent in minority populations if their warfarin distribution was equalized to that in the White population.

      Minority patients had higher stroke rates and were less likely to he prescribed warfarin (a drug that prevents stroke)

      • Adan Becerra says:

        This provides a clinically meaningful number for policy makers. As opposed to just saying that minorities had higher strokes and less likely to receive drugs, this analysis confirms that there is a specific mechanism that links these two observations and by estimating the % mediated, we can quantify the amount of strokes that we could prevent if we intervened

  4. Adan Becerra says:

    Here is what came of this. Thanks to Andrew and Tyler for the help

  5. aleja says:

    I thought this was uncontroversial though, or at least had been resolved already. Race can have causal effects…

    doesn’t the sun warm the earth?

Leave a Reply