You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"title": "6 Introduction to causal mediation analysis",
407
407
"section": "",
408
-
"text": "Notation\n\n\n\nA = received treatment/intervention/exposure (e.g., 1 = intervention, 0 = no intervention)\nY = observed outcome (e.g., 1 = developed the outcome, 0 = no outcome)\n\\(Y^{a=1}\\) = Counterfactual outcome under treatment a=1 (i.e., the outcome had everyone, counter to the fact, received treatment a = 1)\n\\(Y^{a=0}\\) = Counterfactual outcome under treatment a =0 (i.e., the outcome had everyone, counter to the fact, received treatment a = 0)\n\n\n\n6.1.1 Individual causal effect\nWhen investigating health outcomes, we would ideally want to know if you do X, then Y will happen. We could have a specific question:\n\nWill eating more red meat give me higher blood glucose in 1 year?\n\nTo answer this question we would ideally have you consume more red meat over 1 year and measure your blood glucose levels. Then, we would turn back time, and make you eat something else over 1 year and then measure your blood glucose levels again. If there is a difference between your two outcomes, then we say there is a causal effect.\nBut we can never do this in the real world.\n\n\n6.1.2 Average causal effect\nInstead, we can perform a randomized controlled trial. We now ask a slightly different question:\n\nWill eating more red meat give adults higher blood glucose in 1 year?\n\nWe can randomely assigning one group to consume more red meat and the other group to consume more of something else over 1 year. Then we compare the average blood glucose levels after 1 year in each of the groups. If there is a difference, we could say there is an average causal effect.\n\n\n\n\n\n\nNotation\n\n\n\nWe now modify the terms a little.\n\\(E[Y^{a=1}]\\) the average counterfactual outcome, had all subjects in the population received treatment a = 1.\n\\(Pr[Y^{a=1}]\\) the proportion of subjects that would have developed the outcome Y had all subjects in the population of interest received treatment a = 1.\n\n\n\n\n6.1.3 Definition of a causal effect\nMore formally we can now define a causal effect @hernan_definition_2004:\n\\(E[Y^{a=1} = 1] - E[Y^{a=0} = 1] \\ne 0\\)\n\n\n6.1.4 Code example: estimating causal effect\nTo get an idea of what is going on, we will simulate a simple dataset with an outcome Y, treatment A and a confounder W.\n\nn <- 1e6\nw <- rnorm(n)\na <- rbinom(n, 1, 0.5)\ny <- rnorm(n, w + a)\n\nThen, we will run a linear regression model for the effect of the treatment on the outcome, adjusting for confounder w.\n\nlm_y <- lm(y ~ a + w)\n\nWe now use this model to predict the outcome, if all had received treatment = 1 and another prediction of the outcome had everyone not received treatment (A = 0).\n\npred_y1 <- predict(lm_y, newdata = data.frame(a = 1, w = w))\npred_y0 <- predict(lm_y, newdata = data.frame(a = 0, w = w))\n\nWe can now get the causal effect, which is the average of the difference in the treatment effect in each group. Or put more formally \\(E[Y^{a=1} = 1] - E[Y^{a=0} = 1]\\)\n\nmean(pred_y1 - pred_y0)\n\n[1] 0.9980484\n\n\nIt turns out that this average causal effect is the same as the regression coefficient in the linear model.\n\nsummary(lm_y)\n\n\nCall:\nlm(formula = y ~ a + w)\n\nResiduals:\n Min 1Q Median 3Q Max \n-4.5877 -0.6750 -0.0002 0.6752 4.7461 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) 0.0011520 0.0014150 0.814 0.416 \na 0.9980484 0.0020013 498.708 <2e-16 ***\nw 1.0012021 0.0009995 1001.668 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 1.001 on 999997 degrees of freedom\nMultiple R-squared: 0.556, Adjusted R-squared: 0.556 \nF-statistic: 6.262e+05 on 2 and 999997 DF, p-value: < 2.2e-16\n\n\nA regression-based approach can in some situations also be used. However, for more complicated situations, the regression-based approach fail. The causal intuition in the regression-based approach is also less clear.\n\n\n\n\n\n\nQuestion\n\n\n\nWhy is there no difference between the linear regression coefficient and the predicted mean difference?",
408
+
"text": "Notation\n\n\n\nA = received treatment/intervention/exposure (e.g., 1 = intervention, 0 = no intervention)\nY = observed outcome (e.g., 1 = developed the outcome, 0 = no outcome)\n\\(Y^{a=1}\\) = Counterfactual outcome under treatment a=1 (i.e., the outcome had everyone, counter to the fact, received treatment a = 1)\n\\(Y^{a=0}\\) = Counterfactual outcome under treatment a =0 (i.e., the outcome had everyone, counter to the fact, received treatment a = 0)\n\n\n\n6.1.1 Individual causal effect\nWhen investigating health outcomes, we would ideally want to know if you do X, then Y will happen. We could have a specific question:\n\nWill eating more red meat give me higher blood glucose in 1 year?\n\nTo answer this question we would ideally have you consume more red meat over 1 year and measure your blood glucose levels. Then, we would turn back time, and make you eat something else over 1 year and then measure your blood glucose levels again. If there is a difference between your two outcomes, then we say there is a causal effect.\nBut we can never do this in the real world.\n\n\n6.1.2 Average causal effect\nInstead, we can perform a randomized controlled trial. We now ask a slightly different question:\n\nWill eating more red meat give adults higher blood glucose in 1 year?\n\nWe can randomely assigning one group to consume more red meat and the other group to consume more of something else over 1 year. Then we compare the average blood glucose levels after 1 year in each of the groups. If there is a difference, we could say there is an average causal effect.\n\n\n\n\n\n\nNotation\n\n\n\nWe now modify the terms a little.\n\\(E[Y^{a=1}]\\) the average counterfactual outcome, had all subjects in the population received treatment a = 1.\n\\(Pr[Y^{a=1}]\\) the proportion of subjects that would have developed the outcome Y had all subjects in the population of interest received treatment a = 1.\n\n\n\n\n6.1.3 Definition of a causal effect\nMore formally we can now define a causal effect @hernan_definition_2004:\n\\(E[Y^{a=1} = 1] - E[Y^{a=0} = 1] \\ne 0\\)\n\n\n6.1.4 Code example: estimating causal effect\nTo get an idea of what is going on, we will simulate a simple dataset with an outcome Y, treatment A and a confounder W.\n\nn <- 1e6\nw <- rnorm(n)\na <- rbinom(n, 1, 0.5)\ny <- rnorm(n, w + a)\n\nThen, we will run a linear regression model for the effect of the treatment on the outcome, adjusting for confounder w.\n\nlm_y <- lm(y ~ a + w)\n\nWe now use this model to predict the outcome, if all had received treatment = 1 and another prediction of the outcome had everyone not received treatment (A = 0).\n\npred_y1 <- predict(lm_y, newdata = data.frame(a = 1, w = w))\npred_y0 <- predict(lm_y, newdata = data.frame(a = 0, w = w))\n\nWe can now get the causal effect, which is the average of the difference in the treatment effect in each group. Or put more formally \\(E[Y^{a=1} = 1] - E[Y^{a=0} = 1]\\)\n\nmean(pred_y1 - pred_y0)\n\n[1] 1.001791\n\n\nIt turns out that this average causal effect is the same as the regression coefficient in the linear model.\n\nsummary(lm_y)\n\n\nCall:\nlm(formula = y ~ a + w)\n\nResiduals:\n Min 1Q Median 3Q Max \n-4.6001 -0.6757 0.0002 0.6737 4.8314 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \n(Intercept) -0.0005136 0.0014139 -0.363 0.716 \na 1.0017906 0.0019996 500.994 <2e-16 ***\nw 0.9992255 0.0010008 998.462 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 0.9998 on 999997 degrees of freedom\nMultiple R-squared: 0.5551, Adjusted R-squared: 0.5551 \nF-statistic: 6.239e+05 on 2 and 999997 DF, p-value: < 2.2e-16\n\n\nA regression-based approach can in some situations also be used. However, for more complicated situations, the regression-based approach fail. The causal intuition in the regression-based approach is also less clear.\n\n\n\n\n\n\nQuestion\n\n\n\nWhy is there no difference between the linear regression coefficient and the predicted mean difference?",
409
409
"crumbs": [
410
410
"Sessions",
411
411
"<span class='chapter-number'>6</span> <span class='chapter-title'>Introduction to causal mediation analysis</span>"
F-statistic: 6.239e+05 on 2 and 999997 DF, p-value: < 2.2e-16</code></pre>
450
450
</div>
451
451
</div>
452
452
<p>A regression-based approach can in some situations also be used. However, for more complicated situations, the regression-based approach fail. The causal intuition in the regression-based approach is also less clear.</p>
<scripttype="application/json" data-for="htmlwidget-fc923775471cb7c10718">{"x":{"diagram":"\ndigraph {\n graph []\n node [shape = plaintext]\n W [label = \"W\"]\n A [label = \"A\"]\n M [label = \"M\"]\n Y [label = \"Y\"]\n edge [minlen = 2]\n A->M\n M->Y\n A->Y\n W->A\n W->Y\n W->M\n{rank = same; W; A; M; Y; }\n}\n","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
553
553
</div>
554
554
</div>
555
555
<p>We can see that we not only have to take confounding between the treatment and outcome into account, but we also have to take mediator-outcome (<spanclass="math inline">\(A \leftarrow W \rightarrow Y\)</span>) confounding into account.</p>
<p>From the DAG rules, we have a special problem that we cannot solve with traditional regression approaches. If we adjust for W2 we open a backdoor path by adjusting for the collider <spanclass="math inline">\(W1 \rightarrow W2 \leftarrow A\)</span>. We will work on how to solve this problem later in the course.</p>
<scripttype="application/json" data-for="htmlwidget-79ed8d07887d26c89456">{"x":{"diagram":"\ndigraph {\n graph [rankdir = LR] # Left to right graph\n node [shape = plaintext] \n X [label = \"Lifestyle intervention\"] \n M [label = \"Weight loss\"] \n Y [label = \"Type 2 diabetes\"]\n edge [minlen = 2]\n X -> M\n M -> Y\n}\n","config":{"engine":"dot","options":null}},"evals":[],"jsHooks":[]}</script>
294
294
</div>
295
295
</div>
296
296
<p>We might be interested in further refining the intervention so as to increase the magnitude of the effect. This might be done by altering or improving components of the intervention that target a particular mechanism for the outcome and discarding those components of which perhaps are not relevant for the outcome.</p>
0 commit comments