Announcement

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

  • causal mediation analysis with multiple mediators and binary outcome

    MY DATA

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(serialnumber age) double bmi byte(baseline_anxiety previous_caesarean intraopeativepain max_pain_72h_postop max_pain_6weeks depression_scores_6weeks chronicpain_6months)
     1 31 29.4 4 0 1 5 2  0 0
     2 26 37.7 4 0 0 5 2  0 0
     3 24   30 2 0 1 6 2  8 1
     4 24 25.5 4 0 0 3 0  0 0
     5 26 28.3 2 1 0 3 2  3 0
     6 38   29 0 1 0 4 2  3 0
     7 30 25.5 3 0 0 3 1  4 0
     8 24 30.8 1 1 0 3 1  2 0
     9 24 28.8 4 1 1 6 2  0 1
    10 20 26.5 2 0 0 4 0  0 0
    11 23 27.6 3 0 1 5 2  0 1
    12 35 28.7 2 0 0 4 1  0 0
    13 36 33.6 0 1 1 5 0  0 1
    14 29 24.7 2 0 0 3 2  0 0
    15 36 29.9 4 1 0 5 2  0 0
    16 33 27.3 0 0 1 6 2 10 1
    17 30 31.6 3 0 0 4 0  0 0
    18 24 27.5 0 1 0 5 1  0 0
     .  .    . . . . . .  . .
    end



    I am conducting a causal mediation analysis using the latest version of STATA (v19) to examine the relationship between intraoperative pain during surgery and the development of chronic pain 6 months post-surgery (binary outcome). I am interested in assessing whether this relationship is mediated by two variables: (1) maximum pain at 72 hours post-surgery and (2) maximum pain at 6 weeks post-surgery.

    I would also like to account for potential confounders, including age, BMI, preoperative anxiety, and postoperative depression. However, I have noticed that the mediate command in STATA only allows for a single mediator at a time.

    please advise whether there is an alternative method in STATA that allows for multiple mediators, and if so, provide guidance or example commands on how to implement this?

    Thank you very much in advance for your help.
    Asish

  • #2
    What exactly are your estimands? Which causal framework are you referring to? I suggest you have a look at the KHB approach as a first starting point. Maybe, this is also sufficient for you.
    https://www.stata.com/meeting/german...g11_kohler.pdf
    https://journals.sagepub.com/doi/pdf...867x1101100306

    The basic syntax is as follows:
    Code:
    khb logit chronicpain_6months intraopeativepain || max_pain_72h_postop max_pain_6weeks ///
        , conc(age bmi baseline_anxiety previous_caesarean depression_scores_6weeks) summary dis
    However, this will produce an error message because KHB, for some reason, has problems with long variable names. Please rename your variables and then estimate the model, for example:
    Code:
    rename chronicpain_6months outcome
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Dear Felix Bittmann Sir,
      thank you for your inputs. As suggested, I ran the khb command and obtained the following results. I would like to know whether there is significant mediating effect of the pain score at 72 hours and 6 weeks between intraoperative pain (exposure variable) and the outcome (chronic pain). How should I interpret these results...specifically, total effect, direct effect and indirect effect (through the mediators). Also, is it possible to convert the coefficient into odds ratio?

      [CODE]
      . khb logit CPSP_6MONTH INTRAOP_PAIN || MAXPAIN_72HRS MAXPAIN_6WKS, conc(AGE BMI ANX_preop cs PND_6WKS) summary dis

      Decomposition using the KHB-Method

      Model-Type: logit Number of obs = 417
      Variables of Interest: INTRAOP_PAIN Pseudo R2 = 0.63
      Z-variable(s): MAXPAIN_72HRS MAXPAIN_6WKS
      Concomitant: AGE BMI ANX_preop cs_previous PND_6WKS
      ------------------------------------------------------------------------------
      CPSP_6MONTH | Coefficient Std. err. z P>|z| [95% conf. interval]
      -------------+----------------------------------------------------------------
      INTRAOP_PAIN |
      Reduced | 7.180087 1.037467 6.92 0.000 5.146689 9.213486
      Full | 2.606331 .7092965 3.67 0.000 1.216136 3.996527
      Diff | 4.573756 .8918175 5.13 0.000 2.825826 6.321686
      ------------------------------------------------------------------------------

      Summary of confounding

      Variable | Conf_ratio Conf_Pct Resc_Fact
      -------------+-------------------------------------
      INTRAOP_PAIN | 2.7548638 63.70 1.5720464
      ---------------------------------------------------

      Components of Difference

      Z-Variable | Coef Std_Err P_Diff P_Reduced
      -------------+---------------------------------------------
      INTRAOP_PAIN |
      MAXPAIN_72~S | 1.680911 .766881 36.75 23.41
      MAXPAIN_6WKS | 2.892845 .936705 63.25 40.29
      -----------------------------------------------------------
      /CODE]




      thank you in advance. Asish
      Last edited by Asish Subedi; Today, 03:06.

      Comment


      • #4
        Dear Felix Bittmann Sir,
        thank you for your inputs. As suggested, I ran the khb command and obtained the following results. I would like to know whether there is significant mediating effect of the pain score at 72 hours and 6 weeks between intraoperative pain (exposure variable) and the outcome (chronic pain). How should I interpret these results...specifically, total effect, direct effect and indirect effect (through the mediators). Also, is it possible to convert the coefficient into odds ratio?

        Comment


        • #5
          Lets start here:
          Code:
          Model-Type: logit Number of obs = 417
          Variables of Interest: INTRAOP_PAIN Pseudo R2 = 0.63
          Z-variable(s): MAXPAIN_72HRS MAXPAIN_6WKS
          Concomitant: AGE BMI ANX_preop cs_previous PND_6WKS
          ------------------------------------------------------------------------------
          CPSP_6MONTH | Coefficient Std. err. z P>|z| [95% conf. interval]
          -------------+----------------------------------------------------------------
          INTRAOP_PAIN |
          Reduced | 7.180087 1.037467 6.92 0.000 5.146689 9.213486
          Full | 2.606331 .7092965 3.67 0.000 1.216136 3.996527
          Diff | 4.573756 .8918175 5.13 0.000 2.825826 6.321686
          ------------------------------------------------------------------------------
          This table reports ORs. The baseline effect of INTRAOP_PAIN on the outcome variable has the OR of 7.18. This means that patients with intraop pain have an OR that is 7.18 times higher for post-surgery pain. In the model that includes both mediators, this effect is reduced to an OR of 2.60. This means, when considering the mediators, the main effect is reduced. This means that a mediation is present. As the p-value of the difference statistic (4.57) is very low, this means that the mediation effect is statistically significant.
          Code:
          Variable | Conf_ratio Conf_Pct Resc_Fact
          -------------+-------------------------------------
          INTRAOP_PAIN | 2.7548638 63.70 1.5720464
          This part shows that the share mediated through both mediators amounts to about 63.70 percent (indirect effect divided by the total effect).
          Finally, we can test how the mediation part is decomposed among the 2 mediators.

          Code:
          Z-Variable | Coef Std_Err P_Diff P_Reduced
          -------------+---------------------------------------------
          INTRAOP_PAIN |
          MAXPAIN_72~S | 1.680911 .766881 36.75 23.41
          MAXPAIN_6WKS | 2.892845 .936705 63.25 40.29
          -----------------------------------------------------------
          The first variable explains 23.41% of the total share mediated, the second one 40.29% (note that the sum of the two is the total share mediated). This means that the second mediator is more relevant than the first one.

          Best wishes

          Stata 18.0 MP | ORCID | Google Scholar

          Comment


          • #6
            Dear Felix Bittmann Sir,
            Thank you for the invaluable suggestion. I still have a few questions:
            1. In the first table, does the coefficient value (for example, 7.10) represent the odds ratio or log-odds? If not, how can the coefficient values be converted into odds ratios? I am new to this area, so I would appreciate your expert clarification.
            2. In the second table, what does the conf_ratio value of 2.75 indicate?
            Thank you in advance.

            Comment

            Working...
            X