Announcement

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

  • A question on regression estimates

    Hi,

    I have a question on how to access regression coefficients on interaction variables in order to do a Wald test?

    I estimated the regression below:
    Code:
    reghdfe lntotexp ib1994.year##co.MWhousehold age gender children  [aweight=weight], absorb( i.region)  vce(robust)
    I wanted to do a joint Wald test on the DID coefficients (the interaction terms of years 1995-1997 with treatment dummy MWhousehold), so I tried defining:
    Code:
    scalar a=e(b)[1,7]
    scalar b=e(b)[1,8]
    scalar c=e(b)[1,9]
    test (a=0) (b=0) (c=0)
    But, for some reason, it does not capture the true estimate for a. I also tried using matrix coeff=e(b) and then defining: scalar a=coeff[1, colnumb(coeff, "1995.year#c.MWhousehold")], but it does not work.

    Thank you for your help.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float year long caseno double age float(gender children MWhousehold region weight lntotexp)
    1994 101011 52 1 0 0 1 3687 10.222512
    1994 101041 29 1 1 . 1 3182  10.77753
    1994 101051 40 0 0 . . 3574 10.076512
    1994 101071 41 1 1 0 1 3182 10.313793
    1994 101141 45 1 0 1 1 3687  9.779678
    1994 101161 59 1 0 . . 4119  9.278094
    1994 102041 48 1 0 1 1 3687  9.443712
    1994 102091 55 1 0 . . 4119  8.657151
    1994 102111 26 1 0 0 1 3687  9.959013
    1994 102131 32 1 0 . 1 4791  9.220784
    1994 102171 37 1 2 0 1 3129 10.179015
    1994 103031 35 1 2 0 1 3129   9.97752
    1994 103041 23 1 0 0 1 3687 10.254208
    1994 103061 22 1 1 0 1 3182  9.719499
    1994 103091 26 0 4 . 1 3258  9.272298
    1994 103111 50 1 0 0 1 4791  9.202607
    1994 103151 54 1 0 0 1 3687  9.657496
    1994 104051 47 1 0 0 1 3182 10.999594
    1994 104081 46 1 2 0 1 3129  10.68723
    1994 104131 22 1 0 . 1 4713  9.308643
    1994 105021 62 1 0 . 1 4119  8.652774
    1994 105041 22 0 0 0 1 3244  9.720997
    1994 105042 34 1 0 0 1 4791  10.11124
    1994 105043 24 0 0 0 1 3244  9.397074
    1994 105071 44 1 0 . 1 3687 10.243075
    1994 105081 37 1 3 0 1 3081  9.989454
    1994 105101 30 1 0 0 1 3687 10.188212
    1994 105111 61 0 0 . . 3466  8.545683
    1994 105121 46 1 1 1 1 3182   9.88099
    1994 105141 49 1 1 0 1 3182  9.991232
    1994 105151 38 1 1 0 1 3182 10.364096
    1994 105161 51 1 0 1 1 4791  9.821309
    1994 106011 64 1 0 . 1 3687  9.314052
    1994 106021 49 1 0 0 1 3687 10.271123
    1994 106041 54 1 0 0 1 3687  9.410341
    1994 106061 51 1 0 1 1 3687  10.22533
    1994 106071 37 1 0 0 1 3687  9.409633
    1994 106091 31 1 2 1 1 3182  10.99973
    1994 106101 29 1 0 0 1 3687 10.129392
    1994 106111 33 1 1 . 1 3182   9.67976
    1994 106131 24 1 0 0 1 3687 10.080399
    1994 106151 49 1 2 . 1 3129  9.737952
    1994 107021 60 1 0 0 1 3687  9.806719
    1994 107031 61 1 0 1 1 3687  9.950182
    1994 107041 49 1 0 0 1 4791  9.196138
    1994 107061 49 1 0 0 1 3687 10.293027
    1994 107091 50 0 0 . . 3574  9.860349
    1994 107101 64 1 0 . . 3687  10.07565
    1994 107171 53 1 0 . 1 3687  10.64152
    1994 108011 58 1 0 0 1 3687 10.535152
    1994 108021 48 1 1 0 1 3182 10.673572
    1994 108041 25 1 2 . 1 3129  8.443319
    1994 108061 43 1 0 0 1 4791  9.042212
    1994 108071 28 0 3 . . 3258  9.518659
    1994 108081 62 0 0 0 1 3466   9.58686
    1994 108101 39 1 1 . 1 3179  9.126627
    1994 108131 28 1 1 . . 3182  9.471823
    1994 108141 54 0 0 1 1 3574 10.344356
    1994 108171 27 1 0 0 1 3687  10.48352
    1994 109011 45 0 0 0 1 3574 9.1967745
    1994 109061 61 1 0 . . 4119  8.704983
    1994 109121 57 1 0 0 1 3687   9.69633
    1994 109131 62 1 0 . . 4119  8.367128
    1994 109161 37 1 2 0 1 3129 10.168817
    1994 109171 41 1 2 0 1 3129  10.39089
    1994 110021 24 1 0 0 1 4713 8.9634695
    1994 110031 30 1 2 1 1 3129  9.549945
    1994 110061 60 1 0 0 1 4119  9.934455
    1994 110071 22 1 0 . 1 4713  8.883924
    1994 110081 31 1 1 0 1 3182 10.143967
    1994 110091 30 1 2 0 1 3129 10.654867
    1994 110131 58 0 0 0 1 3574  9.811588
    1994 110141 49 1 1 0 1 3182 10.390777
    1994 110161 49 1 0 0 1 3687 10.635046
    1994 111021 35 0 3 . 1 3258  9.532629
    1994 111041 38 0 3 . . 3258  9.474816
    1994 111051 28 0 0 0 1 3244  9.855763
    1994 111091 34 1 1 . . 3182  9.161807
    1994 111111 27 1 0 0 1 3687 10.542326
    1994 111121 58 1 0 0 1 3687 10.087234
    1994 112011 58 1 0 0 1 3687  10.58553
    1994 112031 43 1 1 0 1 3687  9.703906
    1994 112071 63 0 0 1 1 3466  9.506753
    1994 112081 40 0 0 1 1 3258  8.955655
    1994 112121 38 1 1 . 1 3182  9.949727
    1994 112151 54 1 2 . . 3129  9.730298
    1994 112161 49 1 0 0 1 3182 10.557755
    1994 112171 53 1 0 0 1 3687 10.799786
    1994 113021 31 1 0 . . 4791   9.35643
    1994 113031 21 0 2 . . 3258  9.193398
    1994 113041 64 1 0 . . 4119  9.073317
    1994 113051 33 1 3 . 1 3081   9.61131
    1994 113061 47 0 1 . 1 3574  8.788956
    1994 113071 34 1 2 1 1 3129  10.01896
    1994 113131 26 0 1 . 1 3258  9.034952
    1994 113141 31 0 0 . 1 3244  9.083074
    1994 113151 28 0 0 1 1 3244  8.556675
    1994 113171 24 1 1 . 1 3182  8.803491
    1994 114011 22 1 0 . 1 4713 10.078056
    1994 114031 61 1 0 . . 4119  8.901636
    end
    label values gender gnd
    label def gnd 0 "female", modify
    label def gnd 1 "male", modify
    label values MWhousehold type
    label def type 0 "Non-MW household", modify
    label def type 1 "MW household", modify
    label values region reg
    label def reg 1 "north", modify


  • #2
    Ema:
    I'm not that clear with what you're after.
    Why using the community-contributed command -reghdfe. with a cross-sectional dataset that you can analyze via -regress-?.
    That said, I do hope that what follows can help:
    Code:
    . reg lntotexp ib1994.year##co.MWhousehold age gender children   i.region [aweight=weight],  vce(robust)
    (sum of wgt is 221,965)
    note: 1.region omitted because of collinearity.
    
    Linear regression                               Number of obs     =         62
                                                    F(4, 57)          =       4.30
                                                    Prob > F          =     0.0042
                                                    R-squared         =     0.2032
                                                    Root MSE          =     .48712
    
    ------------------------------------------------------------------------------
                 |               Robust
        lntotexp | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
     MWhousehold |  -.1861989    .140301    -1.33   0.190    -.4671467    .0947489
                 |
             age |   .0057302   .0053265     1.08   0.287    -.0049359    .0163963
          gender |   .4166635   .1579521     2.64   0.011     .1003699     .732957
        children |   .1639857   .0794093     2.07   0.043     .0049714        .323
                 |
          region |
          north  |          0  (omitted)
           _cons |   9.330511   .2604014    35.83   0.000     8.809067    9.851956
    ------------------------------------------------------------------------------
    
    . mat list e(b)
    
    e(b)[1,8]
               1994b.                 1994b.year#                                                     1o.              
                year   MWhousehold  co.MWhouse~d           age        gender      children        region         _cons
    y1             0    -.18619892             0     .00573018     .41666346      .1639857             0     9.3305113
    
    . test 1994b.year#co.MWhousehold=MWhousehold
    
     ( 1)  - MWhousehold + 1994b.year#co.MWhousehold = 0
    
           F(  1,    57) =    1.76
                Prob > F =    0.1898
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Ema:
      I'm not that clear with what you're after.
      Why using the community-contributed command -reghdfe. with a cross-sectional dataset that you can analyze via -regress-?.
      That said, I do hope that what follows can help:
      Code:
      . reg lntotexp ib1994.year##co.MWhousehold age gender children i.region [aweight=weight], vce(robust)
      (sum of wgt is 221,965)
      note: 1.region omitted because of collinearity.
      
      Linear regression Number of obs = 62
      F(4, 57) = 4.30
      Prob > F = 0.0042
      R-squared = 0.2032
      Root MSE = .48712
      
      ------------------------------------------------------------------------------
      | Robust
      lntotexp | Coefficient std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      MWhousehold | -.1861989 .140301 -1.33 0.190 -.4671467 .0947489
      |
      age | .0057302 .0053265 1.08 0.287 -.0049359 .0163963
      gender | .4166635 .1579521 2.64 0.011 .1003699 .732957
      children | .1639857 .0794093 2.07 0.043 .0049714 .323
      |
      region |
      north | 0 (omitted)
      _cons | 9.330511 .2604014 35.83 0.000 8.809067 9.851956
      ------------------------------------------------------------------------------
      
      . mat list e(b)
      
      e(b)[1,8]
      1994b. 1994b.year# 1o.
      year MWhousehold co.MWhouse~d age gender children region _cons
      y1 0 -.18619892 0 .00573018 .41666346 .1639857 0 9.3305113
      
      . test 1994b.year#co.MWhousehold=MWhousehold
      
      ( 1) - MWhousehold + 1994b.year#co.MWhousehold = 0
      
      F( 1, 57) = 1.76
      Prob > F = 0.1898
      
      .
      Thank you for your prompt reply, Carlo! It is actually a panel dataset. The control period for DID regressions I am estimating is 1994-1997. So, as a way to test for common trends between treatment and control group in the control period, I tried estimating the above baseline regression on 1995-1997 with 1994 as the base year. I wanted to do also a joint test of significance for the estimates for the 1995-1997 interaction terms, but I wasn't sure how to access the coefficient estimates. This works now:

      test (1995.year#co.MWhousehold=0) (1996.year#co.MWhousehold=0) (1997.year#co.MWhousehold=0)

      Thank you!

      Comment

      Working...
      X