Announcement

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

  • How to edit color separately in the graph of meta-analysis

    Dear all,

    Now I get the graph of meta-analysis, but I found that I can't edit color by group, e.g., every group of symbol of marker or variable name. Anyone knows how to edit color separately in the graph of meta-analysis?



    Best regards,
    Raoping

  • #2
    Dear Raoping,

    Could you clarify which meta-analysis command you are using? Even better, could you supply the actual command line?

    Also, are you trying to alter colours using command options, or "post-hoc" using the Graph Editor?

    Thanks,

    David.

    Comment


    • #3
      Originally posted by David Fisher View Post
      Dear Raoping,

      Could you clarify which meta-analysis command you are using? Even better, could you supply the actual command line?

      Also, are you trying to alter colours using command options, or "post-hoc" using the Graph Editor?

      Thanks,

      David.
      Hi, David, my command as following:
      metan Beta lowerci upperci, label(namevar=Population) by(data) fixed effect(β) xlabel(-0.3,0.8) nowt nooverall null(0) lcols(Population) nosubgroup

      I am trying to alter colours either command options or graph editor.


      Thank you!
      Raoping

      Comment


      • #4
        Originally posted by David Fisher View Post
        Dear Raoping,

        Could you clarify which meta-analysis command you are using? Even better, could you supply the actual command line?

        Also, are you trying to alter colours using command options, or "post-hoc" using the Graph Editor?

        Thanks,

        David.
        Code:
        metan Beta lowerci upperci, label(namevar=Population) by(data) fixed effect(β) xlabel(-0.3,0.8) nowt nooverall null(0) lcols(Population) nosubgroup
        Thank you, David

        Best regards,
        Raoping

        Comment


        • #5
          Dear Raoping,

          Thanks, that's helpful.

          If you don't mind, I'm going to replace your command line with a very similar one based on the example data provided within the metan package. This means that I can see the data (as can anyone else who reads the thread):

          Code:
          use http://fmwww.bc.edu/repec/bocode/m/metan_example_data
          gen Beta = log(OR)
          gen Betalci = log(ORlci)
          gen Betauci = log(ORuci)
          metan Beta Betalci Betauci, label(namevar=id) by(type_study) fixed effect(β) nowt nooverall null(0) lcols(id) nosubgroup nohet
          As you discovered, although you can change the different graph elements independently (e.g. diamonds, confidence intervals), you cannot specify different colours by group:
          Code:
          metan Beta Betalci Betauci, label(namevar=id) by(type_study) fixed effect(β) nowt nooverall null(0) lcols(id) nosubgroup nohet ciopt(lcolor(red)) boxopt(mcolor(blue))

          There are various other limitations of metan, and unfortunately it is no longer maintained. Therefore, a few years ago I began developing an alternative meta-analysis command, based on metan, but which has improved capabilities. This command is named admetan, but currently it is bundled with another command of mine, ipdmetan (which performs IPD meta-analysis). But in the future I plan to release admetan separately. In the meantime, you can install both commands by typing:

          Code:
          ssc describe ipdmetan
          ssc install ipdmetan
          Once installed, you can alter colours by group using the plotid() option, which defines the regions of the graph to be coloured differently. You then use, e.g. ci1opt(), ci2opt() etc. instead of just ciopt() as before:

          Code:
          admetan Beta Betalci Betauci, study(id) by(type_study) fe effect(β) nowt nooverall nosubgroup plotid(type_study) forestplot(ci1opt(lcolor(red)) box1opt(mcolor(red)) ci2opt(lcolor(blue)) box2opt(mcolor(blue)))

          All this is explained in the help files, obtained by typing help admetan or help forestplot at the command line; but please ask if anything is unclear.

          Best regards,

          David.



          Comment


          • #6
            Originally posted by David Fisher View Post
            Dear Raoping,

            Thanks, that's helpful.

            If you don't mind, I'm going to replace your command line with a very similar one based on the example data provided within the metan package. This means that I can see the data (as can anyone else who reads the thread):

            Code:
            use http://fmwww.bc.edu/repec/bocode/m/metan_example_data
            gen Beta = log(OR)
            gen Betalci = log(ORlci)
            gen Betauci = log(ORuci)
            metan Beta Betalci Betauci, label(namevar=id) by(type_study) fixed effect(β) nowt nooverall null(0) lcols(id) nosubgroup nohet
            As you discovered, although you can change the different graph elements independently (e.g. diamonds, confidence intervals), you cannot specify different colours by group:
            Code:
            metan Beta Betalci Betauci, label(namevar=id) by(type_study) fixed effect(β) nowt nooverall null(0) lcols(id) nosubgroup nohet ciopt(lcolor(red)) boxopt(mcolor(blue))

            There are various other limitations of metan, and unfortunately it is no longer maintained. Therefore, a few years ago I began developing an alternative meta-analysis command, based on metan, but which has improved capabilities. This command is named admetan, but currently it is bundled with another command of mine, ipdmetan (which performs IPD meta-analysis). But in the future I plan to release admetan separately. In the meantime, you can install both commands by typing:

            Code:
            ssc describe ipdmetan
            ssc install ipdmetan
            Once installed, you can alter colours by group using the plotid() option, which defines the regions of the graph to be coloured differently. You then use, e.g. ci1opt(), ci2opt() etc. instead of just ciopt() as before:

            Code:
            admetan Beta Betalci Betauci, study(id) by(type_study) fe effect(β) nowt nooverall nosubgroup plotid(type_study) forestplot(ci1opt(lcolor(red)) box1opt(mcolor(red)) ci2opt(lcolor(blue)) box2opt(mcolor(blue)))

            All this is explained in the help files, obtained by typing help admetan or help forestplot at the command line; but please ask if anything is unclear.

            Best regards,

            David.


            Hi, David, thanks so much for your detailed explanation. I follow your instructions, but still have some questions: 1. How to delete the shadow of
            symbol of marker (box)? 2. How to apply xlable(-0.3,08)? 3. How to delete "Type of study" in "Type of study and study identifier"?

            Thank you !


            Best regards,
            Raoping

            Comment


            • #7
              Dear Raoping,

              Sorry for the delay, I've been away at a conference. To answer your questions:

              1. If you simply wish to remove the "shadows" (weighted boxes), you can specify the option nobox as a suboption to forestplot(). If instead you wish to have different sized boxes according to the precision of each estimate, but not necessarily as grey "shadows", you can alter the shape, colour etc. using the suboptions boxopts(), box1opts(), box2opts() etc. as appropriate.

              2. x-axis labelling works in the same way as any other twoway plot. To apply your requested labelling, use xlabel(-0.3 0.8) as a suboption to forestplot() [Note the lack of commas between values!]. Also note the range() suboption if you wish to adjust the look of the x-axis relative to other plot elements without altering the labelling.

              3. The text "Type of study" is taken from the variable label of the by() variable type_study. In your own dataset and code, the by() variable is called data, and so you will see the variable label (if any) of data appearing in the forest plot.

              Hope that helps!

              Thanks,

              David.

              Comment


              • #8
                Originally posted by David Fisher View Post
                Dear Raoping,

                Sorry for the delay, I've been away at a conference. To answer your questions:

                1. If you simply wish to remove the "shadows" (weighted boxes), you can specify the option nobox as a suboption to forestplot(). If instead you wish to have different sized boxes according to the precision of each estimate, but not necessarily as grey "shadows", you can alter the shape, colour etc. using the suboptions boxopts(), box1opts(), box2opts() etc. as appropriate.

                2. x-axis labelling works in the same way as any other twoway plot. To apply your requested labelling, use xlabel(-0.3 0.8) as a suboption to forestplot() [Note the lack of commas between values!]. Also note the range() suboption if you wish to adjust the look of the x-axis relative to other plot elements without altering the labelling.

                3. The text "Type of study" is taken from the variable label of the by() variable type_study. In your own dataset and code, the by() variable is called data, and so you will see the variable label (if any) of data appearing in the forest plot.

                Hope that helps!

                Thanks,

                David.
                No problem! Thank you so much! For the third answer, it means that I can't delete it ?
                "Type of study and study identifier" is a bit too long.


                Raoping

                Comment


                • #9
                  Dear Raoping,

                  To clarify: with the by() option specified, the program takes the variable labels from the study() and by() variables, and automatically forms the string "by_variable_label and study_variable_label" to use as a heading in the on-screen table and in the forest plot.

                  Hence, if this string is too long, one solution is to re-label these variables with short names such as "Subgroup" and "Study", as follows:
                  Code:
                  label variable type_study "Subgroup"
                  label variable id "Study"
                  admetan Beta Betalci Betauci, study(id) by(type_study)


                  If this isn't satisfactory, then admetan allows you to manually control what information appears on the plot (which is, after all, just a twoway plot underneath!).
                  To do this, we save the "results set" file, open it, edit the variable label, and then run the forestplot command. For example:

                  Code:
                  admetan Beta Betalci Betauci, study(id) by(type_study) fe nooverall nosubgroup saving(myfile.dta)
                  use myfile.dta, clear
                  label variable _LABELS "Short title"
                  forestplot, effect(β) nowt plotid(_BY) ci1opt(lcolor(red)) box1opt(mcolor(red)) ci2opt(lcolor(blue)) box2opt(mcolor(blue))
                  (Note that this code refers to variables named _LABELS and _BY, which are names used by admetan and forestplot to format the data for plotting. You can see what function they have by looking at the data in myfile.dta)

                  Hope that helps,

                  David.

                  Comment


                  • #10
                    Originally posted by David Fisher View Post
                    Dear Raoping,

                    To clarify: with the by() option specified, the program takes the variable labels from the study() and by() variables, and automatically forms the string "by_variable_label and study_variable_label" to use as a heading in the on-screen table and in the forest plot.

                    Hence, if this string is too long, one solution is to re-label these variables with short names such as "Subgroup" and "Study", as follows:
                    Code:
                    label variable type_study "Subgroup"
                    label variable id "Study"
                    admetan Beta Betalci Betauci, study(id) by(type_study)


                    If this isn't satisfactory, then admetan allows you to manually control what information appears on the plot (which is, after all, just a twoway plot underneath!).
                    To do this, we save the "results set" file, open it, edit the variable label, and then run the forestplot command. For example:

                    Code:
                    admetan Beta Betalci Betauci, study(id) by(type_study) fe nooverall nosubgroup saving(myfile.dta)
                    use myfile.dta, clear
                    label variable _LABELS "Short title"
                    forestplot, effect(β) nowt plotid(_BY) ci1opt(lcolor(red)) box1opt(mcolor(red)) ci2opt(lcolor(blue)) box2opt(mcolor(blue))
                    (Note that this code refers to variables named _LABELS and _BY, which are names used by admetan and forestplot to format the data for plotting. You can see what function they have by looking at the data in myfile.dta)

                    Hope that helps,

                    David.
                    Great! Many thanks for your detailed explanation!


                    Best,
                    Raoping

                    Comment

                    Working...
                    X