Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Arrow diagram connecting before and after categories

From   Nick Cox <>
Subject   Re: st: Arrow diagram connecting before and after categories
Date   Tue, 7 Aug 2012 10:15:57 +0100

-linkplot- is from SSC. Please note the request to explain where
user-written programs you refer to come from. I see no problem in
using one y variable with different labels, as marker labels exist for
that purpose.

Multiple arrows from one node (vertex) to several others are no
problem so long as each edge or link is represented by an observation.
Thus if a preliminary diagnosis is refined to a final diagnosis for
various persons

"A"   "beginner problem"   "didn't read manual"
"A"   "beginner problem"  "model wrong for data"
"A"   "beginner problem"  "needs new code"
"B"   "beginner problem"  "syntax error"
"C"   "beginner problem"  "data wrong for model"
"C"   "beginner problem"  "version conflict"

that is unproblematic so long as the data structure is as above.

Your problem thus sounds easy but see for details

Cox, N.J. 2009. Paired, parallel, or profile plots for changes,
correlations, and other comparisons.
Stata Journal 9(4): 621-639

Abstract.  Paired, parallel, or profile plots showing the values of
two variables may be constructed readily using a combination of graph
twoway commands. This column explores the principles and practice of
such plot-making, considering both wide and long (panel or
longitudinal) data structures in which such data may appear.
Applications include analysis of change over time or space and indeed
any kind of correlation or comparison between variables. Such plots
may be extended to show numeric values and associated name

That said, it is not clear how effective such graphs will be as
numerous identical links are shown by the same arrow and Stata doesn't
readily support lines proportional in thickness to some other
variable. Depending on how many diagnoses you have I am led to suggest
-tabplot- (SSC) as an alternative.


On Mon, Aug 6, 2012 at 11:56 PM, Mollie Hogan <> wrote:

> I am hoping to get some help with a graphing issue. I'm trying to
> create what I can best describe as a before/after arrow diagram
> showing reclassification of categorical variables.
> I have a dataset where each observation is one death. Each death goes
> through a review process, and I have one variable showing the cause of
> death before the review process, and another variable showing the
> cause of death after the review process. I want a diagram that has, on
> the left side, the list of causes BEFORE the review and then on the
> right side, the list of causes AFTER the review. I want each case
> represented by a line connecting the appropriate before and after
> causes. Pretty straightforward, right? The hitch is that the "before"
> categories are in broad groupings and the "after" causes are more
> specific than that. So the list of causes before and after is not the
> same.
> I have tried several things: linkplot got me the closest, but I cannot
> label the "before" and "after" categories with different labels (since
> it's just the one yvar). I have started trying to overlay many line
> graphs, and then add text manually, but I have quite a lot of
> categories and thought I would ask and see if anyone has any other
> thoughts about a good approach or user-written command that might do
> the trick.
> I am running Stata 11.2 on a Mac, but can access 12.1 on Windows if
> the solution lies there!
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index