library(here) library(tidyverse) library(gt) source(here("04-topics/rep-chv2011/Rcode/chv2011-gt-quarto.R")) table_a1a <- tribble( ~parameter, ~definition, "ATE", "Integral of MTE against weight h_ATE(x, u_S)", "TT", "Integral of MTE against weight h_TT(x, u_S) = 1{S=1}", "TUT", "Integral of MTE against weight h_TUT(x, u_S) = 1{S=0}", "PRTE", "Policy-relevant TE for a discrete policy change", "IV", "Weighted average of MTE with instrument-specific weights", "OLS", "Weighted average of MTE with OLS selection weights" ) table_a1b <- tribble( ~parameter, ~weight, "ATE", "$f_{P|X}(u_S)$", "TT", "$1\\{P > u_S\\}$", "TUT", "$1\\{P \\leq u_S\\}$", "PRTE", "Policy-specific (see Table 1)", "IV", "$f_{P|X}(u_S) \\cdot (Z - E[Z|X]) / E[Z|X,P=u_S]$", "OLS", "$f_{P|X}(u_S) \\cdot (P - u_S)$" ) gt_tbl <- bind_rows( table_a1a |> mutate(panel = "Table A-1A: Treatment effects as weighted averages of MTE"), table_a1b |> mutate(panel = "Table A-1B: Weights for ATE, TT, TUT, PRTE, IV and OLS") ) |> select(panel, parameter, definition = definition, weight) |> gt(groupname_col = "panel") |> tab_header(title = "Table A-1", subtitle = "Weight definitions (Heckman and Vytlacil 2005)") table_data <- list(a1a = table_a1a, a1b = table_a1b) save(table_data, gt_tbl, file = here("04-topics/rep-chv2011/Rcode/Table_A1.RData"))