etwfe
etwfe copied to clipboard
Proportional ATTs for Poisson Regressions
Dear @grantmcdermott , Dear @vincentarelbundock - a question regarding the marginal effects in etwfe.
I want to use etwfe
with a Poisson specification, reporting the overall ATT as a percentage change (i.e., "Employment decreased by x% due to the treatment"). Here is a super simple example with only one coefficient:
# Load the data
data("mpdta")
mpdta$emp <- exp(mpdta$lemp)
# Regression
(mod = etwfe(
fml = emp ~ 0,
tvar = year,
gvar = first.treat,
family = "quasipoisson",
data = mpdta %>% dplyr::filter(year %in% c(2004, 2005), first.treat %in% c(2004, 2005, 2006)),
vcov = ~countyreal
))
# Output
GLM estimation, family = quasipoisson, Dep. Var.: emp
Observations: 120
Fixed-effects: first.treat: 2, year: 2
Standard-errors: Clustered (countyreal)
Estimate Std. Error t value Pr(>|t|)
.Dtreat:first.treat::2004:year::2005 -0.050079 0.02777 -1.80335 0.07644 .
# Aggregation / Marginal Effect
mod2 <- emfx(mod)
Term Contrast .Dtreat Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 %
.Dtreat mean(TRUE) - mean(FALSE) TRUE -36.9 20 -1.85 0.0644 4.0 -76.1 2.21
I want to get the marginal effects as percentage changes. I was hoping I could simply relate the marginal ATT reported by emfx
to the mean of the control group pre-treatment. In this example, I think it should be:
dat <- data.table::as.data.table(eval(mod$call$data, mod$call_env))
mod2$estimate / ( dat%>% dplyr::filter(year == 2004, first.treat == 2006) %>% pull(emp) %>% mean() )
But then, could in general the following be correct?
dat <- data.table::as.data.table(eval(mod$call$data, mod$call_env))
mod2$estimate / (dat %>% dplyr::filter(year < first.treat) %>% pull(emp) %>% mean() )
Does that make any sense? Any feedback is highly appreciated.