Announcement

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

  • Mediation analysis with -gsem-

    Dear all,
    I am doing a mediation analysis with -gsem- in Stata 15. The sem model includes models that are analysed with different methods: linear regression and fractional response models. The coefficients from these models are interpreted differently. In the return scalar lines below, coefficients from these different kinds of analyses are multiplied. Is this acceptable?
    Code:
    capture drop program bootcm
    
    program bootcm, rclass
    mi estimate, cmdok post: gsem (logAs logHg logCd logMn logPb c.Se_std##c.Se_std i.Maternal_edu i.Sex -> PCT_5mC if ADHDfrac!=., nocapslatent) /*
    */ (c.logAs##c.logAs c.logHg##c.logHg logCd logMn logPb Se_std i.Maternal_edu i.Sex PCT_5mC MADHD_SS Age_in_days -> ADHDfrac, family(binomial) link(logit)) (PCT_5mC -> ADHDfrac, family(binomial) link(logit)), vce(robust)
     
      return scalar logCd_indirect_PCT_5mC    = _b[PCT_5mC:logCd]*_b[ADHDfrac:PCT_5mC]
      return scalar logHg_indirect_PCT_5mC    = _b[PCT_5mC:logHg]*_b[ADHDfrac:PCT_5mC]
      return scalar logMn_indirect_PCT_5mC    = _b[PCT_5mC:logMn]*_b[ADHDfrac:PCT_5mC]
      return scalar logPb_indirect_PCT_5mC    = _b[PCT_5mC:logPb]*_b[ADHDfrac:PCT_5mC]
      return scalar Se_std_indirect_PCT_5mC    = (_b[PCT_5mC:Se_std]+_b[PCT_5mC:c.Se_std#c.Se_std])*_b[ADHDfrac:PCT_5mC]
      return scalar logAs_indirect_PCT_5mC    = _b[PCT_5mC:logAs]*_b[ADHDfrac:PCT_5mC]
    
    end
    
    bootstrap  r(logCd_indirect_PCT_5mC)r(logHg_indirect_PCT_5mC)r(logMn_indirect_PCT_5mC)r(logPb_indirect_PCT_5mC)r(Se_std_indirect_PCT_5mC)r(logAs_indirect_PCT_5mC) if PCT_5mC!=.&ADHDfrac!=., ///
       reps(500) nodots: bootcm
    
    estat boot, bc percentile

  • #2
    Put in a simpler way , is it possible to do mediation analysis with gsem when the mediator is continuous and the dep var is either a fraction or categorical with more than two categories ?

    Comment


    • #3
      You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Use line continuations to keep your program on one screen - reading your statement as posted is quite difficult. You've complicated your life by including MI along with the gsem. Often it is easiest to diagnose one part of a program by simplifying to what is essential to that part of the program. After you get that right, you can add complication.

      If you don't have standard linear models in all the equations, you cannot simply multiply parameters. At least one equation is logistic, i.e., not linear, so the multiplications don't work.

      I would guess mediation is feasible with binary variables, but I'm not sure about dvs with more than two not ordered values. The manual deals with moderation - have you looked at it carefully? It might address non-linear equations. Have you searched Statalist and googled it? I haven't done it, but I suspect that margins would help here.

      Comment

      Working...
      X