Announcement

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

  • logit HDFE and panel structure

    Hello everyone.
    I have a question that I hope you can help me with.
    I have a logistic regression with 2 FE. The problem is, the fixed effects are for year and county (US), but the dataset is at the individual-level. So, I got an error (because I have several individuals per year and county):

    Code:
    xtset YEAR COUNTY
    . repeated time values within panel
    I did this trying to run a -xtlogit- model...

    And also, one of FE (county) it's high-dimensional, so when I try the standard -logit- regression takes 2 hours to run.

    I have something like this (for the standard logit):

    Code:
    logit depvar var1-var10 i.var11 i.var12 i.YEAR i.COUNTY [pw=w], cluster(COUNTY)
    In conclusion, I don't know how to face this problem, of how to run a logit regression with FE and one HDFE.
    I really appreciate any help on this.

  • #2
    Xtset your data on the high dimensional fixed effect as follows:

    Code:
    xtset COUNTY
    and then control for the low dimensional fixed effects with factor variable notation i.YEAR

    E.g., without the i.YEAR

    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    . xtset rep
           panel variable:  rep78 (unbalanced)
    
    . xtlogit fore price mpg head, nolog
    
    Random-effects logistic regression              Number of obs     =         69
    Group variable: rep78                           Number of groups  =          5
    
    Random effects u_i ~ Gaussian                   Obs per group:
                                                                  min =          2
                                                                  avg =       13.8
                                                                  max =         30
    
    Integration method: mvaghermite                 Integration pts.  =         12
    
                                                    Wald chi2(3)      =       7.64
    Log likelihood  = -29.467606                    Prob > chi2       =     0.0540
    
    ------------------------------------------------------------------------------
         foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           price |   .0001784   .0001377     1.30   0.195    -.0000915    .0004484
             mpg |   .1506742   .0804532     1.87   0.061    -.0070111    .3083595
        headroom |  -.7949371   .5415162    -1.47   0.142    -1.856289     .266415
           _cons |  -3.405605   2.967324    -1.15   0.251    -9.221452    2.410243
    -------------+----------------------------------------------------------------
        /lnsig2u |    .783666   1.228934                     -1.625001    3.192333
    -------------+----------------------------------------------------------------
         sigma_u |   1.479691   .9092213                      .4437471    4.934081
             rho |   .3995881   .2948428                      .0564737     .880953
    ------------------------------------------------------------------------------
    LR test of rho=0: chibar2(01) = 5.44                   Prob >= chibar2 = 0.010
    
    .

    Comment


    • #3
      Thank you so much, Joro Kolev . I have a further question though. Did you intentionally omit the option -, fe- in your example? Because, as I stated in my question, both YEAR and COUNTY are FE. Thanks!

      Comment


      • #4
        No, I did not intentionally omit the fixed effects. I just forgot that the default in -xtlogit- is the random effects, and I did not look at the output carefully to see the difference.

        So of course you need to do -xtlogit, fe- in your case.

        And for the year I did not put it because in the auto data there is no year.

        In your regression you would do something like

        Code:
        xtset county
        
        xtlogit y x i.year, fe
        Originally posted by Ariel Soto-Caro View Post
        Thank you so much, Joro Kolev . I have a further question though. Did you intentionally omit the option -, fe- in your example? Because, as I stated in my question, both YEAR and COUNTY are FE. Thanks!

        Comment


        • #5
          Thank you!
          Sadly I'm getting an error:

          Code:
          . 10,150 (group size) take 9,114 (# positives) combinations results in numeric overflow;
          computations cannot proceed
          But I will figure it out. At least, now I know how to run my model.
          Thanks!!



          Originally posted by Joro Kolev View Post
          No, I did not intentionally omit the fixed effects. I just forgot that the default in -xtlogit- is the random effects, and I did not look at the output carefully to see the difference.

          So of course you need to do -xtlogit, fe- in your case.

          And for the year I did not put it because in the auto data there is no year.

          In your regression you would do something like

          Code:
          xtset county
          
          xtlogit y x i.year, fe

          Comment

          Working...
          X