Announcement

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

  • KHB method for mediation analysis

    Dear all,
    I came across the KHB method for mediation analysis. I have gone through the paper “Comparing coefficients of nested nonlinear probability models” but I couldn’t figure out (after trying many times) the command in the ordered outcome section which is as shown below:


    . forv i = 1/3 { 2. quietly eststo: khb ologit edu fses || abil, outcome(`i´) ape > summary 3. }

    . esttab, scalars("ratio_fses Conf.-Ratio" "pct_fses Conf.-Perc.")


    I use an ordered logit as my dependent variable has 6 outcomes(which are educational levels) and I have a number of control variables too.

    Dependent variable = isced1997_r

    Independent variable= i.sl_hs045d2

    Mediator= i.sl_cs010

    Control variables = i.dn042, i.dn003, i.cs009, i.cs008.


    I use this command:

    . forv i = 1/6 { 2. quietly eststo: khb ologit isced1997_r i.sl_hs045d2 || i.sl_cs010, outcome(`i´) ape > summary 6. }

    . esttab, scalars("ratio_ i.sl_hs045d2 Conf.-Ratio" "pct_ i.sl_hs045d2 Conf.-Perc.")


    But get this message- program error: code follows on the same line as open brace

    I will really appreciate your guidance on inputting this in Stata in order to get the analysis done. Many thanks.



  • #2
    I have no idea what eststo and khb are, but Stata is telling you what's wrong. Maybe try something like this
    Code:
    forvalues i = 1/6 {
        quietly eststo: khb ologit isced1997_r i.sl_hs045d2 || i.sl_cs010, outcome(`i´) ape > summary
    }
    esttab, scalars("ratio_ i.sl_hs045d2 Conf.-Ratio" "pct_ i.sl_hs045d2 Conf.-Perc.")
    The phrase in red-colored font doesn't look kosher, either, and maybe you want something like if ape > summary just before the comma, but as I said, I'm not familiar with the command, and maybe it's okay.

    Comment

    Working...
    X