Announcement

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

  • ivmediate with cluster

    Hello, everyone.
    I faced the problem of running ivmediate with the cluster.

    In ivreg2, I use the command :
    ivreg2 Y (X=Z), first cluster(id_district)

    where Y=outcome variable, X=variable of interest, Z=instrument variable.

    Then I need to use a mediator variable to explain the transmission from X to Y, but I still need to add cluster(id_district) in the analysis.
    While I'm running the command:

    ivmediate Y, med(mediator_variable) treat(X) inst(Z) full, cluster(id_district)

    But, it’s not working. Stata told it was an invalid 'cluster'.
    Fyi, I'm using stata 17 for windows with official license.

    Help me, please. I'm a newbie using this ivmediate command.

    Thanks a lot.

    Best regards,
    Shah Lya

  • #2
    Shah:
    welcome to this forum.
    As per FAQ, you're kindly requested to define community-contribute module like -ivmediate- as such. Thanks.
    That said, what if you code:
    Code:
    ivmediate Y, med(mediator_variable) treat(X) inst(Z) full, vce(cluster id_district)
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks, Carlo for your answer.

      But, it still told invalid 'vce'.

      Or probably is there another command that I have to install before running that ivmediate command? Please help.

      Best regards,
      Shah Lya

      Comment


      • #4
        Shah:
        I've just sniffed out the culprit: it's a trivial matter of comma:
        Code:
         
         ivmediate Y, med(mediator_variable) treat(X) inst(Z) full vce(cluster id_district)
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you very much, Carlo.

          It's now solved.

          Best regards,
          Shah Lya

          Comment

          Working...
          X