Giter Site home page Giter Site logo

Comments (9)

sergiocorreia avatar sergiocorreia commented on September 15, 2024

In a way the absorb() variables take the place of the constant. On previous versions of -reghdfe- I was forcing the first absvar to be just categorical variables (no c.x) but that was because of design limitations.

One option may be to remove the -nocons- in those cases, but not sure if it's worth the coding effort (I need to modify the ivregress/ivreg2/regress/mwc wrappers).

Another would be to automatically add a constant as the first absvar.

All in all, I'm not sure. Specially because pure i.id#c.year interactions converge extremely slow in my experience. For instance, if you replace # by ## you will see that it converges in e.g. 6 iterations instead of 80.

from reghdfe.

matthieugomez avatar matthieugomez commented on September 15, 2024

It's definitely not worth the coding effort. It's really a unusual case - but I was misled by the result, so it seems like something should change. Catching this case to return an error, asking the user to create a cons variable sounds good. It's fairly easy to understand what happens since you don't report the cons anymore.
Just for info, you don't think reghdfe is better than reg in this case?

from reghdfe.

sergiocorreia avatar sergiocorreia commented on September 15, 2024

Makes sense, I'll just give a warning if no "fixed-intercepts" are found in absvar.

About regress vs reghdfe... the simple benchmarks I run were for fixed intercepts not fixed slopes, so I'm not sure (if you have better names to distinguish i.var from i.var##c.var let me know).

If there are only a few individuals sure regress is faster, but with 1000 or so individuals then it's likely the opposite. If you have ##c. interactions instead of #c. interactions, then reghdfe is definitely faster. If you have cluster errors then even more (which makes me wonder.. as I didn't do any optimization regarding clustered errors, so regress/areg probably had some gross inefficiencies there)

from reghdfe.

matthieugomez avatar matthieugomez commented on September 15, 2024

Related issue in hdfe: when I use a(var1#c.var2), I get an error telling me to add constant (exactly the kind of error reghdfe could throw). If I do it, I get the error "idvar not found". Workaround is to add cluster(var1) so not a problem for me.

from reghdfe.

sergiocorreia avatar sergiocorreia commented on September 15, 2024

Since hdfe is still at version 2, that behavior is expected.

What I couldn't replicate is the "idvar not found" error:

. hdfe, version
2.1.10 07apr2015

. sysuse auto
(1978 Automobile Data)

. hdfe price weight , a(turn#c.gear) gen(A_) // This fails
error parsing absorb : first absvar cannot be continuous interaction
solution: i) reorder absvars, ii) replace # with ##, iii) add a constant as first absvar (as a workaround)

. gen const = 1

. hdfe price weight , a(const turn#c.gear) gen(A_) // This works

from reghdfe.

matthieugomez avatar matthieugomez commented on September 15, 2024

I can't replicate it either, not sure what happened. Sorry.

from reghdfe.

matthieugomez avatar matthieugomez commented on September 15, 2024

Allrigh I got it!

reghdfe, version
*2.1.47 12may2015
 sysuse auto, clear
gen cons = 1
reghdfe price weight , a(cons turn#c.gear turn#c.trunk)

It's actually a bug unrelated to my initial report. the following also fails:

 sysuse auto, clear
reghdfe price weight , a(turn turn#c.gear)

Also note that in the reghdfe price weight , a(turn turn#c.(gear trunk)) returns an error ") required"

from reghdfe.

sergiocorreia avatar sergiocorreia commented on September 15, 2024

Matthieu,

Since this is an unexpected behavior, would it be enough if I gave a warning in case absorb() only contains fixed slopes? Maybe also allow _cons as a magic variable in absorb(), but that may just complicate things too much.

from reghdfe.

matthieugomez avatar matthieugomez commented on September 15, 2024

Of course, this is great

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.