diff --git a/slides/pdf/00-intro.pdf b/slides/pdf/00-intro.pdf index 9d9d2ad..1d9d66d 100644 Binary files a/slides/pdf/00-intro.pdf and b/slides/pdf/00-intro.pdf differ diff --git a/slides/pdf/01-causal_modeling_whole_game.pdf b/slides/pdf/01-causal_modeling_whole_game.pdf index 864cb33..224b53d 100644 Binary files a/slides/pdf/01-causal_modeling_whole_game.pdf and b/slides/pdf/01-causal_modeling_whole_game.pdf differ diff --git a/slides/pdf/02-when-standard-methods-succeed.pdf b/slides/pdf/02-when-standard-methods-succeed.pdf index c7180ea..9571666 100644 Binary files a/slides/pdf/02-when-standard-methods-succeed.pdf and b/slides/pdf/02-when-standard-methods-succeed.pdf differ diff --git a/slides/pdf/03-causal-inference-with-group-by-and-summarise.pdf b/slides/pdf/03-causal-inference-with-group-by-and-summarise.pdf index 3008047..6f42beb 100644 Binary files a/slides/pdf/03-causal-inference-with-group-by-and-summarise.pdf and b/slides/pdf/03-causal-inference-with-group-by-and-summarise.pdf differ diff --git a/slides/pdf/04-dags.pdf b/slides/pdf/04-dags.pdf index e3772e6..f0959a7 100644 Binary files a/slides/pdf/04-dags.pdf and b/slides/pdf/04-dags.pdf differ diff --git a/slides/pdf/05-quartets.pdf b/slides/pdf/05-quartets.pdf index d778c48..a736a37 100644 Binary files a/slides/pdf/05-quartets.pdf and b/slides/pdf/05-quartets.pdf differ diff --git a/slides/pdf/06-pscores.pdf b/slides/pdf/06-pscores.pdf index 585d580..b54defa 100644 Binary files a/slides/pdf/06-pscores.pdf and b/slides/pdf/06-pscores.pdf differ diff --git a/slides/pdf/07-using-pscores.pdf b/slides/pdf/07-using-pscores.pdf index a5fa10e..130bfdd 100644 Binary files a/slides/pdf/07-using-pscores.pdf and b/slides/pdf/07-using-pscores.pdf differ diff --git a/slides/pdf/08-pscore-diagnostics.pdf b/slides/pdf/08-pscore-diagnostics.pdf index cbed493..85d1749 100644 Binary files a/slides/pdf/08-pscore-diagnostics.pdf and b/slides/pdf/08-pscore-diagnostics.pdf differ diff --git a/slides/pdf/09-outcome-model.pdf b/slides/pdf/09-outcome-model.pdf index 0abb958..b466d22 100644 Binary files a/slides/pdf/09-outcome-model.pdf and b/slides/pdf/09-outcome-model.pdf differ diff --git a/slides/pdf/10-continuous-g-comp.pdf b/slides/pdf/10-continuous-g-comp.pdf index 5981abb..3c62988 100644 Binary files a/slides/pdf/10-continuous-g-comp.pdf and b/slides/pdf/10-continuous-g-comp.pdf differ diff --git a/slides/pdf/11-tipr.pdf b/slides/pdf/11-tipr.pdf index d195b4c..0aad84e 100644 Binary files a/slides/pdf/11-tipr.pdf and b/slides/pdf/11-tipr.pdf differ diff --git a/slides/pdf/12-whole_game-2.pdf b/slides/pdf/12-whole_game-2.pdf index 41530c1..46f08b5 100644 Binary files a/slides/pdf/12-whole_game-2.pdf and b/slides/pdf/12-whole_game-2.pdf differ diff --git a/slides/pdf/13-bonus-selection-bias.pdf b/slides/pdf/13-bonus-selection-bias.pdf index 81ad51c..b90d9ca 100644 Binary files a/slides/pdf/13-bonus-selection-bias.pdf and b/slides/pdf/13-bonus-selection-bias.pdf differ diff --git a/slides/pdf/14-bonus-continuous-pscores.pdf b/slides/pdf/14-bonus-continuous-pscores.pdf index 2066497..0ac7271 100644 Binary files a/slides/pdf/14-bonus-continuous-pscores.pdf and b/slides/pdf/14-bonus-continuous-pscores.pdf differ diff --git a/slides/raw/01-causal_modeling_whole_game.html b/slides/raw/01-causal_modeling_whole_game.html index 1ea76d4..42e476d 100644 --- a/slides/raw/01-causal_modeling_whole_game.html +++ b/slides/raw/01-causal_modeling_whole_game.html @@ -688,9 +688,9 @@

