Announcement

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

  • Direct effect, Indirect effect

    Hi all,
    I have to estimate the following equation:
    Yi = a + b1*DIVi + b2*NONi + Xi + ei (5)
    I would like to compute the direct and indirect effect after estimation, i.e. the impact of a change of NON on Y.
    In fact, DIV is a function of NON:
    DIV = 2*NON - 2*NON2 (6)
    So that, when we take derivative of (5), we have:
    dY/dNON = b1*dDIV/dNON + b2 (7)
    I estimate (5) by using -regress- . Thus, when we take derivative of (5) (dY/dNON), we will have b2 which is the direct effect of NON on Y, which is constant.
    However, how can I compute b1 by basing on the regression result of equation(5)?

    In fact, what I'm doing is to replicate the following study (http://www.sciencedirect.com/science...78426605001342) (The equations are in page 2144; and the table represent indirect and direct effect is in page 2149).
    By searching, I find that we can use SEM (http://www.stata.com/manuals13/sem.pdf), however, what the paper reports is not look like SEM, because the paper states that the direct and indirect effects are based on regression result (eq(5)).

    I'm looking forward to hearing your opinions!
    Thanks in advance.[INDENT=2] [/INDENT]

  • #2
    The paper you cite is gated, so I could not look at it. However, this is probably what they had in mind. It gives you the average marginal effect if mpg on price at the average value of mpg:

    Code:
    sysuse auto, clear
    set more off
    
    /* Method 1 */
    gen f_of_mpg = 2*mpg - 2*mpg^2
    reg price c.mpg c.f_of_mpg i.foreign
    margins, dydx(mpg) // direct
    margins, expression(_b[f_of_mpg]*(2-4*mpg)) at(mpg=(21.2973)) // indirect
    margins, dydx(mpg) // direct
    margins, expression(_b[mpg]+_b[f_of_mpg]*(2-4*mpg)) at(mpg=(21.2973)) // total
    
    /* Method 2 */
    clonevar mpg_direct = mpg
    constraint 1 mpg=-1*c.mpg#c.mpg
    cnsreg price mpg_direct c.mpg##c.mpg i.foreign, constraint(1) collinear coefl
    margins, dydx(mpg_direct mpg) post at(mpg=(21.2973)) // direct + indirect
    lincom _b[mpg_direct] + _b[mpg] // total
    I find the first way a little more general, but it involves doing calculus.

    Comment


    • #3
      Hi Dimitriy,
      Many thanks for your return. that is exactly what I need. I cannot edit my previous post, so that is the working version of this paper (http://citeseerx.ist.psu.edu/viewdoc...=rep1&type=pdf) (just in case you want to check), and the table that shows the direct and indirect effect is in page 27/31.

      I prefer the 1rst one since I also use -xtreg,fe-, which is likely not suitable with constraint.

      Just in case, I would like to ask why you use c.mpg and c.f_of_mpg in the 1rst method. I tried without c. , and the result still the same.

      Otherwise, why you set the constraint (1): mpg=-mpg2 ?

      Regards,

      David

      Comment


      • #4
        1) FE Panel data makes things more complicated because of the demeaning transformation and the interaction. You should have added that complication in the original post. I would use -xtdata- to check things.

        2) I like to be really explicit about what is continuous and what is categorical. In this simple problem, it does not matter. In more complicated model, it definitely does.

        3) In the unconstrained model, b1*2x - b2*2*x^2, which is equivalent to 2b*(x-x^2) if b1=-b2. The constraint forces that.

        Comment


        • #5
          Hi Dimitriy
          Many thanks for your help
          Regards,
          Dung

          Comment

          Working...
          X