Announcement

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

  • mediation package: medsens command and why it does not function

    Dear All,

    I am at the moment using the mediaton package (Hicks and Tingley, 2011) to conduct a causal mediation analysis. I need to conduct a sensitivity test with the command medsens following the medeff command for causal mediation analysis. However, for some strange reason, Stata 14 does not give me the full results, with this following error message:

    "You must have moremata installed to run this program
    net install moremata.pkg
    r(198);

    end of do-file

    r(198);""

    In fact, I do have moremata installed, as if I do run the command "net install moremata.pkg", it gives me the following message:
    checking moremata consistency and verifying not already installed...
    all files already exist and are up to date.


    I would be so grateful if you could tell me how to solve this problem.

    Thanks a million beforehand.

    Best,

    Marie

  • #2
    I hope someone could help me out with this. Thank you.

    Comment


    • #3
      So I'm running Stata 16 and ran the following code from the article after installing the mediation package and moremata and it ran without complaint.

      Code:
      . set seed 312789
      . local n 2000
      . set obs `n'
      . local alpha_2 .25
      . local alpha_3 .25
      . local beta_2 .25
      . local beta_3 .25
      . local gamma .25
      . local x_beta .25
      . matrix m = (0,0,0)
      . matrix sd = (1,1,1)
      . drawnorm e1 e2 x, n(`n') means(m) sds(sd)
      . generate T = round(runiform(), 1)
      . generate M = `alpha_2' + `beta_2'*T + `x_beta'*x + e1
      . generate Y = `alpha_3' + `beta_3'*T + `gamma'*M + `x_beta'*x + e2
      medeff (regress M T x) (regress Y T M x), treat(T) mediate(M) sims(1000)
      medsens (regress M T x) (regress Y T M x), treat(T) mediate(M) sims(100)

      Comment


      • #4
        Thank you, Dave. But it does not with my real data, and I have no idea why.

        Comment


        • #5
          You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Replicating the problem is often essential to fixing it.

          It is hard to diagnose such problems without running the procedure. First, check that you are using the most recent version of medsens and moremata. Second, you may have the moremata files in the wrong subdirectory. You'll have to read the Stata documentation or the medsens ado file to find out where such files are supposed to be. From the age of the program, I would think it would run in Stata 14, but you might try upgrading to 16 or running it on someone else's machine that has 16. With a user written procedure, you may need to contact the authors.

          Comment

          Working...
          X