Comments (9)
Hi Tatyana,
First of all, which version of reghdfe are you using?
What I suspect is going on is this:
- Recall that ivreghdfe is just ivreg2 where the variables are first demeaned through reghdfe.
- If a variable X1 is fully collinear with the fixed effects, the residual is not necessarily ZERO (0.0000) but could be something trivially small (within an epsilon of zero).
- That could mess up the ivreg2 code that detects collinearity. So ivreg2 doesn't drop the variable and then when it tries to compute the FStat it fails (I had to tweak the reghdfe code a lot to prevent that same problem with reghdfe).
All in all, I'm not sure if there is an easy answer, as ivreg2 is a complex piece of code and I would prefer not hacking it too much beyond what I have done.
from ivreghdfe.
Hi Sergio,
This test was done using version 5.7.3 13nov2019, but I've seen this pattern in ivreghdfe for a while now. Your explanation makes a lot of sense, I'm guessing that's what's going on (though I will check in the simulation to be completely sure).
One relatively straightforward solution might be to add a "residual tolerance" option to ivreghdfe where residual values within the tolerance value of zero are set to be exactly zero.
from ivreghdfe.
Hi all,
I think this is related to an issue we uncovered using FixedEffectModels
.
I have added some code to illustrate our patch and see how Julia did not use to work (before version 1.4.2) and now does do the right thing. This has to do with how the ranktest statistics is computed for a specific case (see this pr)
- The code to check everything (could be useful as a test to implement it in stata) is here.
- Notebook that explains how it is actually an error on the stata side (and formerly on the Julia side) here
I think this is actually an issue that affects both ivreghdfe and ivreg2 so I am wondering if it's not worth opening a separate issue (and contact the author of ivreg2).
ht @matthieugomez & Valentin Haddad
from ivreghdfe.
I think this is actually an issue that affects both ivreghdfe and ivreg2 so I am wondering if it's not worth opening a separate issue (and contact the author of ivreg2).
What would be really useful is a minimal working example (something simpler i.e. without the interactions). Then we can try to come up with an example in ivreg2 (unless you have one? but this made me think it's not the case), and then we can contact the authors (Kit Baum, Mark Schaffer, Steven Stillman).
from ivreghdfe.
Also, I'm really low on time these days (too many revisions and late RRs) so I might be a bit slow to reply; apologies in advance
from ivreghdfe.
Thank you Sergio.
We are not pressed for time as we mostly use julia. We thought it would be worth bringing the issue to the attention of stata users ;)
The julia notebook example fails for both ivreg2 and ivreghdfe. I think the example is pretty compact (20 rows) and fairly common. I assume ivreghdfe relies on ivreg2 for the ranktest, so maybe it's worth reaching out to the authors.
from ivreghdfe.
Thanks, that's really useful! I'll put this in my to-do list and also try to contact the ivreg2 authors.
BTW, do you have a specific goal (teaching a course?) or are just trying to ensure compatibility across different tools?
from ivreghdfe.
Sergio,
As I said Matthieu tests his package against stata. So when we found strange results in the F-stats we looked at stata to see where the errors came from.
I personally don't use stata much.
I have added an R section at the bottom of the Julia notebook that shows similar issues (both @lrberge fixest and lfe).
If you email the ivreg2 authors, please cc us. It will probably make it easier to explain what is the specific case that has to be handled (it is not a simple a case of just detecting collinearity).
from ivreghdfe.
Hi and thanks for tagging me on this issue. But actually the ranktest was not implemented in fixest at that time! :-)
Eventually I did implement it. But I gave up trying to translate the paper to an algorithm (I'm really impressed you achieved that!), and I ended up translating the ranktest.jl algo into fixest.
By the way the ranktests differ (importantly) between Stata and Julia (and hence fixest) when # inst. var. > # endo. var (when equality occurs, results are identical). I'm sorry to just mention it and leave it there but I tried without success to solve the problem (there are just too many implicit things in the paper for me to understand what's going on).
from ivreghdfe.
Related Issues (20)
- issues with clustering - insufficient observations HOT 6
- Standard errors different for ivreghdfe and ivreg2 (even more so when using "small" option for ivreg2) HOT 3
- Incorrect coefficient with weights HOT 5
- Fixed effects by combination of variables and absorbed degrees of freedom HOT 1
- issues with clustering - transmorphic found where struct expected HOT 1
- Use ivreghdfe followed by predictnl
- ivreghdfe throws off ivreg2 instrument collinearity detection?
- vce(cluster var) accepted, but ignored.
- Cannot access r(table) HOT 3
- small correction for e(cmdline)
- "Warning: *variance matrix is nonsymmetric or highly singular" with reghdfe HOT 1
- Coefficients differ when using absorb with analytic weights HOT 3
- struct ms_vcvorthog undefined HOT 5
- Issue with ivreghdfe Command in Stata: "option requirements not allowed" HOT 11
- [BUG] Incorrect fixed effects with `cluster()` HOT 3
- -
- Question with the ivreghdfe command HOT 2
- last estimates not found r(301) when adding absorb() HOT 4
- 3499 fixed_effects() not found HOT 1
- r(198) option requirements not allowed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ivreghdfe.