class: center middle main-title section-title-3 # In-person<br>session 4 .class-info[ **February 3, 2022** .light[PMAP 8521: Program evaluation<br> Andrew Young School of Policy Studies ] ] --- name: outline class: title title-inv-8 # Plan for today -- .box-4.medium.sp-after-half[Quick useful R tips] -- .box-2.medium.sp-after-half[Measuring outcomes] -- .box-5.medium.sp-after-half[DAGs] --- layout: false name: r-stuff class: center middle section-title section-title-4 animated fadeIn # Quick useful<br>R tips --- layout: true class: middle --- .box-4.large[Visual markdown editor] --- .box-4.large[Weird figure/table<br>placement in PDFs] ??? https://bookdown.org/yihui/rmarkdown-cookbook/figure-placement.html --- .box-4.large[Word count] ??? <https://github.com/benmarwick/wordcountaddin> --- .box-4.large[Figure and table<br>captions and numbers] ??? - <https://bookdown.org/yihui/rmarkdown-cookbook/figure-number.html> - <https://rmd4sci.njtierney.com/figures-tables-captions-.html> - <https://rmd4sci.njtierney.com/start.html> --- .box-4.large[DAGs in R vs. Dagitty] ??? <https://evalsp22.classes.andrewheiss.com/example/dags/> --- layout: false name: outcomes class: center middle section-title section-title-2 animated fadeIn # Measuring<br>outcomes --- layout: true class: title title-2 --- # Outcomes and programs .box-2.medium[Outcome variable] .box-inv-2.sp-after-half.SMALL[Thing you're measuring] -- .box-2.medium[Outcome change] .box-inv-2.sp-after-half.SMALL[∆ in thing you're measuring over time] -- .box-2.medium[Program effect] .box-inv-2.SMALL[∆ in thing you're measuring over time *because of* the program] --- # Outcomes and programs <figure> <img src="img/04/program-effect.png" alt="Outcomes and program effect" title="Outcomes and program effect" width="100%"> </figure> --- layout: false class: middle .box-2.large[Abstraction] --- layout: false name: dags class: center middle section-title section-title-5 animated fadeIn # DAGs --- layout: true class: middle --- .box-5.medium[You keep saying that causal inference<br>lets you "legally" make causal claims.] .box-5.medium[Are there actual legal consequences<br>if you make a causal claim without<br>specific language?] --- .box-5.large[Causal thinking is necessary—<br>even for descriptive work!] --- .center[ <figure> <img src="img/04-class/supercentenarians.png" alt="Supercentenarians" title="Supercentenarians" width="46%"> </figure> ] ??? Necessity of causal thinking: Mention the McElreath tweet on birth certificate introduction and death ages: <https://twitter.com/rlmcelreath/status/1427564280744976384> <https://www.biorxiv.org/content/10.1101/704080v2> --- layout: false .box-5.less-medium["Every time I get a haircut, I become more mature!"] <figure> <img src="img/04-class/ben-hair.jpg" alt="Benjamin haircut" title="Benjamin haircut" width="100%"> </figure> --- .box-5.less-medium["Every time I get a haircut, I become more mature!"] <img src="04-class_files/figure-html/unnamed-chunk-1-1.png" width="70%" style="display: block; margin: auto;" /> .center[$$E[\text{Maturity} \mid \operatorname{do} (\text{Get haircut})]$$] --- .box-5.less-medium[Getting older opens a backdoor path] <img src="04-class_files/figure-html/unnamed-chunk-2-1.png" width="70%" style="display: block; margin: auto;" /> --- class: middle .box-5.medium[But what does that mean,<br>"opening a backdoor path"?] .box-5.medium[How does statistical association<br>get passed through paths?] --- .box-5.less-medium.sp-after[How do I know which of these is which?] .center[ <figure> <img src="img/05-class/dag-associations.png" alt="DAG associations" title="DAG associations" width="100%"> </figure> ] --- class: middle .pull-left[ <figure> <img src="img/04-class/slider-switch-plain-80.jpg" alt="Switch and slider" title="Switch and slider" width="100%"> </figure> ] .pull-right[ <img src="04-class_files/figure-html/confounding-dag-alone-1.png" width="100%" style="display: block; margin: auto;" /> ] --- class: middle .pull-left[ <figure> <img src="img/04-class/slider-switch-plain-80.jpg" alt="Switch and slider" title="Switch and slider" width="100%"> </figure> ] .pull-right[ <img src="04-class_files/figure-html/mediating-dag-alone-1.png" width="100%" style="display: block; margin: auto;" /> ] --- class: middle .pull-left[ <figure> <img src="img/04-class/slider-switch-plain-80.jpg" alt="Switch and slider" title="Switch and slider" width="100%"> </figure> ] .pull-right[ <img src="04-class_files/figure-html/colliding-dag-alone-1.png" width="100%" style="display: block; margin: auto;" /> ] --- layout: true class: middle --- .box-5.medium[d-separation] .box-inv-5[Except for the one arrow between X and Y,<br>no statistical association can flow between X and Y] .box-inv-5[This is **identification**—<br>all alternative stories are ruled out<br>and the relationship is isolated] --- .box-5.large[How exactly do colliders<br>mess up your results?] .box-5.medium[It looks like you can<br>still get the effect of X on Y] --- <img src="04-class_files/figure-html/nba-dag-1.png" width="65%" style="display: block; margin: auto;" /> --- .center[ <figure> <img src="img/04-class/facebook.png" alt="Facebook collider" title="Facebook collider" width="55%"> </figure> ] ??? <https://www.businessinsider.com/facebook-sent-incomplete-misinformation-data-flawed-researchers-2021-9> <https://www.nytimes.com/live/2020/2020-election-misinformation-distortions#facebook-sent-flawed-data-to-misinformation-researchers> --- layout: false class: title title-5 # Does niceness improve appearance? .pull-left[ <img src="04-class_files/figure-html/unnamed-chunk-3-1.png" width="100%" style="display: block; margin: auto;" /> ] -- .pull-right[ <img src="04-class_files/figure-html/unnamed-chunk-4-1.png" width="100%" style="display: block; margin: auto;" /> ] --- class: title title-5 # Collider distorts the true effect! .pull-left[ <img src="04-class_files/figure-html/unnamed-chunk-5-1.png" width="100%" style="display: block; margin: auto;" /> ] -- .pull-right[ <img src="04-class_files/figure-html/unnamed-chunk-6-1.png" width="100%" style="display: block; margin: auto;" /> ] --- .box-5.large[Effect of race on police use of force<br>using administrative data] --- .box-5.medium[Effect of race on police use of force<br>using administrative data] .pull-left[ <figure> <img src="img/05-class/klm-dag.png" alt="Use of force" title="Use of force" width="100%"> </figure> ] .pull-right[ <figure> <img src="img/05-class/klm.png" alt="Use of force" title="Use of force" width="100%"> </figure> ] --- layout: true class: middle --- .box-5.large[Smoking → Cardiac arrest example] ??? | Person | Smoker | Cardiac arrest | Cholesterol | Weight | Lifestyle healthiness | |--------|--------|----------------|-------------|--------|-----------------------| | 1 | TRUE | TRUE | 150 | 170 | 6 | | 2 | TRUE | FALSE | 170 | 180 | 3 | | 3 | FALSE | FALSE | 130 | 110 | 9 | | 4 | FALSE | TRUE | 140 | 140 | 8 | | 5 | TRUE | TRUE | 120 | 150 | 2 | | 6 | TRUE | FALSE | 130 | 230 | 3 | | 7 | FALSE | FALSE | 140 | 250 | 10 | ```text dag { bb="0,0,1,1" "Cardiac arrest" [outcome,pos="0.599,0.432"] Cholesterol [pos="0.415,0.440"] Lifestyle [pos="0.156,0.317"] Smoking [exposure,pos="0.243,0.428"] Weight [adjusted,pos="0.297,0.255"] Cholesterol -> "Cardiac arrest" Lifestyle -> Smoking Lifestyle -> Weight Smoking -> Cholesterol Weight -> Cholesterol } ``` --- .box-5.medium[How can you be sure<br>you include everything in a DAG?] .box-5.medium[Is there a rule of thumb<br>for the number of nodes?] --- .box-5.medium[Why do DAGs have to be acyclic?] .box-5.medium[What if there really is reverse causation?] --- .box-5.large[How do we actually<br>adjust for these things?] --- .box-5.large[What's the difference between<br>logic models and DAGs?] .box-inv-5[Can't I just remake my logic model in Dagitty and be done?] --- layout: false class: title title-5 # DAGs vs. Logic models .box-5.large[DAGs are a *statistical* tool] .box-inv-5[Describe a data-generating process<br>and isolate/identify relationships] -- .box-5.large.sp-before[Logic models are a *managerial* tool] .box-inv-5[Oversee the inner workings of a program and its theory] --- class: bg-full background-image: url("img/01/nyt-dag2.png") ??? https://twitter.com/andrewheiss/status/1208836534285340673 --- class: middle .pull-left[ <figure> <img src="img/04-class/greenspace-eater.png" alt="Green space in Berkeley" title="Green space in Berkeley" width="100%"> </figure> ] .pull-right[ <figure> <img src="img/04-class/greenspace-conversation.png" alt="Covid green spaces" title="Covid green spaces" width="100%"> </figure> ] ??? <https://theconversation.com/how-cities-can-add-accessible-green-space-in-a-post-coronavirus-world-139194> <https://sf.eater.com/2020/5/14/21258980/berkeley-coronavirus-covid-19-jesse-arreguin-street-closures>