We load the required packages and the data:
library("groundhog")
packages <- c(
"here",
"tidyverse",
"knitr",
"patchwork",
"mediocrethemes"
# "vincentbagilet/mediocrethemes"
)
# groundhog.library(packages, "2022-11-28")
lapply(packages, library, character.only = TRUE)
set_mediocre_all(pal = "leo")
# load small sample simulation results
summary_evol_large <- readRDS(here("data", "simulations", "summary_evol_large.RDS")) %>%
mutate(sample_size = "large")
# load large sample simulation results
summary_evol_small <- readRDS(here("data", "simulations", "summary_evol_small.RDS")) %>%
mutate(sample_size = "small")
# prepare data for graphs
summary_evol_all <- summary_evol_large %>%
bind_rows(summary_evol_small) %>%
mutate(
id_method = case_when(
id_method == "IV" ~ "Instrumental Variable",
id_method == "OLS" ~ "Standard Regression",
id_method == "reduced_form" ~ "Reduced-Form",
id_method == "RDD" ~ "Discontinuity Design"
),
n_obs = n_days * n_cities
) %>%
pivot_longer(
cols = c("power", "type_m", "mean_f_stat"),
names_to = "metrics",
values_to = "stat_value"
) %>%
mutate(
metrics_name = case_when(
metrics == "power" ~ "Statistical Power (%)",
metrics == "type_m" ~ "Exaggeration Ratio",
metrics == "mean_f_stat" ~ "F-Statistic",
),
id_method_name = fct_relevel(
id_method,
"Standard Regression",
"Reduced-Form",
"Instrumental Variable"
)
)
Metric | Non-Accidental Causes | Respiratory Causes | COPD Elderly |
---|---|---|---|
Statistical Power (%) | 89.7 | 15.8 | 7.5 |
Exaggeration Ratio | 1.0 | 2.4 | 5.9 |
F-Statistic | 7980.3 | 8002.9 | 8045.9 |