Announcement

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

  • Simple slope graph for mediation analysis in logistic regression

    Hi, Does anyone know how to plot simple slope graph for mediation analysis in logistic regression using STATA? x=continous m=continous y=dichotomous

    It seems hard to plot simple slope for logistic regression and even harder with a continous mediator.....
    ​​​​​​​

  • #2
    Hello Claire. Given that you want to plot simple slopes, I wonder if you mean moderation (i.e., interaction), not mediation. If you do, use -margins- with dydx, as in the examples shown on this UCLA web-page. E.g., with your variable names, something like this:

    Code:
    logit y c.x##c.m
    margins, dydx(x) at(m=(30(5)70)) vsquish predict(xb)
    marginsplot
    You didn't say what range of values your m variable can take. In that example, simple slopes for x are computed at m = 30, 35, 40, etc. up to 70. Modify the code as needed to choose the values of m for which you want simple slopes.

    Note too that I've added the predict(xb) option for -margins-, which is not done on that web-page. With that option, -margins- gives results on the log-odds scale rather than predicted probabilities (following -logit-). I prefer that, because then terms that are linear in the logit model look linear on the graph.

    If you really do mean mediation, then I don't understand why you are asking for simple slopes.

    HTH.
    --
    Bruce Weaver
    Email: [email protected]
    Version: Stata/MP 18.5 (Windows)

    Comment


    • #3
      Thank you very much for your help Mr Weaver!

      Comment

      Working...
      X