Announcement

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

  • interpretation of interaction effect in OLS regression with log transformed dep var

    Dear Stata Listers,

    I am using linear regression with a logged dependent variable because of heteroskedasticity in the residuals of my preferred model, which most likely comes from my highly right skewed dependent variable. Generally the interpretation of the coefficients of the main effect in the log model is clear to me (use of exponentiated coeff, interpret in terms of percentage change), but with interaction effect it seems to become much more difficult and I am not sure if I got it right. For me the major problem seems to be how to calculate a meaningfull average marginal effect
    Here a simple examle using the auto data

    Code:
    sysuse auto, clear
    gen lnprice=ln(price)
    recode rep78 (1 2 3=0) (4 5=1) // generate a dummy variable
    reg lnprice  i.rep78##i.foreign  //dummy interaction
    
    margins, dydx(foreign) at(rep78=(0 1))  //conditional AME
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    1.foreign    |
             _at |
              1  |  -,1839331   ,2363194    -0,78   0,439    -,6558956    ,2880293
              2  |   ,0954846   ,1506598     0,63   0,528    -,2054038    ,3963729
    ------------------------------------------------------------------------------
    If I exponentiate the conditional AME, does this produce a meaningfull average marginal effect for the non-linear modell with logged dep var? Can it be interpreted as the average effect of foreign for different levels of rep78 in terms of percentage change?
    e.g. For low repair record a change from domestic to foreign results in 17% lower price (exp(-0.18)-1)*100=-16.5

    I dont know if this really makes sense, but I have no other idea. Any comments and suggestions are very welcome!
    PS: I am aware of the pros and cons of using a logged dep var but I would still like to know if there is a way to do this

  • #2
    I'm sure there' s someone out there who could directly answer your question about how to interpret the interaction with some simple English. While I'm not that guy, I suggest you follow the advice given frequently on this forum to plot the interaction using marginsplot. I think this is a case where a picture is worth 1,000 words. The specific interpretation of the interaction coefficients isn't so important when you can see the relationships.

    Comment


    • #3
      Thanks for your comment lance erickson. To me your english sounds great (I am not a native speaker). Generally I agree that plotting interactions is a good idea . But I need to figure out what to plot and at the moment it is not clear to me what that would be.

      Comment


      • #4
        Jasmin:
        at the moment I do not have the time to delve into interpretation details, but i do hope that adding the -allbaselevels- option as well as -marginsplot- (as Lance suggested) to your code may help you out:
        [CODE][sysuse auto, clear
        gen lnprice=ln(price)
        recode rep78 (1 2 3=0) (4 5=1)
        reg lnprice i.rep78##i.foreign, allbasel
        margins, dydx(foreign) at(rep78=(0 1))
        marginsplot /CODE]
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you very much, Carlo. Maybe I need to explain better what bothers me. I am not interested in the interpretation of the original coefficients which can be interpreted as the expected change in the log of y, but in the expected change in y itself. For this purpose the coefficients have to be exponentiated and can be interpreted as percentage change. With marginal effects and average marginal effects I feel it becomes more complicated. In an older statalist post on a similiar question Maarten Buis points suggests to avoid marginal effects in log-linear regression because it is "suprisingly difficult" http://www.stata.com/statalist/archi.../msg00311.html
          This is one of the reasons why I am concerned if the procedure I described above (#1) is correct. If it really is, I can calculate the AME and plot it as suggested by Lance and Carlo.
          Looking forward to your comments

          Comment


          • #6
            Jasmin:
            I would say that you can skip -margin- and focus on the regession coefficients only, as:
            - coefficient for Foreign=-.1839331 (same as margins 1.foreign at _1);
            - coefficient 1#Foreign (i.e., 2794177) + coefficient Foreign (i.e.-.1839331) gives you 0954846 (same as margins 1.foreign at _2).
            These results echo what you obtained in your procedure detailed in #1.

            Code:
            . sysuse auto, clear
            (1978 Automobile Data)
            
            . 
            . gen lnprice=ln(price)
            
            . 
            . recode rep78 (1 2 3=0) (4 5=1) 
            (rep78: 69 changes made)
            
            . 
            . reg lnprice i.rep78##i.foreign, allbasel
            
                  Source |       SS       df       MS              Number of obs =      69
            -------------+------------------------------           F(  3,    65) =    0.35
                   Model |  .164068364     3  .054689455           Prob > F      =  0.7872
                Residual |  10.0733777    65  .154975042           R-squared     =  0.0160
            -------------+------------------------------           Adj R-squared = -0.0294
                   Total |  10.2374461    68  .150550678           Root MSE      =  .39367
            
            -------------------------------------------------------------------------------
                  lnprice |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
                    rep78 |
                       0  |          0  (base)
                       1  |   -.051333    .135193    -0.38   0.705    -.3213321    .2186662
                          |
                  foreign |
                Domestic  |          0  (base)
                 Foreign  |  -.1839331   .2363194    -0.78   0.439    -.6558956    .2880293
                          |
            rep78#foreign |
              0#Domestic  |          0  (base)
               0#Foreign  |          0  (base)
              1#Domestic  |          0  (base)
               1#Foreign  |   .2794177   .2802592     1.00   0.322    -.2802986     .839134
                          |
                    _cons |   8.644066   .0647187   133.56   0.000     8.514814    8.773319
            -------------------------------------------------------------------------------
            
            . 
            . margins, dydx(foreign) at(rep78=(0 1)) 
            
            Conditional marginal effects                      Number of obs   =         69
            Model VCE    : OLS
            
            Expression   : Linear prediction, predict()
            dy/dx w.r.t. : 1.foreign
            
            1._at        : rep78           =           0
            
            2._at        : rep78           =           1
            
            ------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
            1.foreign    |
                     _at |
                      1  |  -.1839331   .2363194    -0.78   0.439    -.6558956    .2880293
                      2  |   .0954846   .1506598     0.63   0.528    -.2054038    .3963729
            ------------------------------------------------------------------------------
            Note: dy/dx for factor levels is the discrete change from the base level.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X