Announcement

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

  • Metan code: How can I put the value of the average effect size in the x-axis?

    I am using the metan to create this forest plot . what statement should I use to put 0.033 (the average effect size) in the x-axis (under the dotted red line, see attached image) Click image for larger version

Name:	Screen Shot 2023-01-02 at 4.38.37 AM.png
Views:	1
Size:	57.7 KB
ID:	1695618 ? Thank you all.

  • #2
    Dear Khalid,
    I recently did this but I used meta instead of metan, since metan gave me formatting issues. But I dont know if you have a version of Stata that can run meta?

    For meta it would be something like

    Code:
    meta     esize nc meanc sdc nt meant sdt ,  esize(hedgesg) studylabel(Author)  //calculate your own mean, sd and n for control and treatment, use "author" as studylabel and whatever effectsize you are interested in
    
    meta forestplot , ///
             esrefline(lp(dash)) /// <--- this is part that inserts the mean as a line, and here it is dashed
             title("{bf:Hemorrhagic events...}: ") ///
             subtitle("{it:Aspirin and Trigacelor}") ///
             name(p1, replace)
    I hope this can be helpful

    If you can run meta in your stata version, there is a good example video here from stataCorp LLC:
    https://www.youtube.com/watch?v=8zzZojXnXJg
    and
    Code:
    help meta
    Last edited by Anne Dam; 02 Jan 2023, 06:49. Reason: include videoexample

    Comment


    • #3
      KHALID MEDANI
      Here is one way of doing it. I've based the code on the first example from the metan help pages, but it should be fairly straightforward for you to modify for your own use case.
      Here's how it works:
      1) The first call to metan carries out the meta-analysis and prepares the forest plot but does not draw it; but it saves the plot text size in a local macro.
      2) The second call to metan adds the extra tick-line and text to the plot, using the saved text size to make it consistent with the rest of the plot.
      You may need to play around with the twoway options tlength() (and possibly also tlabgap()) to get it looking right. Let me know if you have any issues.

      Code:
      use http://fmwww.bc.edu/repec/bocode/m/metan_example_data, clear
      metan tdeath tnodeath cdeath cnodeath, rd random label(namevar=id, yearvar=year) counts forestplot(nodraw savedims(myplotdims))
      local textsize = myplotdims[1, "textsize'"]
      qui metan tdeath tnodeath cdeath cnodeath, rd random label(namevar=id, yearvar=year) counts forestplot(xmlabel(`r(eff)', tlength(*6) labsize(`textsize') format("%05.3f")) xlabel(,format("%03.1f")))

      Anne Dam
      As co-author and maintainer of the metan package, I was interested to read your comment. Could you explain a little more what you mean by "metan gave me formatting issues"? In particular, are you using a version of metan released since the end of 2019? Thanks!

      Comment


      • #4
        Hi David Fisher
        Yes of course, I just saw your message. I will have to dig up my old data and old plot to re-create the issue so it will take some more time. I will send you a message, since I'm never sure how to find this post again, once it has disappeared from the first page under the 'General' Forum..

        Comment

        Working...
        X