Announcement

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

  • #16
    Katherine:y
    can't you simply interact -treat- with -peak- in an unique regression?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #17
      Carlo,

      Unfortunately, no, I can't. I can't change the regression specification.

      Comment


      • #18
        You should run one estimation command instead of two (one for peak =1, and one for peak =0) . You can adapt the following example for reghdfe
        (the regression with the option -coefl- is just to give you the names with which Stata stores the values):
        Code:
        . webuse auto
        (1978 Automobile Data)
        
        . reg mpg c.weight#i.foreign, robust
        
        Linear regression                               Number of obs     =         74
                                                        F(2, 71)          =      76.10
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.6714
                                                        Root MSE          =     3.3626
        
        ----------------------------------------------------------------------------------
                         |               Robust
                     mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -----------------+----------------------------------------------------------------
        foreign#c.weight |
               Domestic  |  -.0066409   .0005421   -12.25   0.000    -.0077218     -.00556
                Foreign  |  -.0075145   .0006839   -10.99   0.000    -.0088782   -.0061509
                         |
                   _cons |   41.95073   1.794367    23.38   0.000     38.37286    45.52859
        ----------------------------------------------------------------------------------
        
        . reg mpg c.weight#i.foreign, robust coefl
        
        Linear regression                               Number of obs     =         74
                                                        F(2, 71)          =      76.10
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.6714
                                                        Root MSE          =     3.3626
        
        ----------------------------------------------------------------------------------
                     mpg |      Coef.  Legend
        -----------------+----------------------------------------------------------------
        foreign#c.weight |
               Domestic  |  -.0066409  _b[0b.foreign#c.weight]
                Foreign  |  -.0075145  _b[1.foreign#c.weight]
                         |
                   _cons |   41.95073  _b[_cons]
        ----------------------------------------------------------------------------------
        
        . test _b[0b.foreign#c.weight] = _b[1.foreign#c.weight]
        
         ( 1)  0b.foreign#c.weight - 1.foreign#c.weight = 0
        
               F(  1,    71) =    5.24
                    Prob > F =    0.0251

        Comment


        • #19
          My post #18 crossed Carlo's. This is what he meant, I think. It doesn't change your model
          Code:
          gen treat1 = treat*peak
          gen treat0 = treat*(1-peak)
          reghdfe cons treat0 treat1 , absorb (i.location#i.hour i.hour#i.calday) vce(cluster i.location#i.hour)
          test treat0 = treat1
          On edit: And is more intuitive than my first post
          On further edit: I am assuming that treat only takes on two values: zero and one
          Last edited by Eric de Souza; 01 Dec 2019, 09:25.

          Comment


          • #20
            Eric is correct.
            Actually, I replied from my mobile and I could not add an example.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #21
              Eric and Carlo,

              Thank you for your help! I have run the code successfully.

              I apologize for my late reply.

              Comment


              • #22
                I have similar problems.
                The model looks like the following:

                leghdfe inv gender salary rent sch opl if inc==1, absorb (country fyear) vce(cluster firm fyear)
                estimate store inc1

                leghdfe inv gender salary rent sch opl if inc==0, absorb (country fyear) vce(cluster firm fyear)
                estimate store inc0

                I want to test whether there is any significant difference between the coefficient of gender. Here, gender is a dummy variable and inc is also dummy variable but sometimes I group inc into three. if inc is 3 group then I want to test the difference between the coefficient of gender between high and low inc group.
                .
                By looking at the solution from Eric (#19) , I have come up with the following solution for my models.

                gen gender1 = gender*inc
                gen gender0 = gender*(1-inc)
                reghdfe inc gender0 gender1 salary rent sch opl, absorb (country fyear) vce(cluster firm fyear)
                test gender0 = gender1

                Could anyone please tell me whether I am doing things correctly or I am making mistakes? Also, how will I test the equality if inc is grouped into three (I want to test the equality between high and low groups for the coefficient of gender, which is a dummy variable)

                Comment

                Working...
                X