## Check candidate moderations: oil*reg, britcol*reg, britcol*edt
suppressPackageStartupMessages({
  library(tidyverse); library(fixest); library(lmtest)
})
lag <- dplyr::lag

democracy <- read_csv("data/democracy.csv", show_col_types = FALSE) |>
  rename_with(tolower) |> mutate(ln_gdpw = log(gdpw))

# Pooled OLS interactions
cat("\n=== oil * reg ===\n")
print(coeftest(lm(ln_gdpw ~ reg * oil + edt, data = democracy)))

cat("\n=== britcol * reg ===\n")
print(coeftest(lm(ln_gdpw ~ reg * britcol + edt, data = democracy)))

cat("\n=== britcol * edt ===\n")
print(coeftest(lm(ln_gdpw ~ edt * britcol + reg, data = democracy)))

cat("\n=== oil * edt ===\n")
print(coeftest(lm(ln_gdpw ~ edt * oil + reg, data = democracy)))

# FE versions (within country, so the moderator-only effect is absorbed)
cat("\n=== FE: reg + reg:oil ===\n")
print(coeftest(feols(ln_gdpw ~ reg + reg:oil + edt | country, data = democracy)))

cat("\n=== FE: reg + reg:britcol ===\n")
print(coeftest(feols(ln_gdpw ~ reg + reg:britcol + edt | country, data = democracy)))

cat("\n=== FE: edt + edt:britcol ===\n")
print(coeftest(feols(ln_gdpw ~ reg + edt + edt:britcol | country, data = democracy)))
