Announcement

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

  • Display or Show joint test after estimating REGHDFE

    Hello guys,

    I run the REGHDFE command to estimating this: reghdfe ly $quatre $cinq, a (cmap dveduc3 t). On my output don't have the "joint test" of the 3 fixed effects groups. How can I display the joint F-test for my 3 fixed effects (cmap dveduc3 t).

    I use: display e(F) but this command return me the F (. , .) = . value that we see generally in the top of the output regression table. Can someone please helping me with that issue.


    I attached an output example, to help you guys understanding what I want to display (So the forth line of the table). The output example can from the internet.

    Thank you!
    Attached Files

  • #2
    reghdfe by Sergio Correia is from SSC. To access estimation results, run
    Code:
    ereturn list
    The statistic is stored as
    Code:
     e(F_absorb)
    By the way, you are running an old version of the program. The current version does not display this test as part of the default output.

    Comment


    • #3
      Hello, Thank you so much for your answer.

      By the way, when I run : e(F_absorb), Stata gives me this error.

      Attached Files

      Comment


      • #4
        Code:
        display e(F_absorb)
        following the regression.

        Comment


        • #5


          There is nothing that appears after doing this code.

          Attached Files

          Comment


          • #6
            You cannot run that line independent of the regression. In the do-file, run the entire block of code starting from the reghdfe command. Note that I invoke the -old- option in my regression command as I have the latest version of reghdfe.

            Code:
            sysuse auto
            reghdfe mpg price weight, a(turn) old
            di e(F_absorb)
            Code:
            . sysuse auto
            (1978 Automobile Data)
            
            . reghdfe mpg price weight, a(turn) old
            (running historical version of reghdfe)
            (dropped 4 singleton observations)
            (converged in 1 iterations)
            
            HDFE Linear regression                            Number of obs   =         70
            Absorbing 1 HDFE group                            F(   2,     54) =      12.76
                                                              Prob > F        =     0.0000
                                                              R-squared       =     0.6980
                                                              Adj R-squared   =     0.6141
                                                              Within R-sq.    =     0.3210
                                                              Root MSE        =     3.4819
            
            ------------------------------------------------------------------------------
                     mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                   price |  -.0001178   .0002235    -0.53   0.600    -.0005659    .0003304
                  weight |  -.0055865    .001645    -3.40   0.001    -.0088846   -.0022885
            -------------+----------------------------------------------------------------
                Absorbed |         F(13, 54) =      0.772   0.693             (Joint test)
            ------------------------------------------------------------------------------
            
            Absorbed degrees of freedom:
            ---------------------------------------------------------------+
             Absorbed FE |  Num. Coefs.  =   Categories  -   Redundant     |
            -------------+-------------------------------------------------|
                    turn |           14              14              0     |
            ---------------------------------------------------------------+
            
            . di e(F_absorb)
            .7724645
            Last edited by Andrew Musau; 11 Dec 2019, 12:17.

            Comment


            • #7
              Thank so much!!!!!

              You had to put "old" after the code to be able to have it. Like : reghdfe y x, a(z) old

              Thank you.

              Comment


              • #8
                By the way, I am seeking to regress the wage gap between natives and recent immigrants according to the census year (t), the census metropolitan area (cmap) and the level of education (dveduc3); on a packet of predictors. My dependent variable is therefore the ratio of the average wage of natives to that of recent immigrants. To do this, from the observations of each census I created cells using the command collapse. For example, for the average salary of natives, I did: collapse w if n == 1, by (t cmap dveduc3). Where n is a dummy variable equals 1 if respondents are natives and 0 otherwise. The same logic applies to the average salary of recent immigrants as well as the explanatory variables of the model.

                Since these are cells of different sizes because of the number of observation that varies in cmap for example. Sometimes cmap receive more migrants than others. So, I would like to use in weight in my regression the size of the cells (aw = count) where count is the number of observations in the cell. The idea is that if the residue has a variance sigma ^ 2 / n, the use of cells of different size implies that some cells havea variance of the error term lower than others because the averages have been estimated on more observations. Recognizing this and exploiting it allows efficiency gains. This is a generalized least squares estimator that is simply done by OLS using cell size as the weight. It should help the accuracy of my estimates.

                How can I create the count which will take the place of the size of the cells?

                Comment


                • #9
                  Something like?

                  Code:
                  egen group= group(t cmap dveduc3)
                  bys t cmap dveduc3: egen freq= count(group) if !missing(w) & n == 1
                  collapse w freq if n == 1, by (t cmap dveduc3)

                  Comment


                  • #10
                    In fact, here's what I use as code:

                    reghdfe ly $quatre $cinq [aw=count], a (cmap dveduc3 t) old

                    The idea is, count refer to the cell size. I would like to know how create the count or the cell size to use it as a weight.


                    Attached Files

                    Comment


                    • #11
                      Doesn't the variable "freq" in #9 give you the count that you need? Otherwise I am not understanding what is needed. Here, freq gives you how many observations (i.e., combinations of t, cmap & dveduc3) were used to generate the average value of w. If the calculation is correct, you then use

                      Code:
                      [aw=freq]
                      If not, give a data example using dataex showing how the weight should look like. Stata 15, 16 (or a fully updated version of 14), read through

                      Code:
                      help dataex
                      For a previous version

                      Code:
                      ssc install dataex
                      help dataex

                      Comment


                      • #12
                        Thank you Mr Andrew Musau for your help.

                        Comment

                        Working...
                        X