Coder Social home page Coder Social logo

Comments (6)

fhollenbach avatar fhollenbach commented on July 4, 2024 1

Thanks so much!
I was also working on a fix and did the same things as you, except I hadn't figured out how to change the line for the varying slopes yet.

I ran it on my simulated data and it looks pretty good, however, the SEs are slightly different depending on the type of estimation. The covariates x1 and x2 are time-invariant.
Here are the results after aggregation:
fe = 'vs'

     Term    Contrast .Dtreat Effect Std. Error z value   Pr(>|z|)  2.5 % 97.5 %
1 .Dtreat mean(dY/dX)       1  1.019    0.09118   11.17 < 2.22e-16 0.8398  1.197

fe = 'feo'

     Term    Contrast .Dtreat Effect Std. Error z value   Pr(>|z|)  2.5 % 97.5 %
1 .Dtreat mean(dY/dX)       1  1.019    0.08726   11.67 < 2.22e-16 0.8475   1.19

fe = 'none'

Term    Contrast .Dtreat Effect Std. Error z value   Pr(>|z|)  2.5 % 97.5 %
1 .Dtreat mean(dY/dX)       1  1.019    0.08739   11.65 < 2.22e-16 -6.421 -4.296

Stata:

jwdid  y x1 x2, ivar(id) tvar(time) gvar(first_treated)
estat simple
          |   Contrast   std. err.     [95% conf. interval]
      _at |
(2 vs 1)  |   1.018502   .0872584      .8474786    1.189525.

For comparison, here is the aggregated ATE from the did package:

type estimate std.error  conf.low conf.high point.conf.low point.conf.high
1 simple 0.990916 0.1895209 0.6194619   1.36237      0.6194619         1.36237

I would like to test this some more but I have a deadline coming up. Hopefully, I can do more over the weekend/next week.
Thanks again for all your work on this.

from etwfe.

grantmcdermott avatar grantmcdermott commented on July 4, 2024

Super, thanks. That makes sense. I won't have time to look at this immediately, so please feel free to put in a PR if you can. An additional test for multiple control vars (see inst/tinytest) would also be much appreciated.

from etwfe.

grantmcdermott avatar grantmcdermott commented on July 4, 2024

I had a quick crack at fixing this here: https://github.com/grantmcdermott/etwfe/tree/multi_rhs

Do you mind installing this multi_rhs branch and trying with your dataset? Even better is if you are able to compare to jwdid. I don't have access to Stata on this computer, but I'd like to verify that etwfe and jwdid are producing the same result.

from etwfe.

grantmcdermott avatar grantmcdermott commented on July 4, 2024

My guess is that this is a degrees of freedom issue, as raised by Jeff here: https://twitter.com/jmwooldridge/status/1582355404129914880?s=61&t=1RGrPLJUB1l_gxm1sgCfgQ

I’m not sure how to mimic the uncon option for marginaleffects TBH. It’s something I’ll probably have to follow up with Vincent.

But otherwise, good to know that the main mfx are the same. Can you confirm that they coefficients are also equivalent in the main models? If so, then I’ll merge the multi_rhs branch and look deeper into the SEs later (since it’s a separate issue).

from etwfe.

fhollenbach avatar fhollenbach commented on July 4, 2024

Hi,

Sorry for the delay. Comparing the coefficients from etwfe feo model and the stata model, all the coefficients are the same when rounding to the 4th digit. This is with time-constant controls.

Though when I simulate time-varying covariates, the results vary across the three estimation methods and compared to the Stata. The Stata helpfile says only time-constant controls are allowed, but shouldn't this also work for time-varying controls (according to Wooldridge)?

from etwfe.

grantmcdermott avatar grantmcdermott commented on July 4, 2024

Great. I'll merge the PR then.

RE: time-varying covariates. IIRC the Wooldridge result specifically and only addresses time-constant covariates. TBH it's been a while since I read the actual paper at this point. I'll double check and add a note cautioning about time-varying coefs. (UPDATE: See p. 17 of the working paper.)

from etwfe.

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.