Announcement

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

  • #46
    It seems (at least) one of the studies has plenty of characters.

    Please read the FAQ. There you'l find how to share data\command\output\graphs.
    Best regards,

    Marcos

    Comment


    • #47
      Sara Ghaderi

      Your actual code looks fine to me. However, you do need to be careful with lower and upper case letters, and similar-looking characters such as I, l and 1. As it stands, your definitions (the first three lines) do not match with the names used in the final line. A possible corrected version is below:

      Code:
      gen double lHR=ln(HR)
      gen double ln_lci=ln(lci)
      gen double ln_uci=ln(uci)
      
      metan lHR ln_lci ln_uci, by(Level) eform effect(HR) xlabel(0.5, 5.5) force nooverall stats nosubgroup nobox nowt label(namevar=Condition) xtitle("Hazard ratio (95% CI)", size(small)) title("Diseases ", size(small))

      Jojanneke van Kooten

      A solution will almost certainly be possible, but as Marcos says, it would be helpful to see either a sample of your data and code, or alternatively to recreate your issue using a freely-available dataset such as the one supplied with metan.


      Thanks,

      David.

      Comment


      • #48
        Originally posted by David Fisher View Post
        Sara Ghaderi

        Your actual code looks fine to me. However, you do need to be careful with lower and upper case letters, and similar-looking characters such as I, l and 1. As it stands, your definitions (the first three lines) do not match with the names used in the final line. A possible corrected version is below:

        Code:
        gen double lHR=ln(HR)
        gen double ln_lci=ln(lci)
        gen double ln_uci=ln(uci)
        
        metan lHR ln_lci ln_uci, by(Level) eform effect(HR) xlabel(0.5, 5.5) force nooverall stats nosubgroup nobox nowt label(namevar=Condition) xtitle("Hazard ratio (95% CI)", size(small)) title("Diseases ", size(small))

        Jojanneke van Kooten

        A solution will almost certainly be possible, but as Marcos says, it would be helpful to see either a sample of your data and code, or alternatively to recreate your issue using a freely-available dataset such as the one supplied with metan.


        Thanks,

        David.
        Dear David,

        Thanks for Your answer! so this is a correct way of having my plot in log scale.
        And thanks for the remark. I have seen the mistake when I ran the code in stata.

        Best,
        Sara

        Comment


        • #49
          Hi! Ive gone through this entire thread and help material. I have figured out almost everything, so thank you!

          I'm stuck on one point: I have data with reference variable and I would like it to show up on as a dot on the reference plot and say reference in the OR (CI) column.

          I'm using Stata 15.2 - MP

          My data looks like this:


          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input str4 study byte(predno group) str21 predictor double(lnor lnlci lnuci) str6 pvalue double(or lci uci) str19 _EFFECT double(_ES _seES _LCI _UCI _WT) byte _rsample
          "dc"    1 1 "Stab"                                    0                   0                   0 ""          1    0     0 "(Insufficient data)"                   0                  .                   0                   0                  . 0
          "dc"    2 1 "Gun"                     .7275486072772777   .5007752879124892   .9555114450274363 "<0.001" 2.07 1.65   2.6 "2.07 (1.65, 2.60)"     .7275486072772777 .11600625335512492   .5007752879124892   .9555114450274363 23.997450481003785 1
          "dc"    3 2 "Commercial"                              0                   0                   0 ""          1    0     0 "(Insufficient data)"                   0                  .                   0                   0                  . 0
          "dc"    4 2 "Medicaid"              -.12783337150988489 -.40047756659712525  .13976194237515863 ".347"    .88  .67  1.15 "0.88 (0.67, 1.15)"   -.12783337150988489 .13781873372001333 -.40047756659712525  .13976194237515863  17.00244563514373 1
          "dc"    5 2 "Other Government"       -.4155154439616658 -1.0498221244986778  .22314355131420976 ".206"    .66  .35  1.25 "0.66 (0.35, 1.25)"    -.4155154439616658 .32474210900146094 -1.0498221244986778  .22314355131420976  3.062320853623977 1
          "dc"    6 2 "Self Pay"               -.4620354595965587  -.8675005677047231 -.05129329438755058 ".029"    .63  .42   .95 "0.63 (0.42, 0.95)"    -.4620354595965587 .20821996724310027  -.8675005677047231 -.05129329438755058  7.448745873293347 1
          "dc"    7 2 "Other/Unknown"           .1906203596086497 -.13926206733350766   .5247285289349821 ".266"   1.21  .87  1.69 "1.21 (0.87, 1.69)"     .1906203596086497 .16938846874380423 -.13926206733350766   .5247285289349821 11.255381536342462 1
          "dc"    8 3 "Stab#Commercial"                         0                   0                   0 ""          1    0     0 "(Insufficient data)"                   0                  .                   0                   0                  . 0
          "dc"    9 3 "Gun#Commercial"          .9202827531436925   .4824261492442928   1.358409157630355 "<0.001" 2.51 1.62  3.89 "2.51 (1.62, 3.89)"     .9202827531436925 .22346915945795554   .4824261492442928   1.358409157630355  6.466848913226217 1
          "dc"   10 3 "Stab#Medicaid"          .12221763272424911  -.3285040669720361   .5709795465857378 ".609"   1.13  .72  1.77 "1.13 (0.72, 1.77)"    .12221763272424911 .22946432196019576  -.3285040669720361   .5709795465857378   6.13334743682981 1
          "dc"   11 3 "Gun#Medicaid"            .6259384308664954  .19885085874516517  1.0508216248317612 ".003"   1.87 1.22  2.86 "1.87 (1.22, 2.86)"     .6259384308664954   .217343474881894  .19885085874516517  1.0508216248317612  6.836513770643987 1
          "dc"   12 3 "Stab#Other Government"  -.5108256237659907 -1.7147984280919266    .712949807856125 ".411"     .6  .18  2.04 "0.60 (0.18, 2.04)"    -.5108256237659907  .6193349100028931 -1.7147984280919266    .712949807856125   .841931550161769 1
          "dc"   13 3 "Gun#Other Government"    .5068176023684519  -.3011050927839216  1.3217558399823195 ".223"   1.66  .74  3.75 "1.66 (0.74, 3.75)"     .5068176023684519 .41400274330731623  -.3011050927839216  1.3217558399823195 1.8841760003246908 1
          "dc"   14 3 "Stab#Self Pay"           -.342490308946776 -1.0788096613719298   .3920420877760237 ".358"    .71  .34  1.48 "0.71 (0.34, 1.48)"     -.342490308946776 .37522417777822575 -1.0788096613719298   .3920420877760237 2.2937510279992077 1
          "dc"   15 3 "Gun#Self Pay"           .34358970439007686  -.2231435513142097   .9162907318741551 ".235"   1.41   .8   2.5 "1.41 (0.80, 2.50)"    .34358970439007686  .2906773522820004  -.2231435513142097   .9162907318741551  3.822130526192121 1
          "dc"   16 3 "Stab#Other/Unknown"       .131028262406404  -.4462871026284195   .7080357930536959 ".663"   1.14  .64  2.03 "1.14 (0.64, 2.03)"      .131028262406404  .2944755375066245  -.4462871026284195   .7080357930536959  3.724169672323977 1
          "dc"   17 3 "Gun#Other/Unknown"      1.1908875647772805   .7030975114131134  1.6770965609079151 "<0.001" 3.29 2.02  5.35 "3.29 (2.02, 5.35)"    1.1908875647772805 .24847371104203503   .7030975114131134  1.6770965609079151  5.230786722890927 1
          "dead" 18 4 "Stab"                                    0                   0                   0 ""          1    0     0 ""                                      .                  .                   .                   .                  . 0
          "dead" 19 4 "Gun"                     .6151856390902335  .29266961396282004   .9360933591703348 "<0.001" 1.85 1.34  2.55 ""                                      .                  .                   .                   .                  . 0
          "dead" 20 5 "Commercial"                              0                   0                   0 ""          1    0     0 ""                                      .                  .                   .                   .                  . 0
          "dead" 21 5 "Medicaid"               .22314355131420976  -.2231435513142097   .6729444732424258 ".319"   1.25   .8  1.96 ""                                      .                  .                   .                   .                  . 0
          "dead" 22 5 "Other Government"       .08617769624105241  -.7339691750802004   .9122827104766164 ".841"   1.09  .48  2.49 ""                                      .                  .                   .                   .                  . 0
          "dead" 23 5 "Self Pay"                .8796267475025636   .1570037488096647  1.3787660946990992 ".001"   2.41 1.17  3.97 ""                                      .                  .                   .                   .                  . 0
          "dead" 24 5 "Other/Unknown"           .6097655716208943  .10436001532424286  1.1249295969854831 ".019"   1.84 1.11  3.08 ""                                      .                  .                   .                   .                  . 0
          "dead" 25 6 "Stab#Commercial"                         0                   0                   0 ""          1    0     0 ""                                      .                  .                   .                   .                  . 0
          "dead" 26 6 "Gun#Commercial"          .6575200029167941 -.09431067947124129   1.410986973710262 ".088"   1.93  .91   4.1 ""                                      .                  .                   .                   .                  . 0
          "dead" 27 6 "Stab#Medicaid"          .44468582126144574  -.2484613592984996  1.1346227261911428 ".208"   1.56  .78  3.11 ""                                      .                  .                   .                   .                  . 0
          "dead" 28 6 "Gun#Medicaid"            .7371640659767196  .03922071315328133   1.430311246536665 ".037"   2.09 1.04  4.18 ""                                      .                  .                   .                   .                  . 0
          "dead" 29 6 "Stab#Other Government"  .12221763272424911 -1.1394342831883648  1.3635373739972745 ".852"   1.13  .32  3.91 ""                                      .                  .                   .                   .                  . 0
          "dead" 30 6 "Gun#Other Government"    .7466879474879751  -.4307829160924542   1.918392120161421 ".211"   2.11  .65  6.81 ""                                      .                  .                   .                   .                  . 0
          "dead" 31 6 "Stab#Self Pay"            .688134638736401 -.11653381625595151  1.4973884086254774 ".096"   1.99  .89  4.47 ""                                      .                  .                   .                   .                  . 0
          "dead" 32 6 "Gun#Self Pay"           1.6582280766035324   .9162907318741551  2.3997118037247684 "<0.001" 5.25  2.5 11.02 ""                                      .                  .                   .                   .                  . 0
          "dead" 33 6 "Stab#Other/Unknown"      .5128236264286637 -.31471074483970024    1.33500106673234 ".226"   1.67  .73   3.8 ""                                      .                  .                   .                   .                  . 0
          "dead" 34 6 "Gun#Other/Unknown"      1.3270750014599193   .5709795465857378  2.0844290831908747 ".001"   3.77 1.77  8.04 ""                                      .                  .                   .                   .                  . 0
          end

          I've also tried put in 1 instead of 0 in the lnor column for the reference variables

          The code I've used:
          admetan lnor lnlci lnuci if study=="dc", study(predictor) sortby(predno) ///
          by(group) eform effect(Odds Ratio) ///
          rcols(pvalue) nowt nooverall nosubgroup keepall keeporder ///
          forestplot(xlabel(0.1 0.2 0.5 1 2 5 10))

          Click image for larger version

