Announcement

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

  • Comparing regression coefficients across regression models

    Dear Stata Users,

    I am trying to test the difference between the coefficients across two regression models. I noted that suest option if frequently adopted to compare coefficients (https://stats.oarc.ucla.edu/stata/co...s-using-suest/). Unfortunately, I am using FE estimators and suest option is not available on FE models.

    However, several papers also use simple t-tests to compare coefficients. Generally, I use the t-test to test differences among the means of two variables.
    However, I do not know how to apply the test to compare the coefficients of specific independent variables included in my models. Any suggestion would be greatly appreciated.

    Thank you in advance for your support,
    Nicola

  • #2
    This is not clear. Do the regressions involve the same set of variables? Please show the exact commands that you ran.

    Unfortunately, I am using FE estimators and suest option is not available on FE models.
    suest places restrictions on the estimator, not the model. So if you were to estimate the models using regress, adding the fixed effects as indicators, you may use suest. The issue is that the fixed effects dimension(s) may be too large to allow this, in which case you need to find alternative means. But without more information, it is difficult to advise you.
    Last edited by Andrew Musau; 30 Dec 2023, 13:45.

    Comment


    • #3
      Nicola:
      Andrew pointed you out in the right direction.
      I shamelessly follow his guidance in the following toy-example (with a negligible number of fixed effect):
      Code:
      . use "https://www.stata-press.com/data/r18/nlswork.dta"
      (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
      
      . regress ln_wage i.idcode i.year age if idcode<=3
      
            Source |       SS           df       MS      Number of obs   =        39
      -------------+----------------------------------   F(17, 21)       =      2.68
             Model |  3.54194923        17  .208349955   Prob > F        =    0.0171
          Residual |  1.63378973        21  .077799511   R-squared       =    0.6843
      -------------+----------------------------------   Adj R-squared   =    0.4288
             Total |  5.17573896        38  .136203657   Root MSE        =    .27893
      
      ------------------------------------------------------------------------------
           ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
            idcode |
                2  |  -.3898423     .11632    -3.35   0.003     -.631743   -.1479415
                3  |  -2.247118   2.111457    -1.06   0.299    -6.638133    2.143897
                   |
              year |
               69  |  -.0920902   .5314565    -0.17   0.864    -1.197315    1.013134
               70  |  -.8648493    .779214    -1.11   0.280    -2.485314    .7556149
               71  |  -1.248506    1.09967    -1.14   0.269    -3.535396    1.038383
               72  |   -1.39387   1.443494    -0.97   0.345    -4.395779     1.60804
               73  |  -1.520276    1.79214    -0.85   0.406    -5.247236    2.206684
               75  |  -2.049717   2.495803    -0.82   0.421    -7.240024     3.14059
               77  |  -2.657565   3.203292    -0.83   0.416    -9.319175    4.004045
               78  |  -2.751196   3.557758    -0.77   0.448    -10.14996    4.647567
               80  |  -3.324016   4.267534    -0.78   0.445    -12.19884    5.550808
               82  |  -4.027975   4.983977    -0.81   0.428    -14.39272    6.336774
               83  |  -4.207353   5.333467    -0.79   0.439     -15.2989    6.884199
               85  |  -4.730657   6.044586    -0.78   0.443    -17.30106    7.839747
               87  |  -5.407995   6.755956    -0.80   0.432    -19.45777    8.641785
               88  |  -5.901929   7.348904    -0.80   0.431    -21.18481    9.380954
                   |
               age |   .3010572   .3561559     0.85   0.407    -.4396095    1.041724
             _cons |  -2.882579   5.734884    -0.50   0.620    -14.80892    9.043766
      ------------------------------------------------------------------------------
      
      . estimate store A
      
      . regress ln_wage i.idcode i.year c.age##c.age if idcode<=3
      
            Source |       SS           df       MS      Number of obs   =        39
      -------------+----------------------------------   F(18, 20)       =      4.86
             Model |  4.21278813        18  .234043785   Prob > F        =    0.0005
          Residual |  .962950828        20  .048147541   R-squared       =    0.8139
      -------------+----------------------------------   Adj R-squared   =    0.6465
             Total |  5.17573896        38  .136203657   Root MSE        =    .21943
      
      ------------------------------------------------------------------------------
           ln_wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
            idcode |
                2  |  -.4183815   .0918256    -4.56   0.000    -.6099263   -.2268366
                3  |   .6579353   1.834332     0.36   0.724    -3.168414    4.484284
                   |
              year |
               69  |   .3367906   .4335876     0.78   0.446    -.5676572    1.241238
               70  |   .2089384   .6771373     0.31   0.761    -1.203545    1.621422
               71  |   .3144116   .9610926     0.33   0.747    -1.690392    2.319216
               72  |   .5888124   1.253657     0.47   0.644     -2.02627    3.203894
               73  |   .8912873   1.550825     0.57   0.572    -2.343676    4.126251
               75  |   1.246958   2.152898     0.58   0.569    -3.243908    5.737823
               77  |   1.560689   2.761762     0.57   0.578    -4.200247    7.321624
               78  |   1.941522   3.068213     0.63   0.534    -4.458659    8.341703
               80  |    2.34498   3.684737     0.64   0.532    -5.341247    10.03121
               82  |   2.698954   4.315145     0.63   0.539     -6.30228    11.70019
               83  |   2.994437   4.618087     0.65   0.524    -6.638723     12.6276
               85  |   3.538578   5.245889     0.67   0.508    -7.404154    14.48131
               87  |   3.965153   5.878139     0.67   0.508    -8.296429    16.22674
               88  |    4.40786   6.407149     0.69   0.499    -8.957218    17.77294
                   |
               age |   .0773019   .2865219     0.27   0.790    -.5203723    .6749761
                   |
       c.age#c.age |  -.0045583   .0012212    -3.73   0.001    -.0071057    -.002011
                   |
             _cons |   1.341224   4.651269     0.29   0.776    -8.361153     11.0436
      ------------------------------------------------------------------------------
      
      . estimate store B
      
      . suest A B
      
      Simultaneous results for A, B                               Number of obs = 39
      
      ------------------------------------------------------------------------------
                   |               Robust
                   | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      A_mean       |
            idcode |
                2  |  -.3898423   .0906971    -4.30   0.000    -.5676053   -.2120792
                3  |  -2.247118   .6005261    -3.74   0.000    -3.424128   -1.070109
                   |
              year |
               69  |  -.0920902   .1107847    -0.83   0.406    -.3092243    .1250438
               70  |  -.8648493   .2478246    -3.49   0.000    -1.350577   -.3791222
               71  |  -1.248506   .3829516    -3.26   0.001    -1.999078   -.4979351
               72  |   -1.39387   .4097095    -3.40   0.001    -2.196886    -.590854
               73  |  -1.520276   .5202896    -2.92   0.003    -2.540025   -.5005269
               75  |  -2.049717    .758806    -2.70   0.007    -3.536949   -.5624846
               77  |  -2.657565    .970228    -2.74   0.006    -4.559177   -.7559528
               78  |  -2.751196   1.082508    -2.54   0.011    -4.872872   -.6295199
               80  |  -3.324016   1.302378    -2.55   0.011     -5.87663   -.7714024
               82  |  -4.027975   1.530587    -2.63   0.008    -7.027869    -1.02808
               83  |  -4.207353   1.621794    -2.59   0.009    -7.386011   -1.028695
               85  |  -4.730657   1.858014    -2.55   0.011    -8.372297   -1.089018
               87  |  -5.407995   2.062526    -2.62   0.009    -9.450472   -1.365517
               88  |  -5.901929   2.215694    -2.66   0.008    -10.24461   -1.559248
                   |
               age |   .3010572   .1107847     2.72   0.007     .0839232    .5181913
             _cons |  -2.882579   1.843797    -1.56   0.118    -6.496356    .7311975
      -------------+----------------------------------------------------------------
      A_lnvar      |
             _cons |   -2.55362   .1401788   -18.22   0.000    -2.828366   -2.278875
      -------------+----------------------------------------------------------------
      B_mean       |
            idcode |
                2  |  -.4183815   .0807647    -5.18   0.000    -.5766773   -.2600856
                3  |   .6579353   .6207428     1.06   0.289    -.5586983    1.874569
                   |
              year |
               69  |   .3367906   .1004751     3.35   0.001      .139863    .5337182
               70  |   .2089384   .2173278     0.96   0.336    -.2170163     .634893
               71  |   .3144116   .3300279     0.95   0.341    -.3324311    .9612544
               72  |   .5888124    .421578     1.40   0.163    -.2374653     1.41509
               73  |   .8912873   .5188029     1.72   0.086    -.1255477    1.908122
               75  |   1.246958   .7300432     1.71   0.088    -.1839004    2.677816
               77  |   1.560689   .9381513     1.66   0.096     -.278054    3.399431
               78  |   1.941522   1.044322     1.86   0.063    -.1053105    3.988355
               80  |    2.34498   1.262371     1.86   0.063    -.1292219    4.819183
               82  |   2.698954   1.466749     1.84   0.066    -.1758208     5.57373
               83  |   2.994437   1.571986     1.90   0.057    -.0865997    6.075474
               85  |   3.538578   1.819024     1.95   0.052    -.0266442    7.103801
               87  |   3.965153   2.031644     1.95   0.051    -.0167963    7.947103
               88  |    4.40786   2.174655     2.03   0.043     .1456145    8.670106
                   |
               age |   .0773019   .0866033     0.89   0.372    -.0924374    .2470412
                   |
       c.age#c.age |  -.0045583   .0007208    -6.32   0.000    -.0059712   -.0031455
                   |
             _cons |   1.341224   1.443448     0.93   0.353    -1.487882     4.17033
      -------------+----------------------------------------------------------------
      B_lnvar      |
             _cons |  -3.033485   .1518706   -19.97   0.000    -3.331146   -2.735824
      ------------------------------------------------------------------------------
      
      . test [A_mean]age=[B_mean]age
      
       ( 1)  [A_mean]age - [B_mean]age = 0
      
                 chi2(  1) =    7.71
               Prob > chi2 =    0.0055
      
      .
      Last but not least, I do echo Andrew's advice to post what you typed and what Stata gave you back (as per FAQ). Thanks.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thank you very much Andrew Musau and Carlo Lazzaro for your repliesYes, the regressions involve the same set of variables. I have tried to use regress and add FE. Suest command gives me back the following warning message: "Code1: factor variable base category conflict". I had a similar issue with Country Dummies. I solved it by creating single dummies by each country (i.e. Country1-Country100) instead of i.Country. I have too many firm Codes to do the same with Code1. Do you know how to solve it?
        Below, I report the output (I Removed the dummies to fit within the character limit).


        Code:
        reg Kim100_w2 l.FGD l.ln_emp l.DEq l.Bize l.CEO_sep l.Firm_Age l.Capex_TA l.GDPgrowth  i.Period country1-country103 sector1-sector12 i.Code1 if F_Control==0 & Match1!=.
        
        Source    SS    df    MS      Number of obs   =    1,513
                    F(187, 1325)    =    43.62
        Model    266277.871    187    1423.94583   Prob > F        =    0.0000
        Residual    43255.7853    1,325    32.6458757   R-squared       =    0.8603
                    Adj R-squared   =    0.8405
        Total    309533.656    1,512    204.718026   Root MSE        =    5.7137
        
                        
        Kim10~2    Coefficient    Std. err.    t    P>t     [95% conf.    interval]
                        
        FGD    
        L1.    .0568314    .0276084    2.06   0.040     .0026705    .1109923
            
        ln_emp    
        L1.    -1.437617    .4995122    -2.88   0.004    -2.417538    -.4576961
            
        DEq    
        L1.    -3.41e-07    .0000266    -0.01   0.990    -.0000525    .0000518
            
        Bize    
        L1.    .4937908    .1176362    4.20   0.000     .2630173    .7245643
            
        CEO_sep    
        L1.    -1.004342    .5641725    -1.78   0.075     -2.11111    .1024271
            
        Firm_Age    
        L1.    -.4290541    .1211534    -3.54   0.000    -.6667277    -.1913806
            
        Capex_TA    
        L1.    .0506036    .0630879    0.80   0.423    -.0731595    .1743667
            
        GDPgrowth    
        L1.    -.5306111    .1161777    -4.57   0.000    -.7585234    -.3026988
            
        Period    
        2010    -1.08526    .953616    -1.14   0.255    -2.956022    .7855021
        2011    2.432828    .9297886    2.62   0.009     .6088093    4.256846
        2012    2.688224    .9615374    2.80   0.005     .8019219    4.574525
        2013    1.599915    1.007752    1.59   0.113    -.3770496    3.576879
        2014    2.491208    1.095078    2.27   0.023     .3429332    4.639483
        2015    2.800812    1.198602    2.34   0.020     .4494474    5.152178
        2016    2.439761    1.305112    1.87   0.062    -.1205505    5.000072
        2017    3.356287    1.415905    2.37   0.018     .5786267    6.133947
        2018    3.707957    1.552137    2.39   0.017     .6630416    6.752872
        2019    3.440156    1.664568    2.07   0.039     .1746796    6.705632
        2020    3.541455    1.785838    1.98   0.048     .0380767    7.044834
            
        country1    0    (omitted)
        country2    0    (omitted)
        country3    -.6832236    3.394753    -0.20   0.841      -7.3429    5.976453
        country4    0    (omitted)
        country5    0    (omitted)
        country6    0    (omitted)
        12244    0    (omitted)
            
        _cons    40.38754    8.785796    4.60   0.000     23.15195    57.62313
        
        
        eststo FF0

        Code:
        reg Kim100_w2 l.FGD l.ln_emp l.DEq l.Bize l.CEO_sep l.Firm_Age l.Capex_TA l.GDPgrowth  i.Period country1-country103 sector1-sector12 i.Code1 if  F_Control==0 & Match1!=.
        
        Source    SS    df    MS      Number of obs   =    1,521
                    F(194, 1326)    =    60.13
        Model    604501.391    194    3115.98655   Prob > F        =    0.0000
        Residual    68713.0211    1,326    51.8197746   R-squared       =    0.8979
                    Adj R-squared   =    0.8830
        Total    673214.412    1,520    442.904219   Root MSE        =    7.1986
        
                        
        Kim10~2    Coefficient    Std. err.    t    P>t     [95% conf.    interval]
                        
        FGD    
        L1.    .0075365    .0298193    0.25   0.801    -.0509616    .0660346
            
        ln_emp    
        L1.    -.4734108    .7783526    -0.61   0.543    -2.000348    1.053526
            
        DEq    
        L1.    -.0001447    .0003354    -0.43   0.666    -.0008025    .0005132
            
        Bize    
        L1.    .0979694    .1262105    0.78   0.438    -.1496246    .3455633
            
        CEO_sep    
        L1.    1.592828    .7508731    2.12   0.034     .1197997    3.065857
            
        Firm_Age    
        L1.    -.2107377    1.011458    -0.21   0.835    -2.194969    1.773494
            
        Capex_TA    
        L1.    .3113552    .0999548    3.11   0.002     .1152684    .5074421
            
        GDPgrowth    
        L1.    -.0366181    .1436555    -0.25   0.799     -.318435    .2451988
            
        Period    
        2010    -1.11329    1.197386    -0.93   0.353    -3.462267    1.235686
        2011    .413681    1.097471    0.38   0.706    -1.739288    2.56665
        2012    .6869564    1.075042    0.64   0.523    -1.422011    2.795924
        2013    .3675669    1.069122    0.34   0.731    -1.729789    2.464923
        2014    1.539048    1.081356    1.42   0.155    -.5823062    3.660403
        2015    2.00478    1.103212    1.82   0.069    -.1594513    4.169011
        2016    2.597457    1.11329    2.33   0.020     .4134547    4.78146
        2017    1.31635    1.0929    1.20   0.229    -.8276509    3.460351
        2018    1.89807    1.112924    1.71   0.088    -.2852138    4.081353
        2019    4.617067    1.129893    4.09   0.000     2.400495    6.833639
        2020    5.537602    1.138261    4.86   0.000     3.304614    7.77059
            
        country1    0    (omitted)
        country2    -3.164635    3.378161    -0.94   0.349    -9.791758    3.462488
        country3    0    (omitted)
        country4    0    (omitted)
        country5    0    (omitted)
        country6    0    (omitted)
        country7    0    (omitted)
        
            
        _cons    65.72687    7.744485    8.49   0.000     50.53409    80.91965
        
        
        
        
        eststo FF0



        Code:
        suest FF0 FF1, cluster (Code1)
        Code1: factor variable base category conflict
        r(198)

        Apart suest command, is there a way to just use a simple t-test to compare coefficients instead of suest?

        Thank you for your precious suggestions,
        All the best,
        N

        Last edited by Nicola Rossi; 02 Jan 2024, 11:48.

        Comment


        • #5
          You can either estimate both models jointly (equivalent to what suest does) or bootstrap the difference. For the former, you would need to duplicate the observations and create a sample dummy. Then interact this dummy with your variables and fixed effects. There are several examples in the forum, e.g., https://www.statalist.org/forums/for...-fixed-effects. Otherwise provide a data example if you cannot make progress.

          Comment

          Working...
          X