Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proportional ATTs for Poisson Regressions #47

Open
frederickluser opened this issue Jun 11, 2024 · 0 comments
Open

Proportional ATTs for Poisson Regressions #47

frederickluser opened this issue Jun 11, 2024 · 0 comments

Comments

@frederickluser
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant