Skip to content

Commit 812c23f

Browse files
committed
Try out Rob's suggested edits
1 parent 9ab7646 commit 812c23f

File tree

3 files changed

+942
-8
lines changed

3 files changed

+942
-8
lines changed

content/blog/2021-01-15-causal-effect-mobility.Rmd

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ summary: |
1717
acknowledgements: |
1818
We'd like to thank the Delphi engineering team for making this data available.
1919
And we'd like to thank Roni Rosenfeld and Ryan Tibshirani for posing the
20-
challenge of making counterfactual predictions. And thanks to Alex Reinhart
21-
for getting our post into the appropriate format.
20+
challenge of making counterfactual predictions. We thank Rob Tibshirani for
21+
suggesting several improvements on this post, and Alex Reinhart for getting
22+
our post into the appropriate format.
2223
related:
2324
- 2020-08-28-api
2425
output:
@@ -49,7 +50,10 @@ So how do we estimate causal effects? There is a collection of methods
4950
for this task. The important thing is that we can't just use standard
5051
prediction methods. We need to use specialized methods that were designed
5152
for causal inference. In this post we will discuss our work on
52-
the causal effect of social mobility on deaths from COVID.
53+
the causal effect of social mobility on deaths from COVID. The social mobility
54+
variable we will use is the proportion of people staying home. We can think of
55+
this of anti-mobility, and expect that higher values of this variable will lead
56+
to fewer deaths from COVID.
5357

5458
Let’s start with a brief introduction to causal inference.
5559

@@ -137,19 +141,33 @@ $$
137141
\hat{\mathbb{E}(Y^a)} = \frac{1}{n}\sum_i \hat\mu(X_i,a).
138142
$$
139143

140-
This is called the plug-in estimator.
144+
This is called the plug-in estimator. (Note that for prediction we would not use
145+
this formula. We would just use $\hat \mu(X, A)$.)
141146
There are often better estimators,
142147
but we won't get into that here.
143148
The important thing
144149
is:
145150
there is a formula for the causal effect
146151
and we can estimate it.
147152

153+
The first plot below shows an example where we would predict
154+
higher values of $Y$ when $A$ is large. For pure prediction, this is
155+
the correct conclusion. The second plot shows that once we
156+
account for $X = \text{age}$ (corresponding to different colors) there is
157+
a negative relationship between $Y$ and $A$. In this case, age is a
158+
confounder and the $g$-formula would correctly recover the negative
159+
relationship. For causal inference, this is the correct conclusion.
160+
161+
![](/blog/images/causal-simple-confounder.svg)
162+
148163
Things get trickier
149164
when there are time varying variables.
150165
Consider weekly mobility and death data
151166
$(A_1,Y_1),\dots, (A_T,Y_T)$
152167
in one state.
168+
For simplicity, we'll assume that there are no $X$ variables. But we'll see that at time $t$, the
169+
variables $Y_1, \dots, Y_{t-1}$ are confounding variables for the causal effect of
170+
mobility on $Y_t$.
153171
Define
154172
$\overline{A}_t = (A_1,\dots, A_t)$ and
155173
$\overline{Y}_t = (Y_1,\dots, Y_t)$

content/blog/2021-01-15-causal-effect-mobility.html

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
acknowledgements: |
1818
We'd like to thank the Delphi engineering team for making this data available.
1919
And we'd like to thank Roni Rosenfeld and Ryan Tibshirani for posing the
20-
challenge of making counterfactual predictions. And thanks to Alex Reinhart
21-
for getting our post into the appropriate format.
20+
challenge of making counterfactual predictions. We thank Rob Tibshirani for
21+
suggesting several improvements on this post, and Alex Reinhart for getting
22+
our post into the appropriate format.
2223
related:
2324
- 2020-08-28-api
2425
output:
@@ -55,7 +56,10 @@
5556
for this task. The important thing is that we can’t just use standard
5657
prediction methods. We need to use specialized methods that were designed
5758
for causal inference. In this post we will discuss our work on
58-
the causal effect of social mobility on deaths from COVID.</p>
59+
the causal effect of social mobility on deaths from COVID. The social mobility
60+
variable we will use is the proportion of people staying home. We can think of
61+
this of anti-mobility, and expect that higher values of this variable will lead
62+
to fewer deaths from COVID.</p>
5963
<p>Let’s start with a brief introduction to causal inference.</p>
6064
<div id="causal-inference" class="section level2">
6165
<h2>Causal Inference</h2>
@@ -131,18 +135,30 @@ <h2>Causal Inference</h2>
131135
<p><span class="math display">\[
132136
\hat{\mathbb{E}(Y^a)} = \frac{1}{n}\sum_i \hat\mu(X_i,a).
133137
\]</span></p>
134-
<p>This is called the plug-in estimator.
138+
<p>This is called the plug-in estimator. (Note that for prediction we would not use
139+
this formula. We would just use <span class="math inline">\(\hat \mu(X, A)\)</span>.)
135140
There are often better estimators,
136141
but we won’t get into that here.
137142
The important thing
138143
is:
139144
there is a formula for the causal effect
140145
and we can estimate it.</p>
146+
<p>The first plot below shows an example where we would predict
147+
higher values of <span class="math inline">\(Y\)</span> when <span class="math inline">\(A\)</span> is large. For pure prediction, this is
148+
the correct conclusion. The second plot shows that once we
149+
account for <span class="math inline">\(X = \text{age}\)</span> (corresponding to different colors) there is
150+
a negative relationship between <span class="math inline">\(Y\)</span> and <span class="math inline">\(A\)</span>. In this case, age is a
151+
confounder and the <span class="math inline">\(g\)</span>-formula would correctly recover the negative
152+
relationship. For causal inference, this is the correct conclusion.</p>
153+
<p><img src="/blog/images/causal-simple-confounder.svg" /></p>
141154
<p>Things get trickier
142155
when there are time varying variables.
143156
Consider weekly mobility and death data
144157
<span class="math inline">\((A_1,Y_1),\dots, (A_T,Y_T)\)</span>
145158
in one state.
159+
For simplicity, we’ll assume that there are no <span class="math inline">\(X\)</span> variables. But we’ll see that at time <span class="math inline">\(t\)</span>, the
160+
variables <span class="math inline">\(Y_1, \dots, Y_{t-1}\)</span> are confounding variables for the causal effect of
161+
mobility on <span class="math inline">\(Y_t\)</span>.
146162
Define
147163
<span class="math inline">\(\overline{A}_t = (A_1,\dots, A_t)\)</span> and
148164
<span class="math inline">\(\overline{Y}_t = (Y_1,\dots, Y_t)\)</span>

0 commit comments

Comments
 (0)