Announcement

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

  • Estimate reghdfe without constant

    Dear all,

    Based on the documentation of reghdfe, ‘noconstant’ option is only cosmetic and does not truly remove the constant from the model. How can I tell reghdfe to estimate the model without a constant?

    P.S. I have not received a response from the author of the package, Sergio Correia, and am thus posting the question here for further assistance.

    Thank you for your help.

    Kind regards,
    Tanya

  • #2
    Why would you want to do this? On occasion it can be sensible to force a single predictor regression through the origin -- after all many laws of physics are of the form result = constant x stimulus -- but instances where a hyperplane should be forced through the origin seem thin on the ground. If an intercept appears negligible, leave it be.

    Comment


    • #3
      Dear Tanya Yakushina,

      Adding to Nick's useful advice, I would say that what you are asking for does not seem to make sense. Presumably, the reason you are using that command is to absorb the fixed effects and a linear model with fixed effects is effectively a model with many "constants" (one per fixed effect), so it is not logically possible to have a model with fixed effects and without constant.

      Best wishes,

      Joao

      Comment


      • #4
        Dear Nick and Joao,

        Thank you for your replies! I will try my best to explain what I would like to achieve.

        I need to obtain coefficient plots which can be interpreted as probabilities (requiring non-negative values and excluding the constant term from the regression model). I ran the following code on the full dataset:
        Code:
        reghdfe dummy_var ibn.ln_var_10bins, absorb(i.group1 i.group2 i. group1#i.group2) keepsingleton
        // note: 9.ln_var_10bins omitted because of collinearity
        estimates store res_with_fe
        coefplot res_with_fe, vertical yline(0) ///
            xlabel(, angle(45)) xsize(8) ///
            title("Full sample, with const, with fixed effects", size(medium)) ///
            b1title("ln_var_10bins")
        Click image for larger version

Name:	coefplot_fullsample_forum_question.png
Views:	1
Size:	18.5 KB
ID:	1755050



        As a test, I ran the code below within a subsample of the biggest combination of group1 and group2 without including fixed effects. This produced a coefficient plot with the expected shape which I want to obtain on the full sample.
        Code:
        reg dummy_var ibn.ln_var_10bins if group1 == "X" & group2 == "Y", noconstant robust
        estimates store res_wo_fe_sample
        coefplot res_wo_fe_sample, vertical yline(0) ///
            xlabel(, angle(45)) xsize(8) ///
            title("Subsample, no const, no fixed effects", size(medium)) ///
            b1title("ln_var_10bins")
        Click image for larger version

Name:	coefplot_subsample_forum_question.png
Views:	1
Size:	19.9 KB
ID:	1755051



        Thus, I am trying to figure out how to drop the constant in reghdfe forcefully or find an alternative solution to achieve my objective of interpreting these coefficients as probabilities.
        Last edited by Tanya Yakushina; 31 May 2024, 07:41.

        Comment


        • #5
          I'd say that Joao Santos Silva's specific comment is immensely more cogent than my generic comments.

          To take this further, do I understand correctly that you've applied regression (albeit with bells and whistles) to a (0. 1) indicator variable as outcome? In other words, applied a linear probability model? That is often doomed to difficulty and disappointment.

          Detail: Section 2 in https://journals.sagepub.com/doi/pdf...36867X19830921 explains at greater length why I won't willingly use the terminology of dummy variable.

          Comment


          • #6
            Based on #4 I think the OP may be asking for a coefficient on ~ins=9 instead of a constant. Notice that that coefficient is dropped from the first plot. I expect maybe reghdfe doesn't offer that option because it would be ill-defined in the case of multiple fixed effects. However,there is only one FE here, so perhaps -xtreg- could be used, with the -noconstant- option (if that option does what I expect - that the option keeps all the FE coefficients rather than dropping one). Or plain old -reg-, with the fixed effects included as 10 additional variables and again with the -noconstant- option. Or keeping with -reghdfe- the coeficient value that would have been returned if there had been a noconstant option can be calculated from _con and the other coefficients. Just add _con to each of the other values. Then _con alone is the coefficient for ~ins=9. If any of this is nonsense, I hope a more expert reader will speak up.

            Comment


            • #7
              Answering Nick Cox's question about the dependent variable: It describes participation (0/1). Therefore, I want to obtain the probability of participation using the coefficient plots. Thank you for your clarification about the wording!

              Comment


              • #8
                I guess what the OP is asking for are the predicted means. The coefficients on the categorical variable represent differences in the predicted means between the observed category and the reference (omitted) category. Here, you can use margins following reghdfe. Note that reghdfe is from https://github.com/sergiocorreia/ivreghdfe and coefplot is from SSC (FAQ Advice #12).

                Code:
                sysuse auto, clear
                reghdfe foreign weight i.rep78, absorb(mpg)
                margins i.rep78, post
                coefplot ., vert xlab(1/5) noci xtitle("`:var lab rep78'")
                Res.:

                Code:
                . reghdfe foreign weight i.rep78, absorb(mpg)
                (dropped 5 singleton observations)
                (MWFE estimator converged in 1 iterations)
                
                HDFE Linear regression                            Number of obs   =         64
                Absorbing 1 HDFE group                            F(   5,     43) =       9.71
                                                                  Prob > F        =     0.0000
                                                                  R-squared       =     0.7651
                                                                  Adj R-squared   =     0.6558
                                                                  Within R-sq.    =     0.5304
                                                                  Root MSE        =     0.2659
                
                ------------------------------------------------------------------------------
                     foreign | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                      weight |  -.0004027   .0000982    -4.10   0.000    -.0006007   -.0002048
                             |
                       rep78 |
                          2  |   .0613948   .2177172     0.28   0.779    -.3776738    .5004634
                          3  |   .1171618   .2232899     0.52   0.602    -.3331452    .5674689
                          4  |   .3579489   .2204583     1.62   0.112    -.0866477    .8025455
                          5  |   .5689294   .2474818     2.30   0.026     .0698348    1.068024
                             |
                       _cons |   1.304185   .3827009     3.41   0.001     .5323948    2.075975
                ------------------------------------------------------------------------------
                
                Absorbed degrees of freedom:
                -----------------------------------------------------+
                 Absorbed FE | Categories  - Redundant  = Num. Coefs |
                -------------+---------------------------------------|
                         mpg |        16           0          16     |
                -----------------------------------------------------+
                
                .
                . margins i.rep78, post
                
                Predictive margins                                          Number of obs = 64
                Model VCE: OLS
                
                Expression: Linear prediction, predict()
                
                ------------------------------------------------------------------------------
                             |            Delta-method
                             |     Margin   std. err.      z    P>|z|     [95% conf. interval]
                -------------+----------------------------------------------------------------
                       rep78 |
                          1  |    .050528   .2081999     0.24   0.808    -.3575363    .4585924
                          2  |   .1119229   .1062474     1.05   0.292    -.0963181    .3201639
                          3  |   .1676899   .0606544     2.76   0.006     .0488095    .2865702
                          4  |   .4084769   .0697186     5.86   0.000      .271831    .5451229
                          5  |   .6194575   .1321396     4.69   0.000     .3604685    .8784464
                ------------------------------------------------------------------------------
                Click image for larger version

Name:	Graph.png
Views:	1
Size:	14.9 KB
ID:	1755112

                Last edited by Andrew Musau; 01 Jun 2024, 10:15.

                Comment


                • #9
                  Thank you very much, Andrew Musau! Your solution works for my task.

                  Comment


                  • #10
                    Andrew Musau I hope you don't mind a follow-up question to your answer. In case where I have multiple FEs I am a bit unsure how to interpret the magnitude of the predicted means from the -margins- command. If I have a different predicted mean for different combinations of fixed effects, does the -margins- command return the average of those? Or is this predicted mean evaluated at the average of all the fixed effects? Any insight on the interpretation of your example in the case with multiple fixed effects would be greatly appreciated.

                    Comment


                    • #11
                      The same case with adding multiple variables. With just the outcome and the categorical variable, the coefficients are literally the mean values of the outcome across levels of the categorical variable. If you add additional variables, they are the mean values after adjusting for other regressors in the model.

                      Comment

                      Working...
                      X