Announcement

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

  • subsample comparison analysis

    Hi all, I am currently using the following code to compare the statistical difference for the coefficient between two subsamples.

    qui reg DepVar IndVar if LOSS==1
    est store m1

    qui reg DepVar IndVar if LOSS==0
    est store m2

    suest m1 m2, cluster(firm)
    test [m1_mean]IndVar-[m2_mean]IndVar=0


    Is there a way that I can include both fixed effects (year fixed and industry fixed effects) and firm cluster in this setting? Since in other full sample tests, I use reghdfe DepVar IndVar, absorb (industry year) cluster(firm)

  • #2
    reghdfe is from SSC, as you are asked to explain in FAQ Advice #12. You can still do the test using this command, there is no need for suest here.

    Code:
    webuse grunfeld, clear
    *SAMPLE SPLIT
    gen group= _n<=_N/2
    *SEPARATE REGRESSIONS
    reghdfe invest mvalue kstock if !group, a(company year) cluster(company)
    reghdfe invest mvalue kstock if group, a(company year) cluster(company)
    *JOINT REGRESSION
    reghdfe invest i.group#(c.mvalue c.kstock), a(i.group#company i.group#year) cluster(company)
    *TEST MVALUE IN SAMPLE 1= MVALUE IN SAMPLE 2
    test 0.group#c.mvalue= 1.group#c.mvalue
    Res.:

    Code:
    . *SEPARATE REGRESSIONS
    
    .
    . reghdfe invest mvalue kstock if !group, a(company year) cluster(company)
    (MWFE estimator converged in 2 iterations)
    
    HDFE Linear regression                            Number of obs   =        100
    Absorbing 2 HDFE groups                           F(   2,      4) =      28.21
    Statistics robust to heteroskedasticity           Prob > F        =     0.0044
                                                      R-squared       =     0.9087
                                                      Adj R-squared   =     0.8762
                                                      Within R-sq.    =     0.5632
    Number of clusters (company) =          5         Root MSE        =     9.6084
    
                                    (Std. Err. adjusted for 5 clusters in company)
    ------------------------------------------------------------------------------
                 |               Robust
          invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          mvalue |   .0814857   .0329346     2.47   0.069    -.0099553    .1729268
          kstock |   .1033723   .0158188     6.53   0.003     .0594523    .1472922
           _cons |  -5.356396   10.67978    -0.50   0.642    -35.00821    24.29541
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
         company |         5           5           0    *|
            year |        20           0          20     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    .
    . reghdfe invest mvalue kstock if group, a(company year) cluster(company)
    (MWFE estimator converged in 2 iterations)
    
    HDFE Linear regression                            Number of obs   =        100
    Absorbing 2 HDFE groups                           F(   2,      4) =      61.02
    Statistics robust to heteroskedasticity           Prob > F        =     0.0010
                                                      R-squared       =     0.9416
                                                      Adj R-squared   =     0.9208
                                                      Within R-sq.    =     0.6795
    Number of clusters (company) =          5         Root MSE        =    74.6136
    
                                    (Std. Err. adjusted for 5 clusters in company)
    ------------------------------------------------------------------------------
                 |               Robust
          invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          mvalue |   .1264177   .0147231     8.59   0.001     .0855399    .1672954
          kstock |   .3596463   .0811994     4.43   0.011     .1342006     .585092
           _cons |  -118.5172    35.7848    -3.31   0.030    -217.8717   -19.16265
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
         company |         5           5           0    *|
            year |        20           0          20     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    .
    . *JOINT REGRESSION
    
    .
    . reghdfe invest i.group#(c.mvalue c.kstock), a(i.group#company i.group#year) cluster(company)
    (MWFE estimator converged in 2 iterations)
    
    HDFE Linear regression                            Number of obs   =        200
    Absorbing 2 HDFE groups                           F(   4,      9) =      49.94
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.9559
                                                      Adj R-squared   =     0.9398
                                                      Within R-sq.    =     0.6781
    Number of clusters (company) =         10         Root MSE        =    53.1955
    
                                     (Std. Err. adjusted for 10 clusters in company)
    --------------------------------------------------------------------------------
                   |               Robust
            invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    group#c.mvalue |
                0  |   .0814857   .0311293     2.62   0.028     .0110663    .1519052
                1  |   .1264177    .013916     9.08   0.000     .0949374    .1578979
                   |
    group#c.kstock |
                0  |   .1033723   .0149517     6.91   0.000     .0695492    .1371954
                1  |   .3596463   .0767486     4.69   0.001     .1860288    .5332637
                   |
             _cons |  -61.93679   17.64875    -3.51   0.007     -101.861   -22.01254
    --------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    ---------------------------------------------------------+
         Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -----------------+---------------------------------------|
       group#company |        10          10           0    *|
          group#year |        40           0          40     |
    ---------------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    .
    . *TEST MVALUE IN SAMPLE 1= MVALUE IN SAMPLE 2
    
    .
    . test 0.group#c.mvalue= 1.group#c.mvalue
    
     ( 1)  0b.group#c.mvalue - 1.group#c.mvalue = 0
    
           F(  1,     9) =    1.74
                Prob > F =    0.2202

    Comment


    • #3
      Dear Andrew Musau

      I am running a similar regression where my groups are made of south-south, north-south and north-north countries. And i run a regression like this:
      Code:
       
       reghdfe lnimports lndist comlan border if group==3, a(importer exporter) cluster(pair)
      Then, I create 3 dummies (NN, NS and SS) and their interaction terms with each independent variable and run the following regression:
      Code:
       
       reghdfe lnimports lndist comlan border NNlndist NNcomlan NNborder NSlndist NScomlan NSborder, a(importer exporter) cluster(pair)
      I am wondering what happens with the FE if I leave them like that (instead of interacting them)? In the theory, country FE account for multilateral resistance terms (Anderson and van Wincoop, 2004), so they should be computed relative to all countries (and not to the subsample). So is this the way I did it the right way to go ?
      Thank you

      Comment


      • #4
        Originally posted by marie nour View Post

        reghdfe lnimports lndist comlan border NNlndist NNcomlan NNborder NSlndist NScomlan NSborder, a(importer exporter) cluster(pair) [/CODE]

        From a fixed effects perspective, that is fine as long as the dummies vary over importers and exporters. In this case, you just have dummies representing country groupings included in the fixed effects model. On the correctness of the specification, you need to consult with an expert on gravity models, but there is no technical issue.

        Comment

        Working...
        X