GithubHelp home page GithubHelp logo

Comments (2)

sergiocorreia avatar sergiocorreia commented on June 2, 2024

Hi Nils,

This is caused by what I believe is a subtle bug within Stata. I'll give an example with the -hdfe- command (available from this repo, as described in the readme.md)

* Create your dataset
input x y i j
0 1 1 1
1 1 1 2
1 2 2 2
1 3 3 3
1 3 3 2
end

* Apply within transformation
hdfe y x, a(i j) clear

* Regress; notice that both X and cons are dropped
reg y x

* However, Stata still counts X as not dropped when computing df_m!!!
di e(df_m)

* The reason is due to numerical accuracy:
* The part of regress that decides whether to drop or not uses more less accuracy
* Than the part of regress that computes e(df_m)
su x
* If you run the hdfe command with the tol(1e-10) option, you will see that now e(df_m)==0

* Also, in the case below e(df_m) IS zero (just to make sure that they do exclude dropped variables when computing df_m)
gen z = 0
reg y z
di e(df_m)

I'm not entirely sure about how to proceed. One option would be to override the e(df_m) from regress, thus fixing their bug manually.

from reghdfe.

sergiocorreia avatar sergiocorreia commented on June 2, 2024

By the way, I added the above solution to the latest build. Not the most "kosher" solution, but is probably the best for now.

from reghdfe.

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.