Using {rsample} to bootstrap our causal effect

-
+
# fit ipw model to bootstrapped samples
-ipw_results <- bootstraps(nhefs_complete, 1000, apparent = TRUE) |>
+ipw_results <- bootstraps(nhefs_complete_uc, 1000, apparent = TRUE) |>
   mutate(results = map(splits, fit_ipw)) 
diff --git a/slides/raw/01-causal_modeling_whole_game.qmd b/slides/raw/01-causal_modeling_whole_game.qmd index 8671875..cff54ff 100644 --- a/slides/raw/01-causal_modeling_whole_game.qmd +++ b/slides/raw/01-causal_modeling_whole_game.qmd @@ -500,7 +500,6 @@ fit_ipw <- function(split, ...) { ```{r} #| label: boot_cache -#| cache: true #| code-line-numbers: "|2-3" # fit ipw model to bootstrapped samples ipw_results <- bootstraps(nhefs_complete_uc, 1000, apparent = TRUE) |> diff --git a/slides/raw/01-causal_modeling_whole_game_cache/html/__packages b/slides/raw/01-causal_modeling_whole_game_cache/html/__packages deleted file mode 100644 index 779f918..0000000 --- a/slides/raw/01-causal_modeling_whole_game_cache/html/__packages +++ /dev/null @@ -1,39 +0,0 @@ -tidyverse -ggplot2 -tibble -tidyr -readr -purrr -dplyr -stringr -forcats -broom -rsample -ggdag -causaldata -Matrix -survival -survey -tableone -haven -usethis -magrittr -smd -devtools -reprex -fs -opensky -shunyata -pak -robustbase -estimatr -touringplans -causalworkshop -tidysmd -gtsummary -PSW -MatchIt -ggecdf -gt -tipr -dagitty diff --git a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.RData b/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.RData deleted file mode 100644 index b705767..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.RData and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdb b/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdb deleted file mode 100644 index eef2c9c..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdb and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdx b/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdx deleted file mode 100644 index 71ef8a2..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/html/boot_cache_da8f8cd2769a844813e9ce3f5ec71a80.rdx and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/__packages b/slides/raw/01-causal_modeling_whole_game_cache/revealjs/__packages deleted file mode 100644 index 668f02b..0000000 --- a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/__packages +++ /dev/null @@ -1,18 +0,0 @@ -tidyverse -ggplot2 -tibble -tidyr -readr -purrr -dplyr -stringr -forcats -lubridate -smd -broom -rsample -ggdag -causaldata -propensity -halfmoon -estimatr diff --git a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.RData b/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.RData deleted file mode 100644 index 9451cb7..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.RData and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdb b/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdb deleted file mode 100644 index 73efb01..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdb and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdx b/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdx deleted file mode 100644 index b08c103..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_cache/revealjs/boot_cache_c1ae9350162d3ec56b38e7754b023d10.rdx and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-10-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-10-1.png deleted file mode 100644 index f9bcc38..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-10-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-11-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-11-1.png deleted file mode 100644 index 8fb75dc..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-11-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-12-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-12-1.png deleted file mode 100644 index 26b6090..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-12-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-13-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-13-1.png deleted file mode 100644 index 4ecf564..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-13-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-14-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-14-1.png deleted file mode 100644 index f79dfc7..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-14-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-15-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-15-1.png deleted file mode 100644 index f79dfc7..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-15-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-16-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-16-1.png deleted file mode 100644 index cd64f57..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-16-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-19-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-19-1.png deleted file mode 100644 index 1535d51..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-19-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-2-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-2-1.png deleted file mode 100644 index 3859dbc..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-2-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-20-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-20-1.png deleted file mode 100644 index 1535d51..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-20-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-21-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-21-1.png deleted file mode 100644 index 49fcda4..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-21-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-23-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-23-1.png deleted file mode 100644 index 4d74c19..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-23-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-24-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-24-1.png deleted file mode 100644 index 4d74c19..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-24-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-25-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-25-1.png deleted file mode 100644 index 4d74c19..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-25-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-27-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-27-1.png deleted file mode 100644 index 1535d51..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-27-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-3-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-3-1.png deleted file mode 100644 index 82caf78..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-3-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-4-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-4-1.png deleted file mode 100644 index 6a346f6..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-4-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-5-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-5-1.png deleted file mode 100644 index 11078d3..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-5-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-6-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index da7aa29..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-7-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-7-1.png deleted file mode 100644 index e137ca6..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-7-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-8-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-8-1.png deleted file mode 100644 index 21f4905..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-html/unnamed-chunk-8-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-11-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-11-1.png deleted file mode 100644 index 47c7d7c..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-11-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-15-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-15-1.png deleted file mode 100644 index cbbffd6..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-15-1.png and /dev/null differ diff --git a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-25-1.png b/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-25-1.png deleted file mode 100644 index b02079a..0000000 Binary files a/slides/raw/01-causal_modeling_whole_game_files/figure-revealjs/unnamed-chunk-25-1.png and /dev/null differ diff --git a/slides/raw/03-causal-inference-with-group-by-and-summarise.html b/slides/raw/03-causal-inference-with-group-by-and-summarise.html index 54c12ba..9f91354 100644 --- a/slides/raw/03-causal-inference-with-group-by-and-summarise.html +++ b/slides/raw/03-causal-inference-with-group-by-and-summarise.html @@ -545,7 +545,7 @@

Simulation

Your Turn 1 (03-ci-with-group-by-and-summarise-exercises.qmd)

Group the dataset by confounder and exposure

Calculate the mean of the outcome for the groups

-

03:00

+

03:00

Your Turn 1

@@ -680,7 +680,7 @@

Your Turn 2

1 -0.0731 -

02:00

+

02:00

Simulation

@@ -818,7 +818,7 @@

Your Turn 3

Use ntile() from dplyr to calculate a binned version of confounder called confounder_q. We’ll create a variable with 5 bins.

Group the dataset by the binned variable you just created and exposure

Calculate the mean of the outcome for the groups

-

03:00

+

03:00

Your Turn 3

diff --git a/slides/raw/04-dags.html b/slides/raw/04-dags.html index 9c48c39..8cc54a0 100644 --- a/slides/raw/04-dags.html +++ b/slides/raw/04-dags.html @@ -526,7 +526,7 @@

Your Turn 1 (04-dags-exercises.qmd)Specify a DAG with dagify(). Write your assumption that smoking causes cancer as a formula.

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).

Plot the DAG using ggdag()

-

05:00

+

05:00

Your Turn 1 (02-dags-exercises.qmd)

@@ -582,7 +582,7 @@

ggdag_paths()

Your Turn 2

Call tidy_dagitty() on coffee_cancer_dag to create a tidy DAG, then pass the results to dag_paths(). What’s different about these data?

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.

-

05:00

+

05:00

Your Turn 2

@@ -684,7 +684,7 @@

Your Turn 3

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).

Use ggdag_adjustment_set() to visualize the adjustment sets. Add the arguments use_labels = "label" and text = FALSE.

Write an R formula for each adjustment set, as you might if you were fitting a model in lm() or glm()

-

05:00

+

05:00

Your Turn 3

diff --git a/slides/raw/05-quartets.html b/slides/raw/05-quartets.html index 53f0c7c..8a53a08 100644 --- a/slides/raw/05-quartets.html +++ b/slides/raw/05-quartets.html @@ -393,7 +393,7 @@

Causal inference is not just a statistics problem

-

2023-04-12 (updated: 2023-08-24)

+

2023-04-12 (updated: 2023-08-31)

@@ -524,7 +524,7 @@

For each of the above 4 datasets, fit a linear model to examine the relationship between the exposure and the outcome

-
+
10:00
@@ -557,23 +557,23 @@

Correct effects

-
- @@ -1037,23 +1037,23 @@

Observed effects

-
- @@ -1572,23 +1572,23 @@

The partial solution

-
- @@ -2064,7 +2064,7 @@

On M-Bias

Your turn 2

For each of the following 4 datasets, fit a linear linear model examining the relationship between outcome_followup and exposure_baseline adjusting for covariate_baseline: causal_collider_time, causal_confounding_time, causal_mediator_time, causal_m_bias_time

-

10:00

+

10:00

diff --git a/slides/raw/06-pscores.html b/slides/raw/06-pscores.html index b7432a9..f33be49 100644 --- a/slides/raw/06-pscores.html +++ b/slides/raw/06-pscores.html @@ -499,8 +499,8 @@

Your turn

-

10:00

-

Using the confounders identified in the previous DAG, fit a propensity score model for extra_magic_morning

+

10:00

+

Using the confounders identified in the previous DAG, fit a propensity score model for park_extra_magic_morning

Stretch: Create two histograms, one of the propensity scores for days with extra morning magic hours and one for those without

Your turn 1

-

10:00

+

10:00

Create a Love Plot for the propensity score weighting you created in the previous exercise

@@ -524,9 +524,9 @@

Weighted ECDF

Your turn 2

-

10:00

-

Create an unweighted ECDF examining the weather_wdwhigh confounder by whether or not the day had Extra Magic Hours.

-

Create a weighted ECDF examining the weather_wdwhigh confounder

+

10:00

+

Create an unweighted ECDF examining the park_temperature_high confounder by whether or not the day had Extra Magic Hours.

+

Create a weighted ECDF examining the park_temperature_high confounder

@@ -558,23 +558,23 @@

-
- diff --git a/slides/raw/09-outcome-model.html b/slides/raw/09-outcome-model.html index d6cace7..2c94dfa 100644 --- a/slides/raw/09-outcome-model.html +++ b/slides/raw/09-outcome-model.html @@ -475,16 +475,16 @@

2. Use {rsample} to bootstrap our causal effect

# A tibble: 1,001 × 2 splits id <list> <chr> - 1 <split [1566/587]> Bootstrap0001 - 2 <split [1566/555]> Bootstrap0002 - 3 <split [1566/590]> Bootstrap0003 - 4 <split [1566/599]> Bootstrap0004 - 5 <split [1566/580]> Bootstrap0005 - 6 <split [1566/574]> Bootstrap0006 - 7 <split [1566/572]> Bootstrap0007 - 8 <split [1566/569]> Bootstrap0008 - 9 <split [1566/562]> Bootstrap0009 -10 <split [1566/581]> Bootstrap0010 + 1 <split [1566/584]> Bootstrap0001 + 2 <split [1566/580]> Bootstrap0002 + 3 <split [1566/560]> Bootstrap0003 + 4 <split [1566/595]> Bootstrap0004 + 5 <split [1566/577]> Bootstrap0005 + 6 <split [1566/544]> Bootstrap0006 + 7 <split [1566/590]> Bootstrap0007 + 8 <split [1566/572]> Bootstrap0008 + 9 <split [1566/575]> Bootstrap0009 +10 <split [1566/584]> Bootstrap0010 # ℹ 991 more rows
@@ -495,8 +495,8 @@

2. Use {rsample} to bootstrap our causal effect

# A tibble: 2 × 5
   term        estimate std.error statistic  p.value
   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
-1 (Intercept)     1.83     0.288      6.34 2.93e-10
-2 qsmk            3.44     0.407      8.44 7.05e-17
+1 (Intercept) 1.54 0.294 5.26 1.65e- 7 +2 qsmk 3.39 0.413 8.20 4.92e-16
@@ -542,8 +542,8 @@

3. Pull out the causal effect

Your Turn

-

12:00

-

Create a function called ipw_fit that fits the propensity score model and the weighted outcome model for the effect between extra_magic_morning and avg_spostmin

+

12:00

+

Create a function called ipw_fit that fits the propensity score model and the weighted outcome model for the effect between park_extra_magic_morning and wait_minutes_posted_avg

Using the bootstraps() and int_t() functions to estimate the final effect.

@@ -578,7 +578,7 @@

Stabilizing extreme weights

Your Turn 2

Re-fit the above using stabilized weights

-

03:00

+

03:00

Your Turn 2

@@ -586,7 +586,7 @@

Your Turn 2

wait_times_swts <- post_time_model |>
   augment(data = wait_times) |>
   mutate(swts = wt_ate(
-    avg_spostmin, 
+    wait_minutes_posted_avg, 
     .fitted,
     .sigma = .sigma,
     stabilize = TRUE
@@ -621,24 +621,24 @@ 

Fitting the outcome model

Your Turn 3

Estimate the relationship between posted wait times and actual wait times using the stabilized weights we just created.

-

03:00

+

03:00

Your Turn 3

lm(
-  avg_sactmin ~ avg_spostmin, 
+  wait_minutes_actual_avg ~ wait_minutes_posted_avg, 
   weights = swts, 
   data = wait_times_swts
 ) |>
   tidy() |>
-  filter(term == "avg_spostmin") |>
+  filter(term == "wait_minutes_posted_avg") |>
   mutate(estimate = estimate * 10)
# A tibble: 1 × 5
-  term         estimate std.error statistic   p.value
-  <chr>           <dbl>     <dbl>     <dbl>     <dbl>
-1 avg_spostmin    -3.47    0.0836     -4.15 0.0000805
+ term estimate std.error statistic p.value + <chr> <dbl> <dbl> <dbl> <dbl> +1 wait_minutes_posted_… 2.39 0.0659 3.63 4.93e-4