if(requireNamespace("emmeans") && requireNamespace("AER")) {
data(Fatalities, package = "AER")
Fatalities$frate = with(Fatalities, fatal/pop * 10000)
fat.mod = feols(frate ~ breath * jail * beertax | state + year, data = Fatalities)
emm = emmeans::emmeans(fat.mod, ~ breath*jail, cluster = ~ state + year)
emm ### SEs and CIs are incorrect
emmeans::contrast(emm, "consec", by = "breath") ### results are reliable
}
Run the code above in your browser using DataLab