Announcement

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

  • Graph multiple ologit outcomes in one graph

    I’m having a difficult time finding the way to do something that surely must be obvious.

    I am running Stata 12 in Windows and trying to graph the results of an ologit equation. Specifically, after I run an ologit equation with four outcomes, I use margins to generate predicted values for each of the four outcomes. My independent variable of interest is an indicator variable with many categories, but I only want to graph three of them; so I use margins to generate the predicted values for outcomes 1-4, for each of the three groups.

    I use marginsplot to create four separate connected line graphs with confidence intervals for the three groups, which I combined with graph combine:
    Click image for larger version

Name:	govfollowrev2.png
Views:	2
Size:	27.2 KB
ID:	912808


    What I would like to create is a single graph with all four outcomes.
    The ologit command line is:
    ologit govfollowrev age educ i.reltrad, vce(robust)

    The margins command line for outcome 1 is:
    margins i(100001/100003).reltrad, predict(outcome(1)) vce(unconditional)

    I created a looping program to create the graphs:
    forvalues i=1/4 {
    margins i(100001/100003).reltrad, predict(outcome(`i')) vce(unconditional)
    marginsplot
    graph save C:\Users\pwielhouwer\Documents\Data\Graphs\govmarg ins`i', replace
    }


    And then combined the four graphs to produce the one above.

    Can I please get some help in creating a single graph for all four outcomes? Thanks in advance!

  • #2
    Why not just plot the linear predictions (predict response_hat, xb), and give the cut points in the figure caption? Wouldn't a single line be a lot easier to interpret than four, three of which are redundant?

    Comment


    • #3
      You might check out Nick Winter's -combomarginsplot-, available from SSC.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Richard, that is exactly what I was looking for! Many, many thanks!

        Comment


        • #5
          Originally posted by Joseph Coveney View Post
          Why not just plot the linear predictions (predict response_hat, xb), and give the cut points in the figure caption? Wouldn't a single line be a lot easier to interpret than four, three of which are redundant?
          Thanks, Joseph--that is very helpful as well!

          Comment

          Working...
          X