Announcement

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

  • Codes for analyzing Mediating Effect

    Dear Stata experts,

    I am trying to analyze the mediating effect of my variables and am stuck with problems.


    Here are my variables:

    - Dependent variable: binary variable

    - Independent variable: categorical variable (average weekly work hours; 4 categories)

    - Mediator variable: ordinal variable (level of individual income; 3 categories)

    - A bunch of control variables


    I am doing a logistic regression analysis and want to find if "income" mediates the relationship between work hours and my dependent variable.

    Since my variables are not continuous, I need to apply different codes but I am struggling with finding the proper ones.

    Could you help me fix this?

    Much appreciated in advance.

  • #2
    you don't really provide enough information but you should start with
    Code:
    help mediate
    you might also want to look at example 42g in the SEM help:
    Code:
    h sem
    and click on examples and scroll down

    if these do not prove sufficient, please read the FAQ and follow its advice

    Comment


    • #3
      Rich Goldstein has given you good advice about mediation. I want to address something else I noticed in your question. Because you are estimating a logistic regression model (presumably binary logistic regression?), and because you intend to include "a bunch of control variables", you must pay attention to the number of events (not observations) per model parameter* if you want to reduce the likelihood of overfitting. See the following links for more info. * The rule of thumb for binary logistic regression is often expressed in terms of events per variable (EPV). But as that BMJ article clarifies, it should be expressed as events per (model) parameter (EPP). See the Moving beyond the 10 events per variable rule of thumb section. I hope this helps.
      --
      Bruce Weaver
      Email: [email protected]
      Version: Stata/MP 19.5 (Windows)

      Comment


      • #4
        I suggest using the khb ado, the handling is as follows:

        Code:
        ssc install khb, replace
        khb logit depvar i.indepvar || i.mediator, concomitant(control1 control2)
        Best wishes

        Stata 18.0 MP | ORCID | Google Scholar

        Comment

        Working...
        X