Announcement

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

  • Edit forest plot, admetan

    Dear Statalist,

    I have made a forest plot using admetan, and I wish to edit the output. I have searched this site, but I haven't come up with an answer yet. I've tried different options using codes from other analyses (not admetan).

    I would like the lines to be thinner, and I would like the subgroup title to appear in bold or italic. Can the appearance of the arrows be changed as well? Lastly, is it possible to remove the subtitle "Subgroup and Variable"?


    Code:
    admetan lnor lnlci lnuci, study(variable) eform effect(OR) by(subgroup)  ///
         nowt nooverall keeporder keepall forestplot(nobox nosubgroup favours(Decreased Risk#Increased Risk) ///
      xlabel(0.2 0.5 1 2 5) cirange(.2 5))
    Click image for larger version

Name:	1.png
Views:	1
Size:	79.4 KB
ID:	1489495



    Thank you in advance,

    Best regards,
    Katrine

  • #2
    Dear Katrine,

    Regarding making the subgroup headings bold or italic, and changing the subtitle "Subgroup and Variable", you might find this recent post useful: https://www.statalist.org/forums/for...n-forest-plots

    Appearance of lines and arrows may be changed using standard Stata "twoway" options. See for example help connect_options (for lines) or help twoway_pcarrow (for arrowheads).

    I hope that helps!

    Best wishes,

    David.

    Comment


    • #3
      Dear David,

      Thank you so much for your help - again. It certainly did the trick.

      Best regards,
      Katrine

      Comment


      • #4
        Dear David,

        I am so sorry to bother you again. But is it possible to change the order of the subgroups and not have the default as alphabetical?

        I have tried to use sortby(var) in admetan, but it is overruled. I have tried to generate a variable sorting the outcome after admetan and before forestplot, but it doesn't seem to work either. I cannot seem to find the right phrase using "h forestplot" or "h admetan"

        Thank you,
        Best regards,
        Katrine

        Comment


        • #5
          Dear Katrine,

          Oddly enough you're not the first person to ask about the sortby() option recently... I should update the help file to make it clearer.

          sortby() changes the order of the studies, but not the subgroups. To change the ordering of subgroups you need to use encode or recode (or an equivalent strategy).

          For instance, if your subgroups are A and B, but you want B to appear before A, you could use:

          Code:
          ** If "subgroup" is string:
          label define neworder 1 "B" 2 "A"
          encode subgroup, gen(newsubgroup) label(neworder)
          
          ** Or if "subgroup" is numeric:
          recode subgroup (1=2 "A") (2=1 "B"), gen(newsubgroup) label(neworder)

          Hope that helps,

          David.

          Comment


          • #6
            Dear David,

            Thank you - again. I am sorry if you have answered the very same question in another post. I really try to look the other posts through before asking.

            Best regards,
            Katrine

            Comment


            • #7
              David Fisher

              This post has finally been what I've been searching for! As to Katrine's question above regarding sorting the subgroups, I'm having an issue where -admetan- is sorting my studies alphabetically, despite numerous attempts at getting them to sort either in the default order of the data, or by using a variation of bygroup(sort_var), but to no avail. Can you please help me get my groups out of alphabetical order? I don't have this issue with -metan- but then I lose the ability to bold the headings...


              Unable to delete... I wasn't able to fix it in the code, but with a little manipulation with labels I was able to make it work. Would still be interested why the default is alphabetical with string variables rather than the order in the dataset. Thank you!
              Last edited by Chelsea Lutz; 11 Feb 2022, 13:53.

              Comment


              • #8
                Hi Chelsea,
                I'm afraid I'm a little uncertain as to whether you have an issue with the ordering of studies or with subgroups. However, the most important thing to say is that admetan is now deprecated, in favour of an updated version of metan (latest version 4.05 29nov2021, from SSC). This should respect your bolded headings,
                and also should now sort both studies and subgroups (if string-valued) according to the ordering in the dataset, unless overruled by user-specified options. If you are still having trouble, please let me see a sample of data (e.g. using dataex) and code which recreates the problem.
                Best wishes,
                David.

                Comment

                Working...
                X