Announcement

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

  • Using probability weights in medeff mediation analysis

    I am conducting a mediation analysis in stata v.17.0. I am using the medeff command. My data set, which is made up of a cohort of 600 young people has three survey time points. The loss to follow-up is about 50%. In order to account for this loss-to-follow-up, I am attempting to use probability weights within my medeff command, however I am receiving an error and am unsure how to successfully include these weights.

    I have tried numerous ways of including it in the code, often receiving the error invalid syntax. An example is below.

    Code:
    medeff (regress depression_m3 foodsec1) (probit anyhhviol_m6 foodsec1 depression_m3 interact_m_e) [pweight], treat(foodsec1 0 1) mediate(depression_m3)  vce(robust) level(95) interact(interact_m_e) ipw(ipw)
    When I tried it this way, I received an error saying 'ipw unknown weight type'

    Code:
    medeff (regress depression_m3 foodsec1) (probit anyhhviol_m6 foodsec1 depression_m3 interact_m_e) [ipw], treat(foodsec1 0 1) mediate(depression_m3)  vce(robust) level(95) interact(interact_m_e)
    Any insights into this issue would be greatly appreciated!

  • #2
    medeff is not an official Stata command, so I cannot comment on its specific usage as I have never used it. See guidelines on how to state the provenance of community-contributed commands in FAQ Advice #12. If the command does allow weights, the syntax


    medeff (regress depression_m3 foodsec1) (probit anyhhviol_m6 foodsec1 depression_m3 interact_m_e) [ipw], treat(foodsec1 0 1) ...
    is incorrect. You need something like

    Code:
    medeff (regress depression_m3 foodsec1) (probit anyhhviol_m6 foodsec1 depression_m3 interact_m_e) [pw=ipw], treat(foodsec1 0 1) ...
    for probability weights. See

    Code:
    help weights

    Comment


    • #3
      Thank you, Andrew. That ran.

      Comment

      Working...
      X