Name:	Graph admentan.png
Views:	1
Size:	44.5 KB
ID:	1523936


          *AND

          forestplot lnor lnlci lnuci if study=="dc", labels(predictor) or nowt nobox keepall favours(Decreased odds#Increased odds) rcols(pvalue) leftjustify

          Click image for larger version

Name:	Graph.png
Views:	1
Size:	48.9 KB
ID:	1523935


          I like the grouping available for the 1st graph, but both have no dot and 'insufficient data' instead of reference.

          Thank you for any help and advice!
          Rachel
          Attached Files

          Comment


          • #50
            Hi Rachel,

            You are very nearly there!

            You just need to combine your two approaches: first, run admetan to set up the plot structure; but use the saving() option so that you can edit the text before plotting.

            That is:

            Code:
            . label variable predictor "Predictor"
            . label variable pvalue "P value"
            
            . admetan lnor lnlci lnuci if study=="dc", study(predictor) sortby(predno) ///
                by(group) eform effect(Odds Ratio) ///
                rcols(pvalue) nooverall nosubgroup keepall keeporder ///
                nograph saving(nygaard)
                
            . use nygaard, clear
            . replace _EFFECT = "Reference" if _USE==2
            . replace _USE=1 if _USE==2
            . format _EFFECT %-17s
            . forestplot, useopts xlabel(0.1 0.2 0.5 1 2 5 10) nostats nowt rcols(_EFFECT pvalue)

            By the way, thankyou for using dataex to supply your data. It looks like it is already in admetan/forestplot format, so depending on your original data structure, there may be quicker way of obtaining the plot that you want.

            Best wishes,

            David.

            Comment


            • #51
              Dear all,

              How does one run metaregression when using the metaprop command for meatanalysis?

              Comment


              • #52
                HI
                I am performing a meta-analysis of 5 studies with 4 subgroups of binary data. Metan is working for all models (OR, RR random, RR fixedi), but not for fixed risk ratio (default MH).
                I have used this syntax : metan n t2 N T2, rr fixed lcols (Study N T n t) label(namevar=Study)force xlab (.1 .5 1 2 4 10 20 50) by (type)
                But the risk ratios in all subgroups are 1 with different confidence intervals, which are not realistic values. Using a random model or Odds ratio gives more realistic results. However I want to use fixed RR and not others with short dealine.
                Anything wrong with syntax ? Any solution?

                Comment


                • #53
                  Hi Jawdat Abdulla ,

                  Could you provide a reproducible example using dataex? Do the variables n t2 N T2 represent, in this order: events in treated group; non-events (NOT totals!) in treated group; events in non-treated group; non-events in non-treated group?

                  The reason I say this, is that similar code using an example dataset seems to work OK:
                  Code:
                  use http://fmwww.bc.edu/repec/bocode/m/metan_example_data, clear
                  metan tdeath tnodeath cdeath cnodeath, rr fixed counts label(namevar=id) xlab(.1 .5 1 2 4 10 20 50) by(type_study)
                  (Also: I notice that, in your command, the variable Study appears both in the lcols() option and in the label() option, and hence may appear duplicated; and that the variables in the lcols() option are not the same as the "analysis" variables directly after "metan" ... though equally this may have been your intention of course!)

                  Thanks,

                  David.




                  Comment


                  • #54
                    Dear David
                    Thanks for your reply. This problem har emerged after I upgraded metan to version 4, I had no such stange results before.
                    n an N are events while t2 and T2 are no-events. Please see the syntax I have used below, and the output. You can notice that in each of these subgroups and the overall RR are = 1. When using Fixedi they are 3.17, 2.64, 7.01 and overal=3.04 which seem realistic.
                    I have meta-aanlysed five studies in 3 subgroups.

                    . metan n t2 N T2, rr fixed counts label(namevar=Study) xlab (.1 .5 1 2 4 10 20 50) by (type) keepall

                    Studies included: 14
                    plus 1 study with insufficient data
                    Participants included: 17430
                    plus 177 participants with insufficient data

                    Meta-analysis pooling of Risk Ratios
                    using the Mantel-Haenszel method

                    Continuity correction of 0.5 applied to studies with zero cells
                    for inclusion in summary table and forest plot (marked with *)
                    Mantel-Haenszel pooled effects are estimated from uncorrected counts

                    ---------------------------------------------------------------------------
                    | Risk
                    type and Study | Ratio [95% Conf. Interval] % Weight
                    ----------------------------+----------------------------------------------
                    Unplanned revascularization |
                    Aarhus | 13.934 1.755 110.650 4.82
                    NXT | 3.115 0.663 14.638 3.13
                    ADVANCE | 3.037 1.876 4.918 36.36
                    Vancouver | 3.353 0.989 11.372 3.93
                    PLATFORM | 1.565 0.226 10.854 1.16
                    |
                    Subgroup, MH | 1.000 0.797 1.255 49.40
                    ----------------------------+----------------------------------------------
                    Unplanned PCI |
                    Aarhus | 13.934 1.755 110.650 4.82
                    NXT | 0.890 0.128 6.197 0.89
                    ADVANCE | 2.475 1.496 4.094 28.06
                    Vancouver | 4.471 1.164 17.176 3.93
                    PLATFORM | 1.565 0.226 10.854 1.16
                    |
                    Subgroup, MH | 1.000 0.772 1.295 38.87
                    ----------------------------+----------------------------------------------
                    Unplanned CABG |
                    Aarhus * | 8.692 0.419 180.198 1.21
                    NXT * | 9.800 0.549 174.969 2.23
                    ADVANCE | 13.161 1.788 96.898 8.29
                    Vancouver * | 0.737 0.031 17.794 0.00
                    PLATFORM | (Insufficient data)
                    |
                    Subgroup, MH | 1.000 0.640 1.563 11.73
                    ----------------------------+----------------------------------------------
                    Overall, MH | 1.000 0.853 1.173 100.00
                    ---------------------------------------------------------------------------

                    Tests of subgroup effect size = 1:
                    Unplanned revascularizati z = 0.000 p = 1.000
                    Unplanned PCI z = 0.000 p = 1.000
                    Unplanned CABG z = 0.000 p = 1.000
                    Overall z = 0.000 p = 1.000


                    Mantel-Haenszel Q statistics for heterogeneity
                    (other heterogeneity measures are stored in matrices r(ovstats) and r(bystats))
                    -------------------------------------------------------------------------
                    Measure | Value df p-value I²
                    ----------------------------+--------------------------------------------
                    Unplanned revascularization | 32.67 4 0.000 87.8%
                    Unplanned PCI | 23.63 4 0.000 83.1%
                    Unplanned CABG | 10.80 3 0.013 72.2%
                    Overall | 67.10 13 0.000 80.6%
                    Between | 0.00 2 1.000
                    -------------------------------------------------------------------------
                    Note: between-subgroup heterogeneity calculated using MH subgroup weights

                    Note: with metan version 4 and above, the preferred syntax is for options such as xlab(.1 .5 1 2 4 10 20 50)
                    to be supplied as sub-options to the forestplot() option; see help metan


                    Comment


                    • #55
                      Dear David
                      And this is the graph.
                      Attached Files

                      Comment


                      • #56
                        Dear Jawat,
                        Thankyou for the output and graph.
                        I have identified the bug -- it was actually very simple, and I'm annoyed at myself for not picking it up earlier! Looking at my validation script, I can see several scenarios very similar to yours were tested, but not one quite similar enough. Anyway: I will try to get an updated, corrected version released in the next few days.
                        Sorry for the inconvenience.
                        Best wishes,
                        David.

                        P.S. Am I right in saying that your data represent multiple outcomes from the same studies? (rather than e.g. patient subgroups or similar) If so, presumably in your final analysis you will not want to have the "overall" pooled result; you can remove this with the option "nooverall".

                        Comment


                        • #57
                          Thanks David
                          I have solved the problem by using "admetan".
                          Yes, I removed the overall by using command "overall"
                          Best
                          Jawdat

                          Comment


                          • #58
                            Dear David
                            I have a fruther question on the same meta-analysis and need your help. I wanted to proceed with the analysis to perform a dose-response analysis, but I am surprised for the findings in the variable columns, where the lower CI and upper CI do not match those of the RR in output and graph, surprisingly the Low CI is negative, which makes a log tranoformation not possible. However, the CI limits in the output and in the graph seem correct. How can this be explained ? Any solution ? It is the same whether usin matan or admetan commans.
                            F.exp. a RR of 2.32 (CI 0.525 - 10.278) gets a CI of (LCI -.64484261 UCI 2.3300265) in the varibale columns ? An so on for alle RR.
                            Best
                            Jawdat

                            Comment


                            • #59
                              Dear Jawdat,

                              Thankyou for your message. The new variables that (ad)metan leaves behind in your dataset (named _ES, _seES, _LCI, _UCI and so on) will always be on the normal/interval scale; that is, on the number line from negative-infinity to positive-infinity. For ratio statistics (Odds Ratio, Relative Risk, Hazard Ratio) this means that, for example, _ES contains the log RR. This explains why some of the values in _LCI are negative: they correspond to values less than 1 on the RR scale. This is explained in the Stata help file under the section "Saved Results". The reason for doing this, is so that the results of any analysis are always stored on the same scale, and have consistent interpretations. So, for instance, when forestplot reads in the values, by default it will plot them on the log-scale and the confidence intervals will be symmetric; and you can transform them back to the RR scale with the "eform" option (or similar). Similarly, the variables _ES and _seES allow you to construct confidence intervals reliably, and/or to derive test statistics such as z = _ES/_seES.

                              To answer the other query in your email (by the way: sorry for the late response, it has just been Easter weekend, with public holidays on both Friday and Monday) : you are correct, I have not yet been able to update the code to correct the bug you previously identified. I am very sorry for this, and will try to update the code within the next two weeks. In the meantime, you could see if the older command metan9 suits your needs; it has almost the same syntax as (ad)metan and much the same basic functionality. I can also help you to use this command if you encounter any problems.

                              Best wishes,

                              David.


                              P.S. I have just noticed that I mis-spelled your name in a previous message on this thread; my apologies for that also!
                              Last edited by David Fisher; 06 Apr 2021, 03:23.

                              Comment


                              • #60
                                Dear David
                                Thank you very much for your detailed answer and appreciate much your fantastic backup.
                                Best
                                Jawdat

                                Comment

                                Working...
                                X