Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regression with over 50,000 Fixed Effects.

    Hi!
    I want to run a regression including over 50,000 dummies.
    These are too many variables, hence I get a matsize problem.
    I'm not really interested in each dummy's coefficient, but I want to get predicted values that take into account the dummies afterwards, so I can't use commands such as reghdfe...,(absorb i.fixedeffects).

    Any suggestions?
    Thanks in advance!
    Last edited by Santiago Cantillo; 24 Oct 2018, 17:15.

  • #2
    In order to predict fitted values plus the fixed component in reghdfe you need to save the fixed effects (also I do not find a problem using xtreg, fe with 50,000 fixed effects). For example:

    Code:
    clear
    set obs 50000
    gen id = _n
    expand 20
    bys id: gen t = _n
    forv i = 1/10 {
        gen x`i' = rnormal()
    }
    xtset id t
    xtreg x1 - x10, fe
    predict xbu, xbu
    
    reghdfe x1- x10 , absorb(FE_ID =i.id)
    predict xbd, xbd
    l xbu xbd  in 1/10

    Comment


    • #3
      Santiago:
      as an aside to Scott's helpful advice, if your dummies refers to -panelvar-, I would check whether your data are in -long-format. If this were not the case, -reshape- them so that you can get the most out of -xtreg,fe-.
      Kind regards,
      Carlo
      (Stata 18.0 SE)

      Comment


      • #4
        Hi!
        Thanks very much Scott & Carlo for your help.
        Clearly I overlooked reghdfe's help file. It works perfect!
        I also had a confusion with my panel since it isin't time varying; it varies by the panelvar and cities. Hence, I hadn't thought about using xtreg, while it is a very good option.
        Thanks again!

        Comment

        Working...
        X