Announcement

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

  • The Comparison between two coefficients

    I am writing to ask for help in the comparison between two coefficients within the same regression model.

    The Context:
    I have two variables (both binary), hj1_b[ and hj0_b whose coefficients I'd like to compare. My hypothesis is that the former is stronger than the latter in its effect on my dependent variable. To test this, I first run a regression as follows:
    Code:
     reghdfe $Y hj0_b hj1_b $CTRL, absorb($FE) cluster($CLS) keepsing
    Across the three measurements, the results are as follows:
    Click image for larger version

Name:	Screenshot 2024-01-19 at 9.23.49 AM.png
Views:	1
Size:	15.3 KB
ID:	1740371



    Upon seeing this result, I thought that my hypothesis was verified: the coefficient point estimates on hj1_b were much larger than those on hj0_b.

    I then followed the procedure here to conduct a one-sided test https://www.stata.com/support/faqs/s...-coefficients/:

    Code:
    test _b[hj1_b]-_b[hj0_b]=0
    local sign_hj = sign(_b[hj1_b]-_b[hj0_b])
    di `sign_hj'
    display "Ho: hj1 >= hj0 p-value = " ttail(r(df_r),`sign_hj'*sqrt(r(F)))
    To my surprise, across the three DVs, the p-values of these T-tests were between 0.1 and 0.2, failing to support my hypothesis.

    My First Question: Was the approach I used for testing my hypothesis correct? And was my interpretation (that I failed to reject the null hypothesis that they had similar effects on the DVs)?

    My Second Question: If my interpretation was correct, I was confused. If I were to interpret from the results (as shown in the table above), I felt like my hypothesis was reasonable indirectly:
    1. There was a significant and positive effect of hj1_b on the DVs;
    2. There was little effect of hj0_b on the DVs;
    I hence feel like it is reasonable to say that my hypothesis holds. But what's the problem with this interpretation?

    Thank you for your help in advance and I appreciate any suggestions/comments on my questions.
    Last edited by Zhiya Zuo; 18 Jan 2024, 19:30. Reason: add tags

  • #2
    Zhiya:
    i the following toy-exampke the coefficienys refer to two continuous predictors, but the approach still holds:
    Code:
    . use "https://www.stata-press.com/data/r18/nlswork.dta"
    (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
    
    . reghdfe ln_wage tenure ttl_exp, abs(idcode year) vce(cluster idcode)
    
    
    HDFE Linear regression                            Number of obs   =     27,549
    Absorbing 2 HDFE groups                           F(   2,   4146) =     266.45
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.6744
                                                      Adj R-squared   =     0.6164
                                                      Within R-sq.    =     0.0477
    Number of clusters (idcode)  =      4,147         Root MSE        =     0.2947
    
                                 (Std. err. adjusted for 4,147 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          tenure |   .0106811   .0014932     7.15   0.000     .0077537    .0136086
         ttl_exp |    .032636   .0024388    13.38   0.000     .0278546    .0374174
           _cons |   1.440671   .0130842   110.11   0.000     1.415019    1.466323
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4147        4147           0    *|
            year |        15           0          15     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    . test tenure=ttl_exp
    
     ( 1)  tenure - ttl_exp = 0
    
           F(  1,  4146) =   38.52
                Prob > F =    0.0000
    
    .
    That said, in case of categorical variables things get slightly trickier with the community-contributed module -reghdfe-: being glorious but a bit old fashiooned, it does not suppoer -fvvarlist- notation.
    However, there is an easy fix: the -xi:- prefix (pun unintended ) :
    Code:
     xi: reghdfe ln_wage tenure i.union i.south ,  abs(idcode year) vce(cluster idcode)
    i.union           _Iunion_0-1         (naturally coded; _Iunion_0 omitted)
    i.south           _Isouth_0-1         (naturally coded; _Isouth_0 omitted)
    (dropped 673 singleton observations)
    (MWFE estimator converged in 7 iterations)
    
    HDFE Linear regression                            Number of obs   =     18,334
    Absorbing 2 HDFE groups                           F(   3,   3460) =     111.06
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.7530
                                                      Adj R-squared   =     0.6953
                                                      Within R-sq.    =     0.0459
    Number of clusters (idcode)  =      3,461         Root MSE        =     0.2561
    
                                 (Std. err. adjusted for 3,461 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          tenure |   .0171478    .001164    14.73   0.000     .0148656    .0194301
       _Iunion_1 |    .098604   .0096996    10.17   0.000     .0795865    .1176214
       _Isouth_1 |  -.0697484   .0226489    -3.08   0.002    -.1141549   -.0253419
           _cons |   1.698307   .0109561   155.01   0.000     1.676826    1.719788
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      3461        3461           0    *|
            year |        12           0          12     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    . mat list e(b)
    
    e(b)[1,4]
            tenure   _Iunion_1   _Isouth_1       _cons
    y1   .01714785   .09860397  -.06974837   1.6983072
    
    . test _Iunion_1 = _Isouth_1
    
     ( 1)  _Iunion_1 - _Isouth_1 = 0
    
           F(  1,  3460) =   48.68
                Prob > F =    0.0000
    
    .
    Via -mat list e(b)- you can retrieve the coefficients you're interested in and then go -test-.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment

    Working...
    X