Comments (17)
It seems omitted variables are a recurring source of bugs so I might need to think if there is a better way altogether.
Question: what would be your prefered behavior, besides replacing (empty) with (omitted)?
EG: Should I drop all omitted from the tables by default and add a noomit option?
from reghdfe.
BTW in terms of the regression table (not esttab) it seems that the noomit
and noempty
options can do what I was thinking without any modifications.
However, I'm still not sure how why some vars get labeled as empty (and what exactly does empty mean in this context).
from reghdfe.
Question: what would be your prefered behavior, besides replacing
(empty)
with(omitted)
?
- Low priority: I don't know what
(empty)
means, but maybe replace(empty)
with(omitted)
. - Low priority: display
1.sex
instead of__1__sex
. - Medium priority: make it so that
esttab, noomit
doesn't show1.sex#2.agegroup
. AFAICT, there's no way of automatically hiding1.sex#2.agegroup
.
EG: Should I drop all omitted from the tables by default and add a noomit option?
I don't understand. If you hid omitted by default, what would noomit
do? Do you mean "add a showomit
option"?
I think the tables displayed by reghdfe
are fine as-is.
from reghdfe.
Ok, so I did some digging and found this:
Point 1
I'm a bit lost about how Stata chooses what is empty instead of omitted when writing the tables (I call _coef_table
which calls _coef_table_mata
which calls _b_table.mata
and so on).
If you see the output, 1o.sex
was indeed tagged with the o.
prefix and that didn't stop Stata from recognizing it as "(empty)" instead of "(omitted)". I went into the rabbit hole trying to find out what they meant by that and ended up in viewsource _b_table.mata
but it again never says what triggers (empty) instead of (omitted), there is not even an "empty" string in the entire source.
Point 2
Agreed, should be feasible
Point 3
Also agreed, should be a bit harder but doable.
Details:
- Estout uses a few variants of this code to find out what variables are "omitted":
substr(coef_name, 1, 2)=="o."
. Thus, they care about the "o." prefix - Reghdfe was not tagging
1.sex#2.agegrp
with ano.
prefix, so the solution must involve putting it somewhere in the string.
from reghdfe.
Regarding point 1: Huh. Weird. Maybe empty takes precedence over omitted, but for some reason 1o.sex
isn't considered empty in the case of areg
. I found this. Empty refers to "empty cells", apparently. But e(V)
doesn't look different between areg
and reghdfe
in this respect.
from reghdfe.
Yep, extremely weird. I did some testing (see code at the end) and also digging in the _rmcoll
documentation, and it doesn't make sense at all. I just give up. Feel free to contact tech support if you have the energy.
For now, I'll just fix points 2 and 3 at some point tonight.
Code:
clear all
cls
set more off
cap pr drop foobar
pr define foobar, eclass
matrix b = 0, 0, 0
matrix V = 0,0,0\0,0,0\0,0,0
local names `0'
matrix colnames b = `names'
matrix rownames V = `names'
matrix colnames V = `names'
ereturn post b V, // dep(depvar) obs(10) dof(5)
ereturn display
end
set trace off
foobar x y z
foobar 1o.x 1o.y 1o.z // o. prefix doesn't work well with Stata table
foobar 1b.x 1b.y 1b.z // neither b.
foobar 0bn.x 2bn.x 1bn.z // This works but fails with esttab
* o. prefix works with esttab
foobar 1o.x 2.y 1bno.z
esttab , noomit
from reghdfe.
noemptycells
specifies that empty cells for interactions of factor variables not be displayed.
The default is to include in the table interaction cells that do not occur in the estimation sample and to label them as "(empty)".
from reghdfe.
The problem is that in reghdfe's case the interaction did occur but was completely colinear with the FEs.
Stata seems to be using some heuristic to tag interactions as empty or omitted. For instance, if the betas are zero it treats them as omitted (1.y) unless you tag them as omitted (1o.y) in which case it labels them as empty.
Since there is no e. prefix for empty, they must have required a trick like that, but AFAIK its not documented (and may affect how estout works)
from reghdfe.
By the way note that in the test code I put above there was not even a dataset, so there was no way to find out if the level was omitted or empty. Same if you are replaying a previous estimate. There must be a way to separate them internally but it appears to be undocumented.
from reghdfe.
Update: after talking with tech support and thinking about it, the only complete soln seems to be this:
- Tag everything as
o.
soestout
works well - When displaying the regression table, cheat and remove all the
o.
cases, the display the table and revert.
from reghdfe.
What does the regression table look like if you don't remove the o.
cases? Is it that they say "(empty)" instead of "(omitted)"?
from reghdfe.
Exactly. The problem is if people see (empty) and (omitted) in the same table, they start wondering if something is up.
from reghdfe.
I just encountered the commands
set showbaselevels
set showemptycells
set showomitted
They reminded me of this issue. I don't know if they're useful to you in any way, or if you already knew they existed, but I thought I should mention them just in case.
from reghdfe.
Hi Nils,
I tried using those, but sadly they require the original dataset to be loaded, so I couldn't use them for what I wanted.
Thanks anyways!
S
from reghdfe.
BTW, do you always set -showempty- and the others to off? I was thinking about either having an option to set the three to off (e.g. reghdfe ... , compact) or setting them off by default, as it gets annoying to see all the empty cells on top of the collinearity warnings.
from reghdfe.
No. Those settings are all “empty” for me, i.e. not set to anything, if I understand correctly.
from reghdfe.
Ok, thanks!
from reghdfe.
Related Issues (20)
- [BUG] Warning: variance matrix is nonsymmetric or highly singular. HOT 1
- Questions about the redundant FE reported and yhat predicted after running reghdfe
- [BUG] The factor varlist feature is not working in some instance of reghdfe
- Could we implement -margins- after running -reghdfe-?
- How to romove the "_cons" fixed effect in "estfe"[BUG] HOT 2
- hdfe HOT 2
- Different standard errors in reghdfe 3.2.7 versus reghdfe 5.7.3
- [BUG] Version 6.12.3 of reghdfe appears to break ppmlhdfe HOT 2
- [BUG] error occurred while loading reghdfe.ado HOT 2
- Incorrect "parentheses unbalanced" error HOT 5
- [BUG] Missing `strok` option with `nopartialout` and `varlist_is_touse` HOT 1
- [BUG] HOT 2
- Predict residual outside e(sample)
- Fail to replicate the Example: OLS regression in reghdfe_programming help file
- [BUG] Summarize Breaks and Other Mata Load Error
- [BUG] Ensure vcov matrix is symmetric to avoid numerical precision issues HOT 1
- [BUG] Neither `noregress` nor `keepmata` store `HDFE.solution`
- [BUG] Version 6.12.0 breaks ivreghdfe with "last estimates not found" HOT 6
- [BUG] Failure to generate parallel processes on remote server HOT 3
- [BUG] _assert_abort(): 3498 error partialling out; missing values found HOT 1
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 reghdfe.