library(here)
library(tidyverse)
library(gt)
source(here("04-topics/rep-chv2011/Rcode/chv2011-gt-quarto.R"))

table_data <- tribble(
  ~policy, ~weight_formula,
  "Z + alpha (shift one instrument)", "$h(x, u_S) = f_{V|X}(u_S) / f_{P|X}(u_S)$",
  "P + alpha (uniform shift in P)", "$h(x, u_S) = f_{P|X}(u_S)$",
  "(1 + alpha) P (proportional shift)", "$h(x, u_S) = u_S f_{P|X}(u_S)$"
)

gt_tbl <- table_data |>
  gt() |>
  tab_header(
    title = "Table 1",
    subtitle = "Weights for MPRTE (Carneiro, Heckman and Vytlacil 2010)"
  ) |>
  cols_label(
    policy = "Policy perturbation",
    weight_formula = "Weight h(x, u_S)"
  )

save(table_data, gt_tbl, file = here("04-topics/rep-chv2011/Rcode/Table_1.RData"))
