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
<h3id="specify-a-dag-with-dagify.-write-your-assumption-that-smoking-causes-cancer-as-a-formula.">Specify a DAG with <code>dagify()</code>. Write your assumption that <code>smoking</code> causes <code>cancer</code> as a formula.</h3>
527
527
<h3id="were-going-to-assume-that-coffee-does-not-cause-cancer-so-theres-no-formula-for-that.-but-we-still-need-to-declare-our-causal-question.-specify-coffee-as-the-exposure-and-cancer-as-the-outcome-both-in-quotations-marks.">We’re going to assume that coffee does not cause cancer, so there’s no formula for that. But we still need to declare our causal question. Specify “coffee” as the exposure and “cancer” as the outcome (both in quotations marks).</h3>
528
528
<h3id="plot-the-dag-using-ggdag">Plot the DAG using <code>ggdag()</code></h3>
<h3id="call-tidy_dagitty-on-coffee_cancer_dag-to-create-a-tidy-dag-then-pass-the-results-to-dag_paths.-whats-different-about-these-data">Call <code>tidy_dagitty()</code> on <code>coffee_cancer_dag</code> to create a tidy DAG, then pass the results to <code>dag_paths()</code>. What’s different about these data?</h3>
584
584
<h3id="plot-the-open-paths-with-ggdag_paths.-just-give-it-coffee_cancer_dag-rather-than-using-dag_paths-the-quick-plot-function-will-do-that-for-you.-remember-since-we-assume-there-is-no-causal-path-from-coffee-to-lung-cancer-any-open-paths-must-be-confounding-pathways.">Plot the open paths with <code>ggdag_paths()</code>. (Just give it <code>coffee_cancer_dag</code> rather than using <code>dag_paths()</code>; the quick plot function will do that for you.) Remember, since we assume there is <em>no</em> causal path from coffee to lung cancer, any open paths must be confounding pathways.</h3>
<h3id="now-that-we-know-the-open-confounding-pathways-sometimes-called-backdoor-paths-we-need-to-know-how-to-close-them-first-well-ask-ggdag-for-adjustment-sets-then-we-would-need-to-do-something-in-our-analysis-to-account-for-at-least-one-adjustment-set-e.g.-multivariable-regression-weighting-or-matching-for-the-adjustment-sets.">Now that we know the open, confounding pathways (sometimes called “backdoor paths”), we need to know how to close them! First, we’ll ask {ggdag} for adjustment sets, then we would need to do something in our analysis to account for at least one adjustment set (e.g. multivariable regression, weighting, or matching for the adjustment sets).</h3>
685
685
<h3id="use-ggdag_adjustment_set-to-visualize-the-adjustment-sets.-add-the-arguments-use_labels-label-and-text-false.">Use <code>ggdag_adjustment_set()</code> to visualize the adjustment sets. Add the arguments <code>use_labels = "label"</code> and <code>text = FALSE</code>.</h3>
686
686
<h3id="write-an-r-formula-for-each-adjustment-set-as-you-might-if-you-were-fitting-a-model-in-lm-or-glm">Write an R formula for each adjustment set, as you might if you were fitting a model in <code>lm()</code> or <code>glm()</code></h3>
0 commit comments