Announcement

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

  • #16
    Hi all,

    I have a related question regarding interaction models and interpreting their results. I am interested in estimating the effects of unemployment rate changes (and other variables) on perceived job security of individuals. I'm also interested in testing how unemployment effects on perceived job security vary by gender, age, and the number of people retrenched in a company.

    I ran the following fixed-effects regression and have attached the output. "male1" is a dummy which equals 1 for males. "unemp" and "fire1" are continuous variables referring to changes in the unemployment rates and number of people fired, respectively. Given that I am interacting the unemployment rate with several variables, I'm not very sure how exactly to interpret all the results.


    Code:
     xtreg jobsec c.unemp##(male1 c.age c.fire1) tenure contract hire1, fe i(id) cluster(id)
    
    Fixed-effects (within) regression               Number of obs     =     48,024
    Group variable: id                              Number of groups  =      6,003
    
    R-squared:                                      Obs per group:
         Within  = 0.3689                                         min =          8
         Between = 0.0446                                         avg =        8.0
         Overall = 0.2689                                         max =          8
    
                                                    F(10,6002)        =    1392.42
    corr(u_i, Xb) = -0.0216                         Prob > F          =     0.0000
    
                                      (Std. err. adjusted for 6,003 clusters in id)
    -------------------------------------------------------------------------------
                  |               Robust
           jobsec | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
            unemp |  -.1471274   .0133572   -11.01   0.000    -.1733122   -.1209425
          1.male1 |   -.016862    .016438    -1.03   0.305    -.0490864    .0153625
              age |   -.018017   .0009026   -19.96   0.000    -.0197865   -.0162475
            fire1 |  -.1535922    .001901   -80.79   0.000    -.1573189   -.1498656
                  |
    male1#c.unemp |
               1  |   .0113405   .0056862     1.99   0.046     .0001935    .0224875
                  |
    c.unemp#c.age |   .0002964   .0002653     1.12   0.264    -.0002238    .0008165
                  |
          c.unemp#|
          c.fire1 |   .0026306   .0004924     5.34   0.000     .0016654    .0035958
                  |
           tenure |   .1037306   .0026944    38.50   0.000     .0984487    .1090125
         contract |   1.138106   .0206589    55.09   0.000     1.097607    1.178605
            hire1 |    .021884   .0015766    13.88   0.000     .0187933    .0249747
            _cons |   6.521757   .0464188   140.50   0.000     6.430759    6.612754
    --------------+----------------------------------------------------------------
          sigma_u |  1.2486483
          sigma_e |  1.6375178
              rho |  .36766667   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------

    Based on these results, is it correct to say that the unemployment effects on perceived job security are less negative for males, and are larger the higher the number of people fired? Also, how would I interpret the coefficients that are not interacted with "unemp"? ("tenure" is a continuous variable indicating time worked at company, contract is a dummy variable which equals 1 for a permanent contract, and "hire1" refers to the number of people hired).

    I also wanted to estimate marginal effects as suggested in the posts above to aid in interpretation, but this would only work with factor variables if I understand correctly?

    Thank you very much. Ashani
    Last edited by Ashani Abayasekara; 31 Jan 2024, 17:29.

    Comment


    • #17
      is it correct to say that the unemployment effects on perceived job security are less negative for males, and are larger the higher the number of people fired?

      Yes, both of those are correct.

      Also, how would I interpret the coefficients that are not interacted with "unemp"?
      The same way you would interpret them in any other regression model.

      I also wanted to estimate marginal effects as suggested in the posts above to aid in interpretation, but this would only work with factor variables if I understand correctly?
      This time you do not understand correctly. But, in order to estimate marginal effects in a continuous by continuous interaction you need to specify a list of representative values at which to evaluate the marginal effect. So, for sex, it's straightforward:
      Code:
      margins male1, dydx(unemp)
      will give you the average marginal effect of unemp for females and for males.

      For, age, let's say that a reasonably representative range of values for age is the set of numbers 20, 30, 40, 50. Then you would do
      Code:
      margins, dydx(unemp) at(age = (20(10)50))
      to get average marginal effects of unemp at ages 20, 30, 40, and 50.

      You can also combine them:
      Code:
      margins male1, dydx(unemp) at(age = (20(10)50))
      will give you average marginal effects of unemp in males and females of ages 20, 30, 40, and 50.

      Comment


      • #18
        Thank you very much Clyde for the answers and explanations for the margins command, much appreciated.

        I have one more clarification about interpreting the coefficients of unemp, male1, age and fire1 (the first few rows in the output). Would unemp (coefficient of -0.147) refer to the effect of unemployment on perceived job security for females with zero age and no firing?

        Comment


        • #19
          Would unemp (coefficient of -0.147) refer to the effect of unemployment on perceived job security for females with zero age and no firing?
          Yes, it would.

          Comment


          • #20
            Thank you. And the effects of male1, age, and fire1 would be interpreted as in any other regression model?

            Comment


            • #21
              And the effects of male1, age, and fire1 would be interpreted as in any other regression model?
              No! These are part of the interaction. So, the coefficient of male1 represents the effect of being male conditional on age = 0,fire1 = 0, and unemp = 0. And so on.

              It is tenure, contract, and hire1 that can be interpreted just as they would be in any ordinary regression.

              Comment


              • #22
                Got it, thank you.

                Comment


                • #23
                  Hi Clyde, I have a follow-up question about three-way interactions.

                  Suppose I want to test how the effect of unemployment on perceived job security differs by one's job tenure (apart from other characteristics), and also how this unemployment-tenure effect differs by one's mental health status. Would the following code and output test this correctly, and how exactly would I interpret the three-way interacted coefficients? 'sf_mh' refers to five quintiles of mental health based on a mental health score, where higher scores reflect better health.

                  Code:
                  xtreg jobsec c.unemp##(male1 c.age c.tenure contract c.fire1 c.hire1 sf_mh c.tenure#sf_mh) i.j1, cluster(id) 
                  Random-effects GLS regression                   Number of obs     =     48,024
                  Group variable: id                              Number of groups  =      6,003
                  
                  R-squared:                                      Obs per group:
                       Within  = 0.3697                                         min =          8
                       Between = 0.0473                                         avg =        8.0
                       Overall = 0.2703                                         max =          8
                  
                                                                  Wald chi2(40)     =   14318.81
                  corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
                  
                                                   (Std. err. adjusted for 6,003 clusters in id)
                  ------------------------------------------------------------------------------
                               |               Robust
                        jobsec | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
                  -------------+----------------------------------------------------------------
                         unemp |  -.1483966   .0160618    -9.24   0.000    -.1798771   -.1169161
                       1.male1 |  -.0157518   .0162688    -0.97   0.333     -.047638    .0161344
                           age |  -.0180579   .0008883   -20.33   0.000    -.0197989    -.016317
                        tenure |     .10498    .006423    16.34   0.000     .0923911    .1175689
                    1.contract |   1.119119   .0218032    51.33   0.000     1.076385    1.161852
                         fire1 |  -.1533773   .0018947   -80.95   0.000    -.1570908   -.1496639
                         hire1 |   .0195658   .0017225    11.36   0.000     .0161897    .0229419
                               |
                         sf_mh |
                            2  |   .0900903    .061576     1.46   0.143    -.0305964    .2107769
                            3  |   .1469852   .0604984     2.43   0.015     .0284104    .2655599
                            4  |   .2242312   .0599483     3.74   0.000     .1067347    .3417278
                            5  |   .2225374   .0694304     3.21   0.001     .0864564    .3586184
                               |
                         sf_mh#|
                      c.tenure |
                            2  |  -.0079088    .008886    -0.89   0.373     -.025325    .0095074
                            3  |   .0001073   .0088751     0.01   0.990    -.0172876    .0175022
                            4  |  -.0045171    .008953    -0.50   0.614    -.0220647    .0130304
                            5  |  -.0108803   .0101277    -1.07   0.283    -.0307303    .0089696
                               |
                         male1#|
                       c.unemp |
                            1  |   .0111214   .0055908     1.99   0.047     .0001637    .0220792
                               |
                       c.unemp#|
                         c.age |   .0002708   .0002636     1.03   0.304    -.0002458    .0007874
                               |
                       c.unemp#|
                      c.tenure |   .0023694   .0020995     1.13   0.259    -.0017456    .0064844
                               |
                      contract#|
                       c.unemp |
                            1  |   .0086644   .0056473     1.53   0.125     -.002404    .0197329
                               |
                       c.unemp#|
                       c.fire1 |    .002985   .0005108     5.84   0.000     .0019839    .0039861
                               |
                       c.unemp#|
                       c.hire1 |   .0014188   .0004968     2.86   0.004     .0004451    .0023924
                               |
                         sf_mh#|
                       c.unemp |
                            2  |  -.0109254   .0136497    -0.80   0.423    -.0376783    .0158276
                            3  |  -.0186041   .0127486    -1.46   0.144    -.0435909    .0063826
                            4  |  -.0300878    .013176    -2.28   0.022    -.0559122   -.0042634
                            5  |  -.0056093   .0151755    -0.37   0.712    -.0353527     .024134
                               |
                         sf_mh#|
                       c.unemp#|
                      c.tenure |
                            2  |  -.0004389   .0028356    -0.15   0.877    -.0059966    .0051189
                            3  |  -.0021158   .0027074    -0.78   0.435    -.0074223    .0031906
                            4  |  -.0005875      .0028    -0.21   0.834    -.0060755    .0049004
                            5  |    .001238   .0031263     0.40   0.692    -.0048895    .0073655
                               |
                         _cons |   6.444386   .0673426    95.70   0.000     6.312397    6.576375
                  -------------+----------------------------------------------------------------
                       sigma_u |  1.1001221
                       sigma_e |  1.6370156
                           rho |  .31111594   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  Many thanks.

                  Comment


                  • #24
                    Not quite. The c.tenure#sf_mh term should be written with ##, not #.

                    It is difficult enough to understand two way interactions. Three way interactions are even harder to grasp, and I think for most people the task is near impossible just working from the regression output. I think the only way to truly understand these is to work with the margins and marginal effects, and, specifically to graph them. So after the regression I would pick a range of values of the unemp variable, and a range of values of the tenure variable. For the purposes of illustration, I'll assume that the unemp variable is well represented by the values 25 50 75 and that the tenure variable is well represented by the values 2 4 6 8 10. Then I would run commands like:
                    Code:
                    margins sf_mh, at(unemp = (25 50 75)) at(tenure = (2(2)10))
                    marginsplot, xdimension(unemp) name(graph1, replace)
                    marginsplot, xdimension(tenure) name(graph2, replace)
                    
                    margins sf_mh, dydx(unemp)  at(tenure = (2(2)10))
                    marginsplot, xdimension(unemp) name(graph3, replace)
                    marginsplot, xdimension(tenure) name(graph4, replace)
                    
                    margins sf_mh, dydx(tenure) at(unemp = (25 50 75))
                    marginsplot, xdimension(unemp) name(graph5, replace)
                    marginsplot, xdimension(tenure) name(graph6, replace)
                    
                    margins, dydx(sf_mh) at(unemp = (25 50 75)) at(tenure = (2(2)10))
                    marginsplot, xdimension(unemp) name(graph7, replace)
                    marginsplot, xdimension(tenure) name(graph8, replace)
                    The first -margins- command and the two plots that follow it directly will show you the expected values of jobsec at the various combinations of all values of sf_mh and the selected values of unemp and tenure. The subsequent groups of commands will give you the marginal effects of each of the three variables at all combinations of the other two. It will take a while for you to absorb all of the output. I strongly recommend studying the graphs and ignoring the tabled output of -margins- until you are fully comfortable with your understanding of the graphs. Then you can glance at the tabled output.

                    By the way, since you did not prefix sf_mh with anything in your code, I'm interpreting that, just as Stata would, to mean that you want to treat sf_mh as a discrete variable. If you prefer to treat it as continuous (which will simplify the regression outputs, -margins- outputs, and graphs considerably) give it a c. prefix. The c. in front of tenure does not extend its effects to sf_mh across the # (or ##) operator. Of course, in treating it as a continuous variable, you are implicitly saying that all of the successive increment in the value of sf_mh have equal effects on jobsec. So if that's not reasonable, then you must treat it as discrete and live with the more complicated outputs.

                    Comment


                    • #25
                      Thank you very much for the detailed explanation.

                      Comment

                      Working...
                      X