GithubHelp home page GithubHelp logo

Comments (9)

grantmcdermott avatar grantmcdermott commented on July 28, 2024

I think you're correct. It doesn't make sense to have time_to_treatment==0 represent two different states. (Schrödringer's zero?) Now, from a practical perspective, I don't think it matters since the treat and ib#shited_ttt variables will cancel things it. But I agree it's logically confusing.

Taking a higher-level look at this event study page, there are several other things we could change. We shouldn't be using a proprietary data format (dta) for one thing, and the R code as currently written won't work with the impending fixest 0.9.0 release. (It could also be considerably shortened.) I'll make some changes and then let someone else pitch in about the Stata code.

from lost-stats.github.io.

grantmcdermott avatar grantmcdermott commented on July 28, 2024

I've pushed a couple of updates. But really I think this page needs a closer look. I just ran the Stata implementation of Sun Abraham and got different results to the R version... I don't have time to troubleshoot now and it might just be a copy-paste error on my side. But I'm hoping @pdeffebach or @NickCH-K can double check.

Similarly, I tried the Callaway-Sant'Anna estimator and got different results once again. I spoke v. briefly to Pedro and he thinks it's likely due to covariates, which SA don't handle in their paper. Again, though, it could be user error on my part. Here's the code I was trying locally:

library(did)

## Change never treated to zero
dat[, year_treated := ifelse(treat==0, 0, `_nfd`)]

mod_cs = att_gt(yname = "asmrs",
gname = "year_treated",
idname = "stfips",
tname = "year",
xformla = ~ pcinc + asmrh + cases,
data = dat)

summary(mod_cs)

cs = aggte(mod_cs, type = "dynamic", na.rm = TRUE)
cs

ggdid(cs)

from lost-stats.github.io.

NickCH-K avatar NickCH-K commented on July 28, 2024

I'll look at this when I get a chance

from lost-stats.github.io.

NickCH-K avatar NickCH-K commented on July 28, 2024

Shifting the untreated treated-time to a big positive number seems fine to me; I do like the logic that the zeroes there let things drop out.

On the R side the sunab() function looks neat! It's a bit of a concern it doesn't match Stata, as the Stata package is by Sun herself.

from lost-stats.github.io.

aalamer1 avatar aalamer1 commented on July 28, 2024

Yes. You have to assign to very positive number that is not included in the wanted interval. Keeping this as it is will apply the regression for states that treat=0 while we just want to include states with treat=1. I tried it and got different results.

from lost-stats.github.io.

NickCH-K avatar NickCH-K commented on July 28, 2024

@aalamer1 do you have a fixed version of the code?

from lost-stats.github.io.

aalamer1 avatar aalamer1 commented on July 28, 2024

@NickCH-K I am working on my own dataset but modified replace time_to_treat = 0 if missing(_nfd)
to be replace time_to_treat = 10000 if missing(_nfd).

Did you try in R code they posted? I tried to replicate it but generate errors of collinearity it is not working. I do not know how did they generate the graph and confirmed the results?

from lost-stats.github.io.

Swarup8289 avatar Swarup8289 commented on July 28, 2024

Hi all: In the code:
reghdfe asmrs ib`true_neg1'.shifted_ttt pcinc asmrh cases, a(stfips year) vce(cluster stfips)

Shouldnt there be the interaction term of " treat## ibtrue_neg1'.shifted_ttt" instead of just "ibtrue_neg1'.shifted_ttt" ?

Thanks in advance!

from lost-stats.github.io.

NickCH-K avatar NickCH-K commented on July 28, 2024

Yes, I believe you're right

from lost-stats.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.