Announcement

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

  • #16
    .
    Last edited by David Fisher; 12 Dec 2016, 03:16. Reason: double post

    Comment


    • #17
      Hi Virginia,

      Great to hear you're making progress!

      It's hard to know for sure, but I suspect your "type mismatch" error might also be solved by running the entire block of code in one go? (or at least, onwards from the comment "obtain the interaction p-value and store it in a local macro".) Local macros stop being defined as soon as you stop running the code.

      As for the means and SDs in the plot, could I ask whether you tried running the code I provided on the example dataset, and whether it gave the expected result (in particular, with different means and SDs in each group)? If so, then the next step will be to look at your code -- could you copy and paste the relevant section? Also, to check what values for the means and SDs should be reported in the plot, you could use tabstat. This is a check that your dataset really does contain the data you expect. For instance, with the example dataset I would type the following, which recreates the figures in the plot:

      Code:
      tabstat bwt if smoke==1, by(agecat) s(n mean sd)
      tabstat bwt if smoke==0, by(agecat) s(n mean sd)
      For your example, I would guess that the code would be:
      Code:
      tabstat lnPeakAST if ArmRandomised==1, by(Donor_Type) s(n mean sd)
      tabstat lnPeakAST if ArmRandomised==0, by(Donor_Type) s(n mean sd)

      Hope this helps,

      Thanks,

      David.

      Comment


      • #18
        Hi David,

        Apologies for reopening this post but 2 years later I'm still having the same issue but on a different study.
        I am now using Stata 15 so all updates should be in place but I still get the question marks in front of the figures in the "No. pts" column. I've tried your previous suggestion (which worked 2 years ago on Stata 14) of typing "ssc install ipdmetan, replace" and it does replace the files but when I re-run the ipdover command this no longer works and gives the error:
        no observations
        r(2000);


        Do you know if there is another way of removing those question marks in the figures for the Number of patients column in the forest plot?

        Many thanks,

        Virginia

        Comment


        • #19
          Hi Virginia,

          Sorry to hear you are still having difficulties with ipdmetan.

          My first suggestion is to double-check that Stata is running the correct version. Type which ipdmetan into the Stata command window; it should say v3.0 Nov 2018. You could also double-check that no other copies of ipdmetan.ado, admetan.ado or forestplot.ado are present in any of the directories within Stata's "adopath" (that is, the directories in which Stata expects to find code); type adopath to see this.

          If no problems are found, would it be possible to share your data and code? If the data is confidential or otherwise protected, could you share a random, anonymised sample? (as long as the error is still seen, of course!). If not, are you to able recreate the error using an alternative dataset, e.g. the one used in the ipdmetan help file?

          Regards,

          David.

          Comment


          • #20
            Thanks, David.

            I checked the version and, indeed, it was not the latest version but after typing "ssc install ipdmetan, replace" it does show *! version 3.0 David Fisher 08nov2018.
            However, it's with this latest version that I get the error (no observations r(2000) whenever I try run the ipdover command which executed worked previously.

            The command is the following:
            ipdover, over( EN_CENTRE_ID ) forest(favours(Favours Co-amoxiclav # Favours Placebo) xsize(10) range(-3 3) xlabel(-2 (1) 2)): mepoisson CSMI rand_grpx || EN_CENTRE_ID:, vce(robust) irr

            I've rerun it using the dataset from the ipdmetan help file and replacing EN_CENTRE_ID with region, CSMI with fail, rand_grpx with trt, and I get exactly the same error r(2000).


            Re the adopath, I've checked the various folders but I only found one copy of ipdmetan.ado.


            Kindest regards,

            Virginia

            Comment


            • #21
              Hi Virginia,

              Ah, sorry, I misunderstood. Your issue is not to do with the question-marks at all.

              This is a model specification issue. If you run mepoisson CSMI rand_grpx || EN_CENTRE_ID:, vce(robust) irr , you are fitting a single model to the entire dataset with a random intercept on EN_CENTRE_ID.

              Meanwhile, ipdover works by fitting the specified model in turn to each of the data subgroups identified by over(). In other words, ipdover is attempting to fit:
              Code:
              . mepoisson CSMI rand_grpx if EN_CENTRE_ID==1  || EN_CENTRE_ID:, vce(robust) irr
              . mepoisson CSMI rand_grpx if EN_CENTRE_ID==2  || EN_CENTRE_ID:, vce(robust) irr
              ...
              ...and so on, looping over all the values of EN_CENTRE_ID.

              This fails because a random intercept model cannot be fitted within a data subgroup in which EN_CENTRE_ID does not vary. Notice that if you run any of the lines in the above code block, they do not give you interpretable coefficients. This is what the error r(2000) "no observations" is telling you: that ipdover cannot identify any interpretable coefficients to work with.

              Your random-intercept mepoisson model is fitted to the entire dataset and gives you a single estimate of the effect of rand_grpx on CSMI, taking account of the random effect of EN_CENTRE_ID. By contrast, ipdover gives you multiple estimates of the effect of rand_grpx on CSMI, one estimate for each value of EN_CENTRE_ID. They are different models, and tell you different things.

              You may wish to include all these results in the same forest plot. By default, the "overall" effect (with the diamond) with ipdover is simply the specified model fitted to the entire dataset ... but note that this will omit the random intercept (in favour of a single intercept for all levels of EN_CENTRE_ID). Hence, a little more work is needed:

              Code:
              use http://fmwww.bc.edu/repec/bocode/i/ipdmetan_example.dta, clear
              
              // First, fit the random-intercept model.
              // The model coefficients will be retained in memory until you next fit a regression ("e-class") model.  ipdover will not change them.
              mepoisson fail trt || region:, vce(robust)
              
              // Next, use ipdover. Don't plot the graph yet; instead save the data in "forestplot format" (see help admetan or help forestplot)
              // Note there is no need to use mepoisson (as no random intercept); poisson will do
              // (you may want to add robust SEs though, that's up to you)
              ipdover, over(region) nogr saving(myfile) : poisson fail trt
              
              // Load the saved dataset and insert the coefficients from the random-intercept model
              // (for your own model, if you're not sure what the coefficient names are, type "mepoisson, coeflegend")
              // (note also that forestplot needs the **confidence limits**, not the standard error)
              use myfile, clear
              replace _ES = _b[trt] if _USE==5
              replace _LCI = _b[trt] - invnorm(.975)*_se[trt] if _USE==5
              replace _UCI = _b[trt] + invnorm(.975)*_se[trt] if _USE==5
              replace _LABELS = _LABELS + " (random-intercept model)" if _USE==5
              
              // Finally, create the plot
              forestplot, irr

              I hope that helps.

              Regards,

              David.
              Last edited by David Fisher; 30 Nov 2018, 03:34.

              Comment


              • #22
                Thanks, David.

                That makes sense and it's really helpful!

                Kind regards,

                Virginia

                Comment

                Working...
                X