Announcement

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

  • Interaction between dummy and continuous variable in fixed effects model

    Hi!

    I have an interaction effect between a dummy variable (0/1) and a continous variable in a fixed effects model. I included the interaction term and the main effect (I simply included the continuous variable) in the model. I also include the dummy variable, however the fixed effects model ommits it as it is time-invariant.

    1) How do I interpret the coefficient of the interactino effect and the main effect?
    2) I already know that the interaction effect shows what happens to the DV for every increase in IV for dummy=0, but how do I interpret with dummy=1?


    Thanks!
    Theresa

  • #2
    Originally posted by Theresa Pleye View Post
    1) How do I interpret the coefficient of the interactino effect and the main effect?
    In exactly the same way as you would in other models. Sometimes people are worried about the fact that the main effect of time constant variables are not included because they learned that the main effects should always be in your model if you add interactions. You can think of this that the main effect of your time constant indicator (dummy) variable is automatically in your model by being absorbed by the fixed effects.

    Originally posted by Theresa Pleye View Post
    2) I already know that the interaction effect shows what happens to the DV for every increase in IV for dummy=0, but how do I interpret with dummy=1?
    With time constant indicator variables I find it often more meaningful to think in terms of comparisons of groups rather than change. Say our indicator variable represents a person's sex. Then it makes more sense to compare males and females rather than imagine someone changing their sex. This has no impact on the model (well, there are exceptions to that, but I'll ignore that for now), it is just a different way of interpreting the results.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you! Yes, my dummy represents the belonging to a certain group. But how can I find out what influence the DV has on the IV considering the interaction effect for dummy=1? I am unsure how to interpret the main effect as well as the interaction

      Comment


      • #4
        You would compute that effect just like you would do in any other model.

        That is not a very helpful answer, so I guess I don't understand your question. Can you give us an example, and try to rephrase your question in terms of that example?
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Maybe it helps if I give an example:

          Code:
          . // prepare some example data
          . webuse nlswork, clear
          (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
          
          . xtset idcode
          
          Panel variable: idcode (unbalanced)
          
          . gen byte black:black_lb = race == 2 if race <= 2
          (303 missing values generated)
          
          . label define black_lb 0 "white" 1 "black"
          
          . label var black "respondent's race"
          
          . gen wage = exp(ln_wage)
          
          . label var wage "hourly wage"
          
          .
          . // estimate the model
          . xtreg wage i.black##c.ttl_exp, fe
          note: 1.black omitted because of collinearity.
          
          Fixed-effects (within) regression               Number of obs     =     28,231
          Group variable: idcode                          Number of groups  =      4,654
          
          R-squared:                                      Obs per group:
               Within  = 0.0826                                         min =          1
               Between = 0.2326                                         avg =        6.1
               Overall = 0.1322                                         max =         15
          
                                                          F(2,23575)        =    1061.01
          corr(u_i, Xb) = 0.1299                          Prob > F          =     0.0000
          
          ------------------------------------------------------------------------------
                  wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                 black |
                black  |          0  (omitted)
               ttl_exp |   .2532758   .0061424    41.23   0.000     .2412363    .2653153
                       |
                 black#|
             c.ttl_exp |
                black  |  -.0562058   .0113932    -4.93   0.000    -.0785372   -.0338745
                       |
                 _cons |   4.561861   .0368555   123.78   0.000     4.489622      4.6341
          -------------+----------------------------------------------------------------
               sigma_u |  2.7206271
               sigma_e |  3.0284316
                   rho |  .44661304   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          F test that all u_i=0: F(4653, 23575) = 3.99                 Prob > F = 0.0000
          
          . // so a white person can expect 25.3 cents an hour extra for every year of
          . // experience and this effect of experience 5.6 cents less for a black person
          .
          . // how are the coefficients called again?
          . xtreg, coeflegend
          
          Fixed-effects (within) regression               Number of obs     =     28,231
          Group variable: idcode                          Number of groups  =      4,654
          
          R-squared:                                      Obs per group:
               Within  = 0.0826                                         min =          1
               Between = 0.2326                                         avg =        6.1
               Overall = 0.1322                                         max =         15
          
                                                          F(2,23575)        =    1061.01
          corr(u_i, Xb) = 0.1299                          Prob > F          =     0.0000
          
          ------------------------------------------------------------------------------
                  wage | Coefficient  Legend
          -------------+----------------------------------------------------------------
                 black |
                black  |          0  _b[1o.black]
               ttl_exp |   .2532758  _b[ttl_exp]
                       |
                 black#|
             c.ttl_exp |
                black  |  -.0562058  _b[1.black#c.ttl_exp]
                       |
                 _cons |   4.561861  _b[_cons]
          -------------+----------------------------------------------------------------
               sigma_u |  2.7206271
               sigma_e |  3.0284316
                   rho |  .44661304   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          F test that all u_i=0: F(4653, 23575) = 3.99                 Prob > F = 0.0000
          
          .
          . // find the effect of ttl_exp for black respondents
          . lincom ttl_exp + 1.black#c.ttl_exp
          
           ( 1)  ttl_exp + 1.black#c.ttl_exp = 0
          
          ------------------------------------------------------------------------------
                  wage | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   (1) |   .1970699   .0095956    20.54   0.000      .178262    .2158779
          ------------------------------------------------------------------------------
          
          . // so a black person can expect 25.3-5.6=19.7 cents an hour extra for every
          . // year of experience
          Notice that I don't use your data (how could I?), so whatever example I use may or may not be applicable to your case. That is why we prefer that you give the example instead of us guessing what your problem is. You can read in the FAQ (black bar near the top of this page) how to include examples in Statalist posts.
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Hi Marten, thank you for the example! As I am no expert in stata, I struggle to understand some of the coding. Attached you see some of my coding

            Code:
            gen Type_SHAnoncum=id_dummy*SHA_noncum
            xtset CompanyID
            xtreg AR SHA_noncum Type_SHAnoncum id_dummy lnlag_TA lnlag_TQ lnlag_FS lag_ES lag_EnvC lnlag_Lev lnlag_EPI lag_MA i.Year i.country i.Industry, fe robust
            My data looks like this

            Code:
            * Example generated by -dataex-. For more info, type help dataex
            * dataex AR SHA_noncum Type_SHAnoncum id_dummy lnlag_TA lnlag_TQ lnlag_FS lag_ES lag_EnvC lnlag_Lev lnlag_EPI lag_MA
            clear
            input float AR byte(SHA_noncum Type_SHAnoncum id_dummy) float(lnlag_TA lnlag_TQ lnlag_FS) double(lag_ES lag_EnvC) float(lnlag_Lev lnlag_EPI lag_MA)
             -.5035108 0 0 0 23.06382 .8367327 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
               .189569 0 0 0 23.06382 .8291018 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
            -.14847651 0 0 0 23.06382 .8297931 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             .05390117 0 0 0 23.06382  .830485 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
              .3006188 0 0 0 23.06382 .8270307 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             -.7858446 0 0 0 23.06382 .8367327 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             -.8693554 0 0 0 23.06382 .8367327 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
            -1.8906157 0 0 0 23.06382 .8500522 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             -2.708171 0 0 0 23.06382 .8493468 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             -.9089404 0 0 0 23.06382 .8284109 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             -.8574428 0 0 0 23.06382 .8256523 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
              .4611022 0 0 0 23.06382 .8099362 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
             1.0687503 0 0 0 23.06382 .7991472 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 22.67
              .8297743 0 0 0 23.06382 .8025063 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
             1.1594446 0 0 0 23.06382 .7984768 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
             1.0472875 0 0 0 23.06382 .8004895 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              .8785231 0 0 0 23.06382 .8058767 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              .4838702 0 0 0 23.06382 .8099362 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
            -.22218686 0 0 0 23.06382 .8242759 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
            .069962375 0 0 0 23.06382 .8242759 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
             -.3847073 0 0 0 23.06382   .83187 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              5.510851 0 0 0 23.06382 .7772558 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
             4.6080093 0 0 0 23.06382   .78781 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
             4.6015625 0 0 0 23.06382 .7838391 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
               5.60394 0 0 0 23.06382 .7765998 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              5.496352 0 0 0 23.06382 .7746346 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              5.576267 0 0 0 23.06382 .7700639 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              6.295464 0 0 0 23.06382  .765514 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              5.753552 0 0 0 23.06382 .7687618 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
               6.44164 0 0 0 23.06382 .7596944 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              5.477427 0 0 0 23.06382 .7720202 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
               6.30439 0 0 0 23.06382 .7596944 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              7.685203 0 0 0 23.06382 .7443389 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              8.323714 0 0 0 23.06382 .7411694 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              7.727428 0 0 0 23.06382 .7545497 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514    72
              7.597378 0 0 0 23.06382 .7462456 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
              9.052268 0 0 0 23.06382 .7323477 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
              9.606473 0 0 0 23.06382 .7279658 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
             10.595018 0 0 0 23.06382  .715551 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
             11.068343 0 0 0 23.06382 .7069514 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
              10.08914 0 0 0 23.06382 .7180216 .19382916 89.3103448275862 55.6434091321965 -1.0068706 4.4367514 25.17
              .9609368 0 0 0 23.05861  .717769 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              .5075113 0 0 0 23.05861 .7171476 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
            -.06217903 0 0 0 23.05861 .7233783 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
            -.20037106 0 0 0 23.05861 .7199467 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             -1.712138 0 0 0 23.05861 .7305917 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              -2.67334 0 0 0 23.05861 .7290191 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             -2.425881 0 0 0 23.05861 .7265081 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             -2.270498 0 0 0 23.05861 .7199467 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             -1.006502 0 0 0 23.05861 .7171476 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             -.7428753 0 0 0 23.05861 .7162165 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              .6905561 0 0 0 23.05861 .7183906 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             1.2129912 0 0 0 23.05861 .7149762 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             1.8636075 0 0 0 23.05861 .7038821 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              1.804642 0 0 0 23.05861 .7041886 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              1.490185 0 0 0 23.05861 .7081817 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
              .8148921 0 0 0 23.05861 .7069514 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
            -.14444283 0 0 0 23.05861 .7081817 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 42.33
             1.1128076 0 0 0 23.05861 .6935161 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -2.4862695 1 0 0 23.05861 .7199467 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -4.822127 0 0 0 23.05861 .7423062 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
              -6.64156 4 0 0 23.05861 .7596533 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -7.362233 0 0 0 23.05861 .7697495 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -7.793421 0 0 0 23.05861 .7799487 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -7.815704 0 0 0 23.05861 .7786267 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -8.777262 0 0 0 23.05861 .7859188 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -9.652862 0 0 0 23.05861 .7919248 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -8.311827 1 0 0 23.05861 .7782965 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
             -9.126235 0 0 0 23.05861 .7835928 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.075876 0 0 0 23.05861 .7999893 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.410494 0 0 0 23.05861 .7983039 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
              -11.4535 1 0 0 23.05861 .7979671 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.515574 0 0 0 23.05861 .7993147 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.571014 0 0 0 23.05861 .8030304 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.230914 0 0 0 23.05861 .7979671 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -12.134645 1 0 0 23.05861 .8070996 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -11.150246 0 0 0 23.05861 .7946058 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -12.075734 0 0 0 23.05861 .8108443 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 68.42
            -12.477758 0 0 0 23.05861  .811868 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -11.780912 0 0 0 23.05861  .815288 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -10.141522 0 0 0 23.05861 .8149455 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -11.744015 0 0 0 23.05861 .8273509 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
             -1.417345 0 0 0 23.05861 .7993147 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -1.9687735 0 0 0 23.05861 .8077794 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -2.0427995 0 0 0 23.05861 .8187197 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
              -3.34163 0 0 0 23.05861 .8273509 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
             -1.373986 0 0 0 23.05861  .815288 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -1.0492202 0 0 0 23.05861 .8077794 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 51.67
            -1.7831786 0 0 0 23.05861 .8081195 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
            -1.1096886 0 0 0 23.05861 .7999893 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
              .3869569 0 0 0 23.05861 .7852536 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             -.3161664 0 0 0 23.05861 .7839248 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
            -.42666715 0 0 0 23.05861  .783261 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             -.2063328 0 0 0 23.05861 .7779664 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
            -.29135743 0 0 0 23.05861 .7816033 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             -.2134822 0 0 0 23.05861 .7799487 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             -.6064883 0 0 0 23.05861 .7859188 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             -.4754113 0 0 0 23.05861 .7835928 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
             1.1968244 0 0 0 23.05861 .7531934 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
              .5654885 0 0 0 23.05861 .7590054 .08719508 92.8571428571428 53.7526141683326 -1.0329735 4.3438053 17.17
            end

            I think I miss some parts but don't really understand how to fix it

            Comment


            • #7
              Maarten Buis I found your example very helpful. I have a very similar situation but where the continuous varibale is constant over time for each individual and the binary variable is time varying.
              I am not sure about how to interpret the results, can you confirm this for me please.

              Here are my results:

              Code:
              xtreg Y i.policy##c.income i.cycle, fe vce(robust)
              note: income omitted because of collinearity.
              
              Fixed-effects (within) regression               Number of obs     =      5,160
              Group variable: n_id                            Number of groups  =      2,434
              
              R-squared:                                      Obs per group:
                   Within  = 0.0034                                         min =          1
                   Between = 0.0083                                         avg =        2.1
                   Overall = 0.0067                                         max =          5
              
                                                              F(6, 2433)        =       1.51
              corr(u_i, Xb) = 0.0490                          Prob > F          =     0.1704
              
                                                   (Std. err. adjusted for 2,434 clusters in n_id)
              ------------------------------------------------------------------------------------
                                 |               Robust
                          Y | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
              -------------------+----------------------------------------------------------------
                      1.policy|  -.0178152   .0120316    -1.48   0.139    -.0414083     .005778
                         income|          0  (omitted)
                                 |
              Binary#c.income|
                              1  |   .0307093      .0393     0.78   0.435    -.0463557    .1077743
                                 |
                           cycle |
                              2  |   .0006845   .0068824     0.10   0.921    -.0128115    .0141806
                              3  |   .0021789    .008173     0.27   0.790    -.0138478    .0182056
                              4  |   .0069076   .0057975     1.19   0.234     -.004461    .0182763
                              5  |   .0058003   .0056149     1.03   0.302    -.0052102    .0168108
                                 |
                           _cons |   .7544982   .0069593   108.42   0.000     .7408515     .768145
              -------------------+----------------------------------------------------------------
                         sigma_u |  .14207905
                         sigma_e |  .09375382
                             rho |  .69665557   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------------
              Can I say that:
              • The effect of the policy is -0.017, when income is 0?
              • The effect of the policy is 0.03 for a 1 unit increase in income?? (I am not sure about this since income should be constant for a person)

              I appreciate your feedback.
              Best

              Comment

              Working...
              X