Skip to content

Commit

Permalink
letter
Browse files Browse the repository at this point in the history
Merge branch 'main' of https://github.com/steno-aarhus/mediation-analysis-course

# Conflicts:
#	sessions/traditional-mediation-analysis.qmd
  • Loading branch information
arborzhang committed May 27, 2024
2 parents d976acc + 5eb5707 commit 09cca9a
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 107 deletions.
178 changes: 178 additions & 0 deletions includes/papers.bib

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions sessions/causal-mediation-analysis-estimation.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Estimation of effects using causal mediation analysis

\<\<\<\<\<\<\< style/apply-some-style-fixes

```{r setup}
#| include: false
Expand Down Expand Up @@ -548,10 +546,10 @@ digraph {

### G-computation

The G-computation algorithm was first introduced by Robins 1986 (refer)
for estimating time-varying exposure causal in the presence of
time-varying confounders of exposure effects. When estimating total
effect, g-computation is generally equivalent to
The G-computation algorithm was first introduced by Robins 1986
@robins_new_1986 for estimating time-varying exposure causal in the
presence of time-varying confounders of exposure effects. When
estimating total effect, g-computation is generally equivalent to
inverse-probability-of-treatment weighting (IPTW). But in
high-dimensional settings, g-computation is more powerful. G-computation
(using g-formula) could also provide an intuitive method for decomposing
Expand Down Expand Up @@ -670,4 +668,3 @@ res_gformula <- cmest(data = data, model = "gformula", outcome = "y", exposure =
summary(res_gformula)
```

