Announcement

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

  • caterpillar plot for multi level analysis

    Hi,

    I would be grateful for some advice please. I have done a multi level regression analysis. Level 1=id, level 2=spec and outcome measure= outcome. I want to present the results in a caterpillar plot with odds ratio and CI presented for each spec. I can't seem to find how to do this, any advice appreciated or if there is an alternative option to display the odds ratios graphically?

    I have attached an example of the data layout, the real dataset has around 30,000 outcomes in.

    Thanks,
    Molly

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(id outcome spec)
     1 1  0
     2 1  1
     3 0  2
     4 4  3
     4 2  3
     4 2  3
     5 1  4
     5 0  4
     5 1  4
     5 1  4
     6 0  5
     6 4  5
     6 0  5
     6 2  5
     6 1  5
     6 0  5
     7 0  6
     7 3  6
     8 4  7
     9 4  8
    10 0  9
    10 0  9
    10 2  9
    10 0 10
    end
    ------------------ copy up to and including the previous line ----------------

  • #2
    I think perhaps you are using the term caterpillar plot to mean something different from my understanding of the term, because "for each spec" makes no sense in any caterpillar plot I know about.

    But perhaps what you want is something like this:

    Code:
    xtset id
    xtlogit outcome i.spec, re
    coefplot, eform
    -coefplot- is written by Ben Jann and is available from SSC. It also offers many options to modify the appearance of the resulting graph. This kind of graph visually resembles a sparse caterpillar plot in the sense that I know the term, although what is on the axes is completely different.

    With your example, the results are pretty outlandish, as you have many singletons of spec and the n's are so small even for the others that the confidence intervals around the odds ratios are rather huge. But in a full data set, it should be OK.

    Comment


    • #3
      For what it's worth, there's a caterpillar plot command available in SSC (ssc install caterpillar).


      Laura Bellows & Paul T. von Hippel, 2017. "CATERPILLAR: Stata module to generate confidence intervals, Bonferroni-corrected confidence intervals, and null distribution," Statistical Software Components S458360, Boston College Department of Economics, revised 02 Feb 2020.

      Comment


      • #4
        Justin Blasongame Interesting. Is that standard terminology? I learned caterpillar plot in the context of multilevel modeling, but it meant something completely different. As I understand the term, after fitting the multi-level model, you calculate the predicted outcome (including all random effects) for each observation in the data set, along with confidence intervals (or standard errors). Then you sort them on the predicted outcome and you graph the outcome vs rank order, with error bars representing the CIs (or SEs). The resulting graph visually resembles a -coefplot- but clearly it is graphing something very different. Is the term used interchangeably for both? Is there a different name for what I am calling a caterpillar plot?

        Comment


        • #5

          Clyde Schechter I’m not sure if it’s standard terminology, but paulvonhippel who is coauthor of the command and fairly active here might have a better answer. My understanding is that they’re used interchangeably with forest plots in the context of meta-analysis, but I’ve seen them used for predicted random intercepts in MLM, which I believe is what you described.


          The resulting graph visually resembles a -coefplot- but clearly it is graphing something very different
          Agreed in some applications the y-axis is a prediction, but I’ve also seen odds ratios. More generally I think of this as you said, as a sorted plot of a prediction. You can also create these using Stata’s serrbar command.



          Comment


          • #6
            Interesting. One can think of caterpillar plots and forest plots as 90 degree rotations of each other (plus or minus some indication of an overall/ pooled effect). I've only seen caterpillar plots used in the same context as Clyde, and this terminology is commonly used in popular textbooks, but I haven't encountered caterpillar plots in the meta-analysis literature, especially in reference to forest plots, though I am most often exposed to some subset of the medical literature.

            Comment


            • #7
              Thanks for the above everyone. I wonder if I could have a little more help please. The command I have been using for my regression is:

              meglm outcome i.spec || id:, family(ordinal) link(logit) cov(unstructured) or

              One of the specs is taken as the reference.

              Using coefplot is there a way to display OR for all the specs (i.e without having a reference category) so that they can all be compared to each other? I have been criticised by a review board for having a reference category as potentially other meaningful comparisons are lost.


              Thanks so much

              Comment

              Working...
              X