Announcement

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

  • Moderating Variable - Signifcance

    Hello friends and STATA experts,

    I'm trying to determine the moderating effect of a dummy variable (0= uncontroversial 1= controversial industries) on a simple regression with random effects. Both the dependent variable (ESG) and Independent Variable (Sh [Shareholder]) of that regression are continous.

    The great Carlo Lazzaro has already helped me to examine the interaction of the two predictors.

    Code:
     xtreg ESG i.Industry#c.Sh, re




    Click image for larger version

Name:	table.png
Views:	5
Size:	53.1 KB
ID:	1449265


    I also created a graph to visualize the effect in controversial and uncontroversial Industries:

    twoway (line fit Sh if Industry==0, sort) (line fit Sh if Industry==1, sort lp(-)), legend(lab(1 "Industry 0 (MPA)") lab(2 "Industry 1 (IFN)") ring(0) pos(1))
    Click image for larger version

Name:	graph.png
Views:	1
Size:	110.4 KB
ID:	1449266

    Now my supervisor has asked me to show that the difference between the two Graphs, respectively the two values the dummy variable takes is significant.
    I'd be very thankful if any of you has an idea how to Show this significance.

    Kind regards,
    Konstantin
    Attached Files

  • #2
    Konstantin:
    Carlo Lazzaro is probably not that great (and surely would not be so anyhow) if the example of interaction he gave you excluded the so called conditional main effects of the two predictors included in the interaction.
    The proper way to write your interaction would be:
    Code:
    xtreg ESG i.Industry##c.Sh, re
    As far as your supervisor's request is concerned, see Example #5 under -margins- entry in Stata .pdf manual.
    As an aside, please do not post screenshots but shate what you typed and what Stata gave you back (outcome tables included) via CODE delimiters. Thanks.
    Kind regards,
    Carlo
    (StataNow 19.0)

    Comment


    • #3
      Thx again Carlo I think the way you help People here is admirable

      I originally wrote the interaction that way.
      xtreg ESG i.Industry##c.Sh, re
      My Problem is I couldn't interpret the table stata reported back as I don't see the coefficient if the Dummy Variable takes the Value of 0...only if it takes the Value of 1


      Code:
      Random-effects GLS regression                   Number of obs     =      4,801
      Group variable: comp                            Number of groups  =        683
      
      R-sq:                                           Obs per group:
           within  = 0.0153                                         min =          1
           between = 0.0268                                         avg =        7.0
           overall = 0.0205                                         max =          8
      
                                                      Wald chi2(3)      =      84.32
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
      -------------------------------------------------------------------------------
                ESG |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      --------------+----------------------------------------------------------------
         1.Industry |   7.248824   2.650763     2.73   0.006     2.053425    12.44422
                 Sh |  -.0756342   .0111586    -6.78   0.000    -.0975047   -.0537637
                    |
      Industry#c.Sh |
                 1  |  -.1371937   .0363524    -3.77   0.000    -.2084432   -.0659443
                    |
              _cons |   52.49561   .7668998    68.45   0.000     50.99252    53.99871
      --------------+----------------------------------------------------------------
            sigma_u |  9.6771477
            sigma_e |  19.309291
                rho |    .200746   (fraction of variance due to u_i)
      -------------------------------------------------------------------------------
      I apologize for my lack of CODE delimiters use. I hope I applied them correctly now after looking at the post advices again.

      Comment


      • #4
        Konstantin:
        thanks for your kind wors.
        There's an handy option (named -baselevels-) to get what your after, as you can see from the follwing toy-example:
        Code:
        use "http://www.stata-press.com/data/r15/nlswork.dta"
        . xtreg ln_wage age i.race, re baselevels
        
        Random-effects GLS regression                   Number of obs     =     28,510
        Group variable: idcode                          Number of groups  =      4,710
        
        R-sq:                                           Obs per group:
             within  = 0.1026                                         min =          1
             between = 0.1032                                         avg =        6.1
             overall = 0.0945                                         max =         15
        
                                                        Wald chi2(3)      =    3242.34
        corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |    .018534    .000331    55.99   0.000     .0178852    .0191828
                     |
                race |
              white  |          0  (base)
              black  |  -.1209428   .0129079    -9.37   0.000    -.1462418   -.0956439
              other  |   .0981941   .0538424     1.82   0.068    -.0073351    .2037233
                     |
               _cons |    1.15423   .0118069    97.76   0.000     1.131089    1.177371
        -------------+----------------------------------------------------------------
             sigma_u |  .36581626
             sigma_e |  .30349389
                 rho |  .59231394   (fraction of variance due to u_i)
        ------------------------------------------------------------------------------
        Kind regards,
        Carlo
        (StataNow 19.0)

        Comment


        • #5
          Sure Carlo. I think nobody has helped me as much as you in the recent days :D
          I followed your advice and tried the baselevel Option


          Code:
           xtreg $ylist Sh i.Industry, re baselevels
          
          Random-effects GLS regression                   Number of obs     =      4,801
          Group variable: comp                            Number of groups  =        683
          
          R-sq:                                           Obs per group:
               within  = 0.0118                                         min =          1
               between = 0.0317                                         avg =        7.0
               overall = 0.0193                                         max =          8
          
                                                          Wald chi2(2)      =      72.16
          corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
          
          ------------------------------------------------------------------------------
                   ESG |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                    Sh |  -.0890481   .0106248    -8.38   0.000    -.1098722    -.068224
                       |
              Industry |
                    0  |          0  (base)
                    1  |   1.680747   1.100914     1.53   0.127    -.4770044    3.838499
                       |
                 _cons |   52.85327   .7552647    69.98   0.000     51.37298    54.33356
          -------------+----------------------------------------------------------------
               sigma_u |  9.6326586
               sigma_e |  19.344186
                   rho |  .19869586   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------

          I still don't understand how I can see the effect for 0 AND 1. But whatever the effect is it seems as it is insignificant anyway :/

          Best,
          Konstantin

          Comment


          • #6
            Konstantin:
            if, as in one of your previous posts, you are interested in the intearction betweem -Sh- and -industry- and also add -beselevels-, your code should be:
            Code:
            xtreg $ylist i.Sh##i.Industry, re baselevels
            Kind regards,
            Carlo
            (StataNow 19.0)

            Comment


            • #7
              Yes I think I finally got it. if I understand it correctly this is telling me that for Industry=1 the ESG score is 3.229 Points higher on average than for Industry=0. And the Interaction term Industry#cSh is telling me how the effect from Sh on ESG changes if I go from Industry=0 to Industry=1.

              Thanks Carlo


              Code:
               xtreg ESG c.Sh##i.Industry, re baselevel
              
              Random-effects GLS regression                   Number of obs     =      4,801
              Group variable: comp                            Number of groups  =        683
              
              R-sq:                                           Obs per group:
                   within  = 0.0121                                         min =          1
                   between = 0.0311                                         avg =        7.0
                   overall = 0.0193                                         max =          8
              
                                                              Wald chi2(3)      =      73.12
              corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
              
              -------------------------------------------------------------------------------
                        ESG |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
              --------------+----------------------------------------------------------------
                         Sh |  -.0845385   .0115547    -7.32   0.000    -.1071853   -.0618916
                            |
                   Industry |
                         0  |          0  (base)
                         1  |   3.229396   1.911903     1.69   0.091    -.5178642    6.976657
                            |
              Industry#c.Sh |
                         1  |  -.0286108   .0288677    -0.99   0.322    -.0851905    .0279689
                            |
                      _cons |   52.61458   .7928557    66.36   0.000     51.06061    54.16855
              --------------+----------------------------------------------------------------
                    sigma_u |  9.6441083
                    sigma_e |  19.342755
                        rho |    .199098   (fraction of variance due to u_i)
              -------------------------------------------------------------------------------

              Comment


              • #8
                Konstantin:
                what I usually do to check whether I got results right, is using -predict- as a yardstick against predicted values of the dependent variable performed by hand for a handful of observations, as you can see from the following toy-example:
                Code:
                use "http://www.stata-press.com/data/r15/nlswork.dta"
                . xtreg ln_wage c.age##i.race, re
                
                Random-effects GLS regression                   Number of obs     =     28,510
                Group variable: idcode                          Number of groups  =      4,710
                
                R-sq:                                           Obs per group:
                     within  = 0.1029                                         min =          1
                     between = 0.1024                                         avg =        6.1
                     overall = 0.0942                                         max =         15
                
                                                                Wald chi2(5)      =    3247.03
                corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                
                ------------------------------------------------------------------------------
                     ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                         age |   .0181609   .0003896    46.62   0.000     .0173974    .0189244
                             |
                        race |
                      black  |   -.163071   .0250267    -6.52   0.000    -.2121225   -.1140195
                      other  |   .1610264   .1120497     1.44   0.151    -.0585869    .3806397
                             |
                  race#c.age |
                      black  |   .0014711   .0007486     1.96   0.049     3.77e-06    .0029384
                      other  |  -.0021524     .00337    -0.64   0.523    -.0087575    .0044526
                             |
                       _cons |   1.165051   .0132216    88.12   0.000     1.139137    1.190965
                -------------+----------------------------------------------------------------
                     sigma_u |  .36558352
                     sigma_e |   .3034504
                         rho |  .59207578   (fraction of variance due to u_i)
                ------------------------------------------------------------------------------
                
                . predict pred, xb
                (24 missing values generated)
                
                . bysort race: list ln_wage age race pred if _n==1
                
                -----------------------------------------------------------------------------------------------------------------------
                -> race = white
                
                       +-----------------------------------+
                       |  ln_wage   age    race       pred |
                       |-----------------------------------|
                    1. | 2.158773    27   white   1.655395 |
                       +-----------------------------------+
                
                -----------------------------------------------------------------------------------------------------------------------
                -> race = black
                
                       +-----------------------------------+
                       |  ln_wage   age    race       pred |
                       |-----------------------------------|
                    1. | 1.989816    27   black   1.532043 |
                       +-----------------------------------+
                
                -----------------------------------------------------------------------------------------------------------------------
                -> race = other
                
                       +-----------------------------------+
                       |  ln_wage   age    race       pred |
                       |-----------------------------------|
                    1. | 2.018608    25   other   1.726289 |
                       +-----------------------------------+
                
                
                . di (27*.0181609) + 1.165051
                1.6553953
                
                
                . di ((27*.0181609) + (-.163071+(27*.0014711))) + 1.165051
                1.532044
                
                . di ((25*.0181609) + (.1610264+(25*-.0021524))) + 1.165051
                1.7262899
                Kind regards,
                Carlo
                (StataNow 19.0)

                Comment


                • #9
                  Ah nice I see. Will try that right away slowly I'm starting to like all this.

                  Please correct me if I'm wrong but the equation describing the interaction model should be:

                  ESG(it) = ß0 + ß1Sh(it) + ß2IND(it) * SH(it) + u(i) + e(it) + a.

                  Thanks for the response on my other entry, too

                  Comment


                  • #10
                    Konstantin:
                    I would say that your regression equation should be:
                    ESG(it) =α + ß1Sh(it) + ß2IND(it) + ß1Sh(it)*ß2IND(it) + u(i) + e(it).
                    Your interpretation of your results looks correct to me.
                    Kind regards,
                    Carlo
                    (StataNow 19.0)

                    Comment


                    • #11
                      You're right and to Quote Tina Turner simply the best. I should dedicate this Thesis to you !

                      Comment


                      • #12
                        Konstantin:
                        being at best a somehow experienced beginner in statistics, your kind words are far too flattering: please dedicate your thesis to your dears and those who really supported you along the way.
                        By the way, I was also a fan of Tina Turner (some, say, days ago!) and I still like her songs.
                        Kind regards,
                        Carlo
                        (StataNow 19.0)

                        Comment

                        Working...
                        X