Announcement

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

  • mediation test for hierarchical data using gsem

    Hello,
    Can you please help with the mediation test for hierarchical data?

    Here are the variables:
    - y: binary outcome
    - m: binary mediator
    - x: binary treatment variable
    - c1, c2: covariates
    - pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).

    Before I ran the mediation test, I used mixed-effects models to examine X-Y association and X-M association. Then to investigate the possible mediation effect, I tried the mediate command below based on the recommendation of bootstrapping at https://library.virginia.edu/data/ar...ation-analysis.

    1. mediate (y c1 c2, logit) (m c1 c2, logit) (x), vce (bootstrap, cluster(pat_id) reps (500) seed (1234))
    Hello,
    Can you please help with the mediation test for hierarchical data?

    Here are the variables:
    - y: binary outcome
    - m: binary mediator
    - x: binary treatment variable
    - c1, c2: covariates
    - pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).

    However, vce(cluster) in mediate command cannot address the hierarchical data structure, so I tried gsem.
    2. gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)
    gsem, coeflegend
    *indirect effect
    nlcom _b[m:x]*_b[y:m]
    *total effect
    nlcom _b[y:x]+_b[m:x]*_b[y:m]

    From the results, I calculated the proportion of total effect mediated as indirect effect 1.000/ total effect 1.448*100, which equals 69%. Do you have any concerns regarding this proportion?
    Lastly, the bootstrapping takes very long. Do you have other suggestions?
    3. bootstrap , reps(500) seed(1234): gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)

    Thank you very much in advance.
    Jungwon


  • #2
    You have two challenges that you must address - 1) you have both a binary outcome and mediator and 2) you have multilevel data.

    On the first issue, you cannot use the traditional method of estimating indirect effects that you do with linear models (a*b paths). Instead, you need to use methods appropriate for your data. There are a couple of options - one is to use the built-in mediate command, which should appropriately use the correct decomposition for logit regressions. There are also user-written programs for this (seach khb; search ldecomp). In a prior thread on this topic, Maarten Buis links to relevant articles that detail the issues inherent in conducting mediation testing with binary mediators and outcomes.

    As to the second issue, you may have to settle for the approach of using single level regressions with standard error corrections for the multilevel data structure (vce (cluster pat_id)). While this is not a true multilevel approach, I would say that for many cases it will suffice. If you showed us a model that had multiple random intercepts and slopes, then I would be hesitant to suggest using the standard error correction approach. But you are showing a relatively straightforward, non-complex gsem statement.

    Comment


    • #3
      Erik Ruzek Thank you very much for your comments!

      Comment

      Working...
      X