Announcement

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

  • How can I test the meditation effect for count models (i.e. poisson, negative binomial)

    Dear statisticians,

    I want to test whether a variable M plays a mediating role in the effect of X on Y. I know it is quite easy to use medeff command in Stata, but the problem is that the response variable Y is a non-negative one, meaning a count model is more appropriate. Thus, medeff command cannot help.

    How can I test the (causal) meditation effect in this situation using Stata? Looking forward to your insightful comments. Thank you in advance!

  • #2
    Sorry, there was a typo. It should be “mediation effect”.

    Comment


    • #3
      With the caveat that I don't know much about mediation, maybe you could approach this using gsem?

      Perhaps something along the lines of
      Code:
      quietly sysuse auto
      gsem ///
          (price <- c.(displacement gear_ratio), family(nbinomial mean) link(log)) ///
              (displacement <- c.gear_ratio, family(lnormal) link(log)), ///
                  nodvheader nolog

      Comment


      • #4
        Huan Li I didn't find a package for count outcomes but I did find this research poster you should look at: https://citeseerx.ist.psu.edu/viewdo...=rep1&type=pdf David MacKinnon is a recognized expert in mediation analysis. It looks like the two most common methods of estimating indirect effects produce distinct results when the dependent variable is a count. It's possible that this is the reason the medeff command only handles linear and dichotomous outcomes.

        Comment


        • #5
          I also dont know what "mediation effects" are (every field tries to introduce as much jargon as possible to restrict entry), but from your verbal description, this is probably doing the trick:

          Code:
          poisson Y c.M##c.X, robust

          Comment


          • #6
            That's just testing for an interaction, right? That wouldn't tell you whether M explains part or all of the effect of X on Y. It only tells you whether the relationship between X and Y depends on M, which is a test of moderation not mediation.

            Comment


            • #7
              You might reach out to Kristian Karlson ([email protected]) about the 'khb' Stata command and whether the author advises its use with count outcomes or has any suggestions for other approaches

              Comment


              • #8
                Originally posted by Tom Scott View Post
                You might reach out to Kristian Karlson ([email protected]) about the 'khb' Stata command and whether the author advises its use with count outcomes or has any suggestions for other approaches
                Thank you so much, Tom! The poster is really great but my problem will be a little more complex because the mediator is also a count variable. I will try to reach out to Dr. Karlson.

                Comment


                • #9
                  Many thanks for Joseph's and Joro's sharing!

                  Comment


                  • #10
                    Originally posted by Huan Li View Post
                    . . .my problem will be a little more complex because the mediator is also a count variable.
                    Then you might want to look seriously into gsem inasmuch as it can fit generalized linear models in the context of structural equation models, including path analyses, which is what mediation seems to involve.

                    Toward that end, I was able to replicate the major finding of the Coxe & MacKinnon poster whose URL Tom posted in #4. See the attached do-file and log-file below. (I used the same upper-case alphabetical letters that they used in order to make following the output easier.) I extended the replication to include fitting the analogous path analysis model using gsem—its a × b estimate is identical to the one obtained by the conventional three-regression-model approach that Coxe & MacKinnon used.

                    Originally posted by Tom Scott View Post
                    It looks like the two most common methods of estimating indirect effects produce distinct results when the dependent variable is a count.
                    Tom, I think that they explain why there's a difference, and they advocate for the a × b estimate as the one to use in the context of count models.

                    Originally posted by Joro Kolev View Post
                    I also dont know what "mediation effects" are (every field tries to introduce as much jargon as possible to restrict entry), but from your verbal description, this is probably doing the trick
                    Joro, it's the same misconception that I had; take a look at the link I inserted into #3 above if you want me to share that piece of humble pie with you.

                    Coxe &amp; MacKinnon.do
                    Coxe &amp; MacKinnon.smcl
                    Click image for larger version

Name:	N100.png
Views:	1
Size:	25.6 KB
ID:	1579823
                    N = 100
                    Click image for larger version

Name:	N250.png
Views:	1
Size:	24.4 KB
ID:	1579824
                    N = 250
                    Click image for larger version

Name:	N500.png
Views:	1
Size:	22.6 KB
ID:	1579825
                    N = 500
                    I had to remove the N = 1000 graph, because the forum software allows up to only five attachments. It slightly deviates from the trend of the other three in that the cc′ estimate (blue line in the graphs above) begins to diverge again slightly, but the findings shown in the poster are broadly replicated.
                    Attached Files

                    Comment

                    Working...
                    X