sergiocorreia / reghdfe

Linear, IV and GMM Regressions With Any Number of Fixed Effects
http://scorreia.com/software/reghdfe/
MIT License
213 stars 56 forks source link

Cannot save groupvar() #115

Open agyetvai opened 6 years ago

agyetvai commented 6 years ago

Hi Sergio,

Using version 4.4.10, reghdfe y x, a(id) groupvar(newvar) doesn't save the first mobility group. I couldn't find any trace of the groupvar() option in the reghdfe.ado file either. Did you discard this option? It is still in the help file.

Thanks, Attila

sergiocorreia commented 6 years ago

Hi Attila,

You are right, version 4 was a complete rewrite and at some point I got tired of adding all the features of version 3.

There are two solutions:

  1. If you add the old version, you will run reghdfe v3, where groupvar works (but it's much slower, and lacks some features new in v4).
  2. The underlying code for the mobility groups is still there, and in fact is much better (it's just that I didn't add the boilerplate to save as a variable and so on):

https://github.com/sergiocorreia/reghdfe/blob/master/src/reghdfe_bipartite.mata#L113

That file does a lot more things than just mobility groups, as it allows you to iterate through each mobility group, to compute vertex core numbers and other graph-theory stuff (which is where the mobility group algorithm came from).

So if solution 1 doesn't work, let me know and I can add it at some point next week.

agyetvai commented 6 years ago

Thanks for the immediate response! Solution 2 would be great to have in the medium run, especially if it's not too much work.

If I understand the linked .mata code correctly, reghdfe_bipartite.mata finds mobility groups defined by 2 FEs only. Is that correct?