Announcement

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

  • gformula mediation

    Hi all,


    I am trying to perform a mediation analysis using the gformula package in stata, but I am having issues with my boostrapping.

    My dataset contains 189 observations. Exposure = w1RD (binary indicator), Mediator = w2CR_lg_postorth, (continuous), Outcome = w3smoking (binary indicator). I have two intermediate confounders (i.e. variables which confound the mediator and outcome relationship but are predicted by the exposure), I also have 5 baseline confounders.

    This is my gformula code (without imputation for the time being):
    gformula w1RD_bin w3smoking w2CR_lg_postorth w1sex w1age w2smoking w2bingedrinking w1smoking w1house_inc w1degreestat ,mediation exposure(w1RD_bin) mediator(w2CR_lg_postorth) outcome(w3smoking) base_confs(w1sex w1age w1smoking w1house_inc w1degreestat) post_confs( w2smoking w2bingedrinking ) obe equations(w3smoking: i.w1RD_bin w2CR_lg_postorth i.w1sex w1age i.w2smoking i.w2bingedrinking i.w1smoking w1house_inc w1degreestat , w2CR_lg_postorth: i.w1RD_bin i.w1sex w1age i.w2smoking i.w2bingedrinking i.w1smoking w1house_inc w1degreestat, w2smoking: i.w1RD_bin w1age i.w1sex w1house_inc i.w1smoking w1degreestat, w2bingedrinking: i.w1RD_bin w1age i.w1sex i.w1smoking w1house_inc w1degreestat) commands(w3smoking: logit, w2CR_lg_postorth: regress, w2smoking: logit, w2bingedrinking: logit ) simulations(100) samples(1000) seed(8)


    This code will return estimates, however on the boostrapping output it states that an error occurred when boostrapping.

    Bootstrapping:
    (running gformula_ on estimation sample)

    Bootstrap replications (1,000): .........10.........20.........30.........x..x.... ..50.........60....xxx..70.........80..
    > ...x...90...x.....100..x......110......x..120.x... ..x.130.x..x..x.140.xx......150.........160..x..x. ..x.........180....
    > ..x..190..x....xx200..x......210x........220...... ..x230..x......240...x.....250...x.x...260........ .270.........280...
    > ......290.........300.........310.........320..x.. ...x330.......x.340....x...x350.........360....... ..370.........380..
    > x......390x...x....400.x.......410.........420.... .....430........x440.......x.450.........460...x.. x..470.........480.
    > ........490.........500....x....510.........520... x.....530.........540x........550.........560..... ..x.570....x...x580
    > ...x.....590....x....600.........610.......x.620.. .......x....x....640.x...xx..650.........660...... ...670.........680.
    > ...x....690......x..700x........710.......x.720... ......730.........740.....x...750.........760x.... ....770........x780
    > .........790.....x...800..x......810.........820.. .......830.........840.........850x..x.....860.... .....870.........88
    > 0.........890.........900.....x...910........x920. ........930....x...x940.........950.........960.x. ......970......x..9
    > 80.........990.....x...1,000 done
    x: Error occurred when bootstrap executed gformula_.

    I thought this may be due to my outcome (w3smoking) having a low prevalence (39 smokers out of 189). So i checked this by running a simple logistic regression with w3smoking as my outcome, including all my exposure, mediator and confounders and then boostrapped this : ( bootstrap, reps(200) seed(123): logit w3smoking i.w1RD_bin w2CR_lg_postorth i.w1sex i.w1age i.w1smoking i.w2smoking i.w1housinc_quart i.w2bingedrinking

    This returned the error message: Bootstrap replications (200): xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxx done
    x: Error occurred when bootstrap executed logit.
    insufficient observations to compute bootstrap standard errors; no results will be saved


    To my understanding, this affirms my assumption that the boostrapping in failing due to a 'rare' outcome. I then reran this model unadjusted (just exposure and mediator and no confounders) and the boostrapping worked successfully. However, this is not a sufficient conceptual model to run due to the presence of confounding, particularly intermediate confounding.


    Does this mean I am essentially unable to use gformula to test my mediation model?

    Any guidance is greatly appreciated.


  • #2
    Given the complexity of your model and the low number of obs, I think you cannot do much. The failure rate in the bootstrap setup seems acceptable to me. Prop it up to 2k total reps and go with this.
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Hi Felix,

      Thanks so much for your reply.

      Does this mean it is then appropriate to interpret the results of this mediation model, despite the bootstrapping failure rate?

      Moreover, are you aware of any formal guidance around acceptable bootstrapping failure rate?

      Evie

      Comment


      • #4
        Bootstrapping only concerns the inference, so point estimates should be fine. I would transparently report how many resamples contributed to the CIs. Maybe the final result is a bit off, but given the sample size the precision of your findings is limited anyway. I am not aware of a concrete rule, but anything above 80% success seems acceptable.
        Best wishes

        Stata 18.0 MP | ORCID | Google Scholar

        Comment

        Working...
        X