10 changes: 7 additions & 3 deletions sessions/causal-mediation-analysis-introduction.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ digraph {
edge [minlen = 2]
A->M
M->Y
A->Y
W->A
W->Y
W->M
Expand Down Expand Up @@ -316,6 +317,7 @@ digraph {
edge [minlen = 2]
A->M
M->Y
A->Y
W1->A
W1->Y
W1->M
Expand All @@ -330,9 +332,10 @@ digraph {
```

From the DAG rules, we have a special problem that we cannot solve with
traditional regression approaches. If we adjust for W2 we open the
backdoor path from $W1 \leftarrow W2 \rightarrow Y$. We will work on how
to solve this problem later in the course.
traditional regression approaches. If we adjust for W2 we open a
backdoor path by adjusting for the collider
$W1 \rightarrow W2 \leftarrow A$. We will work on how to solve this
problem later in the course.

## Non-linearity and interactions

Expand Down Expand Up @@ -575,3 +578,4 @@ In addition to consistency there is the assumption of no carry-over
effects.

## References

79 changes: 23 additions & 56 deletions sessions/causal-mediation-analysis-survival-outcomes.qmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Survival outcomes

<!-- Teaching concepts - Jie (30 min) -->
<!-- Jie (30 min) -->

::: callout-note
## Learning outcomes
Expand All @@ -9,6 +9,8 @@
software
:::

## Time-to-event outcomes

There are many studies conducting mediation analyses with
**time-to-event outcomes**. Survival analysis allows investigators to
study these important outcomes with appropriate consideration for
Expand All @@ -27,8 +29,9 @@ effect. They found the effect of SES on survival time was partially
mediated by stage diagnosis, explaining 12% for lung cancer.

```{r echo=FALSE}
# Creating The causal diagram for a mediation model
library(DiagrammeR)
grViz("
digraph {
graph []
Expand All @@ -44,23 +47,14 @@ digraph {
}")
```

### Conduct causal mediation analysis for time-to-event outcomes

How to conduct causal mediation analysis for time-to-event outcomes? We
introduced the difference and product methods for continuous and binary
outcomes in previous session. It is tempting to run a linear regression
model for the mediator and proportional hazard model for the outcome,
then use product or difference method to estimate the direct effect and
indirect effect.

#### Product method for time-to-event outcomes

The Cox proportional hazards model is commonly used for dealing with
survival data in medical literature. Cox regression estimates the
**hazard ratios** and the values are then used to determine the effect
of the mediator variable between the exposure and the survival time of
outcome.

## Cox model for common outcomes

Could we use the traditional approach for time-to-event outcomes? We
have introduced the difference and product methods for continuous and
binary outcomes in previous session. It is tempting to run a linear
Expand All @@ -69,58 +63,33 @@ outcome, then use product or difference method to estimate the direct
effect and indirect effect.

However, 'non-collaspsibility' is a problem of the hazard ratio as odds
ratio (VanderWeele). Therefore, use of Cox PH regression to
ratio @vanderweele_mediation_2016. Therefore, use of Cox regression to
approximately estimate indirect effects via difference or product of
coefficients rests on the assumption that the outcome is **rare**
(VanderWeele).
@vanderweele_mediation_2016.

Where the outcome is common, measures of the indirect effect or
proportion mediated will be incorrect. Tein and Mackinnon (2003)
considered whether the product method and difference method yield
comparable results with respect to time-to-event outcomes. They found
that the methods coincides for the accelerated failure time model but
not for the proportional hazards model.
proportion mediated will be incorrect. Tein and Mackinnon considered
whether the product method and difference method yield comparable
results with respect to time-to-event outcomes @tein_estimating_2003.
They found that the methods coincides for the accelerated failure time
model but not for the proportional hazards model.

To sum up, we can only use the traditional approaches for rare outcomes.
Otherwise, we can use the product method to get an indication of whether
there is mediation, but be aware that the estimate is not accurate.

### Causal mediation for time-to-event outcomes

::: callout-note
In earlier session,we have been familiar with the counterfactual
concepts in causal mediation:

- $Yi(a, m)$ is the outcome achieved for person i if, possibly
contrary to fact, exposure had been set to a and mediator to m.

- $Mi(a)$ is the mediator achieved for person i if, possibly contrary
to fact, exposure had been set to a.

One can combine the two counterfactuals, yielding so-called nested
counterfactuals defined as

- $Y(a, M (a\*)$.

By introducing the nested counterfactual for a ≠ a\* we can give a
precise mathematical definition of mediation.
:::

For a **survival outcome**, the outcome of interest will be survival
time (SV).

- $SV (t) = P(V ≥ t)$ the survival function at time t

- $SV (t\|c)=P(V ≥ t\|c)$ the survival function conditional on
covariates C

- $λV (t)$ : the hazard at time t

- $λV (t\|c)$: conditional hazard at time t

<<<<<<< HEAD
#### Definitions

If we consider the survival functions for a time-to-event outcome T, we
could decompose the survival function as follows:

Expand All @@ -132,6 +101,7 @@ the survival function scale.

Similarly, we can demcompose the overal difference in hazards on the
hazard scale:

$λT_a(t) - λT_a*(t) = [λT_aM_a(t)-λT_aM_a*(t)] + [λT_aM_a*(t)-λT_a*M_a*(t)]$

### Assumptions of mediation analysis with a time-to-event outcome
Expand All @@ -140,26 +110,20 @@ Similar as our context, mediation analysis with a time-to-event outcome
have to satisfy below assumptions:

- no unmeasured confounding of the exposure-outcome relation;

- no unmeasured confounding of the mediator-outcome relation;

- no unmeasured confounding of the exposure-mediation relation;

- no exposure induced mediation-outcome confounding

- Additionally, we assume that the mediator is measured for everyone
before the outcome occurs.

When the outcome is common, we can use weight approach (Lange 2012)

=======
>>>>>>> f05dab6a872c949f856eb769c9c83d2ba3d9a9b4
### Examples
::: callout-note

::: callout-note We will continue working on the obesity-CVD example in
the Framingham dataset.
We will continue working on the obesity-CVD example in the Framingham
dataset.

The outcome of interest is death from cardiovascular diseases (cvd). The
The outcome of interest is death from cardiovascular diseases (CVD). The
underlying time scale is in days, starting at participants entered the
cohort. The exposure of interest is obesity status at baseline, where
a=1 indicates obese, a=0 indicates non-obese. The mediator is blood
Expand All @@ -172,6 +136,7 @@ impact of obesity on CVD-related death (measured in years).

```{r}
library(tidyverse)
framingham <- read_csv(here::here("data/framingham_dataset.csv"))
framingham <- framingham %>%
Expand All @@ -191,7 +156,7 @@ framingham <- framingham %>%
bmi >= 25 ~ 1,
TRUE ~ 0
),
y_time = y_time / 365.25
y_time = y_time / 365.25 #change time-scale to years
)
```

Expand All @@ -216,3 +181,5 @@ res_rb_coxph <- cmest(
summary(res_rb_coxph)
```

## References
1 change: 1 addition & 0 deletions sessions/group_work_day1.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ in the dataset.

```{r setup}
library(here)
load(here::here("data/frmghamdata.RData"))
```

Expand Down
25 changes: 10 additions & 15 deletions sessions/motivation-for-mediation-analysis.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```{r setup}
#| include: false
# Creating The causal diagram for a mediation model
library(DiagrammeR)
```

Expand All @@ -23,7 +23,7 @@ uncovering the underlying pathways, and mechanisms.

```{r}
#| echo: false
library(DiagrammeR)
grViz("
digraph {
graph []
Expand All @@ -46,8 +46,6 @@ digraph {

### Confirmation and refutation of theory

<!-- DBI: this section is a little unclear. There are 2 mediators in the example above. -->

Let's assume we estimate a familial risk of diabetes and that risk
estimates follow a normal distribution at the population level. Then we
select the extremes of the distribution (2.5%) and assess the relative
Expand All @@ -57,19 +55,17 @@ individuals with a strong/weak familial risk of type 2 diabetes.
### To refine interventions

Let's consider the evidence from the landmark prevention trials. The
Diabetes Prevention Programme (DPP, USA), The Diabetes Prevention Study
(DPS, Finland), and The Da Quin study (DPS, China). These studies
randomized high risk individuals to either metformin or a lifestyle
intervention consisting of a physical activity or physical activity +
diet. The main finding was a \~58% lower risk of incidence type 2
diabetes in the lifestyle intervention group compared to the metformin
group
Diabetes Prevention Programme @knowler_reduction_2002, The Diabetes
Prevention Study @tuomilehto_prevention_2001, and The Da Quin study
@pan_effects_1997. These studies randomized high risk individuals to
either metformin or a lifestyle intervention consisting of a physical
activity or physical activity + diet. The main finding was a \~58% lower
risk of incidence type 2 diabetes in the lifestyle intervention group
compared to the metformin group

```{r}
#| echo: false
# Creating The causal diagram for a mediation model
library(DiagrammeR)
grViz("
digraph {
graph []
Expand Down Expand Up @@ -98,8 +94,7 @@ effectiveness of these prevention efforts

```{r}
#| echo: false
# Creating The causal diagram for a mediation model
library(DiagrammeR)
grViz("
digraph {
graph []
Expand Down
Loading

0 comments on commit 09cca9a

Please sign in to comment.