help for domdiag

Dominance diagram

domdiag varname [if exp] [in range] , by(byvar) [ reverse graph_options ]


domdiag plots a dominance diagram given a division of the values of the numeric variable varname into precisely two groups by the categories of byvar.

Suppose there are n_1 values in the group for the lower value of varname (hereafter called group 1) and n_2 values in the group for the higher value of varname (group 2). Then there are n_1 * n_2 pairwise comparisons, which are plotted on a graph with axes rank on varname within group 1 and rank on varname within group 2. The symbols used are "+" if value in group 1 > value in group 2, "0" if value in group 1 = value in group 2, and "-" if value in group 1 < value in group 2. This helps to make graphic what is done in ranksum: the proportion of pairs symbolised "+" plus 1/2 the proportion of pairs symbolised "0" is the estimate that P((varname | group 1) > (varname | group 2)).

By default, ranks for the group with fewer values are plotted on the y axis.


This graph was used by Cliff (1993, 1996). Some earlier related ideas are reviewed by Fisher (1983). Newson (2002) gives a broader discussion and an example implementing domdiag.

domdiag temporarily makes a dataset of n_1 * n_2 observations. This may be very much larger than the existing dataset and the user should make sure that enough memory is allocated.


by(byvar) specifies subdivision into two groups and is a required option. If byvar defines three or more categories and it is desired to focus on just two, make sure the others are excluded by using if.

reverse specifies that axes are to be reversed from the default.

graph_options are options of scatter. By default, note() is used to display P((varname | group 1) > (varname | group 2)).


. domdiag mpg, by(foreign)


Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk


Cliff, N. 1993. Dominance statistics: ordinal analyses to answer ordinal questions. Psychological Bulletin 114, 494-509.

Cliff, N. 1996. Ordinal methods for behavioral data analysis. Mahwah, NJ: Lawrence Erlbaum.

Fisher, N.I. 1983. Graphical methods in nonparametric statistics: a review and annotated bibliography. International Statistical Review 51, 25-38.

Newson, R. 2002. Parameters behind "nonparametric" statistics: Kendall's tau, Somers' D and median differences. Stata Journal 2: 45-64. http://www.stata-journal.com/sjpdf.html?articlenum=st0007

Also see

Manual: [R] signrank On-line: signrank