Announcement

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

  • Two fixed effects regressions using two different subsamples of same dataset.

    Hi all,

    I have a question regarding comparing coefficients of two regressions (fe) which are subsamples of a larger dataset.

    Context: I am looking at determinants of bank liquidity across European countries.
    I have decided to split the countries into subsamples: Developed European Countries and Emerging European Countries (no overlap) to see whether my independent variables change significantly. Liquidity Coverage Ratio - Dependent Variable. Bank Size, Net interest Margin, Return on Av.Assets, Leverage and GdpGrowth - Independent Variables


    The stata code I am using for panel data is:
    xtset id year

    Regression 1:
    xtreg LCR Size nim roaa lev gdpg if developed==1, fe robust

    Regression 2:
    xtreg LCR Size nim roaa lev gdpg if emerging==1, fe robust

    Is there a way of comparing the results of the two regressions against each other? E.g. The coefficient of NIM was positively statistically significant in developed countries but emerging countries a smaller positive insignificant result. Therefore the model suggests that NIM has a greater influence over LCR in dependent countries compared to independent countries.

    Thanks,
    (Sorry if this has already been asked I can't find any posts).
    Last edited by Victor Stuart-Smith; 31 Jul 2019, 07:14.

  • #2
    Victor:
    welcome to this forum.
    I'm not sure I got you right but can't you simply create a categorical variable (let's call it -economic_group-) where 0=emerging, 1=developed, and plug it in as a predictor:
    Code:
    xtreg LCR Size nim roaa lev gdpg i.economic_group
    In addition, you can also interact it with -nim- (I assume that -nim- is categorical; it it were continuous, simply replace -i.- with -c.-; see -fvvarlist- for further details):

    Code:
    xtreg LCR Size  roaa lev gdpg i.nim##i.economic_group
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Instead of splitting the sample, you could estimate both coefficients in one regression by interacting your independent variables with your developed or emerging dummy. If you use the emerging dummy, the coefficient for your independent variables are then the effect for developed countries, and the coefficients for indepvars#emerging are the difference between the effects for developed countries and emerging countries. You can then also check whether both coefficients are different from zero with margins.
      Code:
      margins emerging, dydx(indepvars)
      This should get you the exact same coefficients as in your regressions above.

      Alternatively, you can test coefficients from different regressions with suest, but this only works after regress. Then, you will have to change
      Code:
      xtreg LCR Size nim roaa lev gdpg if developed==1, fe robust
      to
      Code:
      reg LCR Size nim roaa lev gdpg i.id if developed==1,  cluster(id)
      but I think the clustering after xtreg is slightly different from clustering after regress.
      Last edited by Wouter Wakker; 31 Jul 2019, 07:54.

      Comment


      • #4
        Hi Carlo,

        Thanks for your quick reply.
        (Yes, Instead of developed==1 and emerging==1 as two separate variables, I could have done economic group where 0=emerging, 1=developed)

        I thought the function; -if- before the var name could distinguish between emerging and developed? e.g. of a sample size of 3000, -if developed==1-, say 2000 are developed and -if emerging==1, is the remaining 1000.

        I am sorry but my stata knowledge surrounding interacting variables is very poor. I understand the basic concept around it but interpretation is where I struggle. Is there another thread that could help?

        Many Thanks

        Comment


        • #5
          [QUOTE=Wouter Wakker;n1510186]Instead of splitting the sample, you could estimate both coefficients in one regression by interacting your independent variables with your developed or emerging dummy. If you use the emerging dummy, the coefficient for your independent variables are then the effect for developed countries, and the coefficients for indepvars#emerging are the difference between the effects for developed countries and emerging countries. You can then also check whether both coefficients are different from zero with margins.
          [CODE]margins emerging, dydx(indepvars)

          Hi Wouter, Thanks for you suggestion but this description however it has gone over my head. the code -margins emergind, dydx(indepvars)- (when putting in the individual dependent variables didnt work)

          Is there a way of comparing not doing interaction and just a top level overview?

          Comment


          • #6
            Victor:
            as Wouter suggested -margins- after interaction is the way to go.
            Just take a look at -margins- entry and related examples in Stata .pdf manual.
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment


            • #7
              Is there a way of comparing not doing interaction and just a top level overview?
              I don't know what you mean by top level overview, but there are basically two ways, splitting the sample (as you did in #1) and adding an interaction term. I think the last one is the preferred method, but if you want to do separate regressions, you will have to use reg instead of xtreg, and use suest to test the coefficients, as I explained in #3.

              I'll be a bit more specific about adding the interaction term. Let's suppose you have a dummy called 'emerging' which is 1 for emerging countries and 0 for developed countries. You can estimate the regression by splitting the sample:
              Code:
              xtreg LCR Size nim roaa lev gdpg if emerging==0, fe robust
              xtreg LCR Size nim roaa lev gdpg if emerging==1, fe robust
              or by interacting the independent variables:
              Code:
              xtreg LCR Size nim roaa lev gdpg emerging#(c.Size c.nim c.roaa c.lev c.gdpg), fe robust
              margins emerging, dydx(Size nim roaa lev gdpd)
              I assume here that all your independent variables are continuous variables, therefore the 'c.'

              Compare the output of margins with the output if the first two independent regressions. The coefficients should be exactly the same! If they are not something is wrong with the coding. The advantage of this is that the regression with the interaction term tests whether the coefficients from margins are statistically different. (The coefficients may be different, but confidence intervals can be large and if they overlap you cannot reject that they are in fact not different)

              Comment


              • #8
                So for this example:

                xtreg lcr lnta nim roaa assetg llrtgl depositg lev gdpg LCRpolicy i.year if developed==1, fe robust


                replace emerging=0 if emerging==.
                gen enim=emerging*nim

                xtreg lcr lnta nim enim roaa assetg llrtgl depositg lev gdpg LCRpolicy , fe robust


                Generates this output:
                lcr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                lnta | -.3390516 .1953732 -1.74 0.084 -.723324 .0452208
                nim | -57.06432 26.53643 -2.15 0.032 -109.2579 -4.87078
                enim | 56.4836 27.34766 2.07 0.040 2.694484 110.2727


                What does this mean for the two nim and enim?
                Can this be done for all variables at one time?
                Thanks


                Comment


                • #9
                  I've seen the updated reply. Thank you
                  I shall get back to you win or lose (Im starting to feel a bit less thick- thank you)

                  Comment


                  • #10
                    -xtreg LCR lnta nim roaa assetg llrtgl depositg lev gdpg LCRpolicy emerging#(c.lnta c.nim c.roaa c.assetg c.llrtgl c.depositg c.lev c.gdpg c.LCRpolicy), fe robust-

                    Produced this output: (Im 99% sure is incorrect)

                    Fixed-effects (within) regression Number of obs = 13,840
                    Group variable: id Number of groups = 3460

                    R-sq: Obs per group:
                    within = 1.0000 min = 4
                    between = . avg = 4.0
                    overall = 1.0000 max = 4


                    corr(u_i, Xb) = -0.0000 Prob > F = .

                    (Std. Err. adjusted for 3460 clusters in id)
                    --------------------------------------------------------------------------------------
                    | Robust
                    LCRpolicy | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                    ---------------------+----------------------------------------------------------------
                    lnta | 3.01e-17 . . . . .
                    nim | 3.19e-16 . . . . .
                    roaa | -6.44e-17 . . . . .
                    assetg | -6.41e-18 . . . . .
                    llrtgl | -2.41e-17 . . . . .
                    depositg | 3.14e-19 . . . . .
                    lev | 3.17e-17 . . . . .
                    gdpg | 3.03e-17 . . . . .
                    LCRpolicy | 1 . . . . .
                    |
                    emerging#c.lnta |
                    1 | -4.48e-17 . . . . .
                    |
                    emerging#c.nim |
                    1 | -4.97e-16 . . . . .
                    |
                    emerging#c.roaa |
                    1 | 1.50e-16 . . . . .
                    |
                    emerging#c.assetg |
                    1 | 1.44e-17 . . . . .
                    |
                    emerging#c.llrtgl |
                    1 | 1.00e-16 . . . . .
                    |
                    emerging#c.depositg |
                    1 | -4.11e-18 . . . . .
                    |
                    emerging#c.lev |
                    1 | -6.93e-17 . . . . .
                    |
                    emerging#c.gdpg |
                    1 | -3.10e-16 . . . . .
                    |
                    emerging#c.LCRpolicy |
                    1 | 8.78e-17 . . . . .
                    |
                    _cons | -2.22e-16 . . . . .
                    ---------------------+----------------------------------------------------------------
                    sigma_u | 2.806e-16
                    sigma_e | 0
                    rho | 1 (fraction of variance due to u_i)
                    --------------------------------------------------------------------------------------


                    Im very much an amateur and feeling like it. Any help would be greatly appreciated

                    Comment


                    • #11
                      That does not look right indeed.

                      First, there is something wrong with your dependent variable. You typed LCR, but Stata took it to be LCRpolicy, which means you don't have a variable called LCR or maybe it is a typo. You are now regressing a LCRpolicy on LCRpolicy which I guess is causing the weird results. Try to look at that first and change it.

                      Also for the next time, please put output copied from Stata within code delimiters as requested in the FAQ, this makes it a bit easier for the eyes.

                      Comment


                      • #12
                        Code:
                         --------------------------------------------------------------------------------------
                                             |               Robust
                                         lcr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                        ---------------------+----------------------------------------------------------------
                                        lnta |  -.0210099   .3295546    -0.06   0.949    -.6691989    .6271791
                                         nim |  -56.81251   27.25765    -2.08   0.038    -110.4246    -3.20042
                                        roaa |  -2.704086   3.494637    -0.77   0.440    -9.577561    4.169388
                                      assetg |  -.1052304   .2322692    -0.45   0.651    -.5620723    .3516115
                                      llrtgl |  -.4831095   .6929999    -0.70   0.486    -1.846146     .879927
                                    depositg |  -.2349773   .1341491    -1.75   0.081    -.4988303    .0288757
                                         lev |   2.069267    .587294     3.52   0.000     .9141394    3.224394
                                        gdpg |  -.6919396    1.96064    -0.35   0.724    -4.548251    3.164372
                                   LCRpolicy |   .6601323   .2445671     2.70   0.007     .1791022    1.141162
                                             |
                             emerging#c.lnta |
                                          1  |  -.4207009   .4112407    -1.02   0.307    -1.229555    .3881535
                                             |
                              emerging#c.nim |
                                          1  |   55.19971   28.47578     1.94   0.053    -.8082804    111.2077
                                             |
                             emerging#c.roaa |
                                          1  |   1.530449   6.009256     0.25   0.799    -10.28894    13.34984
                                             |
                           emerging#c.assetg |
                                          1  |   .3134205   .3103738     1.01   0.313    -.2970426    .9238835
                                             |
                           emerging#c.llrtgl |
                                          1  |   .3704235   1.219198     0.30   0.761    -2.027572    2.768419
                                             |
                         emerging#c.depositg |
                                          1  |   .2661798   .1851773     1.44   0.152    -.0980388    .6303983
                                             |
                              emerging#c.lev |
                                          1  |  -.3530119   .9919475    -0.36   0.722    -2.304038    1.598014
                                             |
                             emerging#c.gdpg |
                                          1  |   -4.77288    3.12579    -1.53   0.128    -10.92088    1.375124
                                             |
                        emerging#c.LCRpolicy |
                                          1  |   .4308899   .5635652     0.76   0.445    -.6775661    1.539346
                                             |
                                       _cons |   3.901103   3.753762     1.04   0.299    -3.482036    11.28424
                        ---------------------+----------------------------------------------------------------
                                     sigma_u |  2.5770892
                                     sigma_e |  .75554377
                                         rho |  .92085028   (fraction of variance due to u_i)
                        --------------------------------------------------------------------------------------
                        Thank you so much for you ongoing help!!
                        You are right (case sensitive- thats just me being silly)
                        This looks better?

                        Thanks

                        Comment


                        • #13
                          Victor:
                          please also provide the upper part of -xtreg,fe- outcome, that is:
                          [CODE]Fixed-effects (within) regression Number of obs = 13,840
                          Group variable: id Number of groups = 3460

                          R-sq: Obs per group:
                          within = 1.0000 min = 4
                          between = . avg = 4.0
                          overall = 1.0000 max = 4


                          corr(u_i, Xb) = -0.0000 Prob > F = .


                          (Std. Err. adjusted for 3460 clusters in id)[/CODE]

                          Thanks.
                          Kind regards,
                          Carlo
                          (Stata 18.0 SE)

                          Comment


                          • #14
                            Code:
                             Fixed-effects (within) regression               Number of obs     =      13,840
                            Group variable: id                              Number of groups  =        3460
                            
                            R-sq:                                           Obs per group:
                                 within  = 0.0874                                         min =          4
                                 between = 0.003                                         avg =        4.0
                                 overall = 0.008                                         max =          4
                            
                                                                            F(18,3459)         =       5.41
                            corr(u_i, Xb)  = -0.9168                        Prob > F          =     0.0000
                            
                                                                       (Std. Err. adjusted for 3460 clusters in id)

                            Comment


                            • #15
                              Yes much better I would say.

                              Just to be clear, the first coefficients without the interactions are now the coefficients for developed countries, for example emerging#c.nim is the difference between the coefficient of nim for emerging countries and developed countries, and the t-value for that coefficients tells you whether they are statistically different. To get the total 'effect' of nim for emerging countries you have to add up the coefficients: -56.81 + 55.19 so probably not statistically different from zero.
                              You can get the same result with margins.
                              Code:
                              margins emerging, dydx(nim)
                              Edit: this is a response to #12

                              Comment

                              Working...
                              X