Visualizing model fit with separation plots: A comprehensive guide

A separation plot is a graphical approach for assessing the fit of a model with a dichotomous (i.e., binary) or polytomous (i.e., multi-categorical) outcome. It provides a simple visualisation of a model’s ability to predict occurrences of the event of interest (i.e., successes) with high probability, and non-occurrences (i.e., failures) with low probability.

Separation plots were first introduced by Greenhill, Ward and Sacks in their very nice American Journal of Political Science paper: The Separation Plot: A New Visual Method for Evaluating the Fit of Binary Models. A number of years later, I was exposed to them by my colleague, Poppy. Subsequently, having found separation plots to be such a useful tool for visualising the predictive power of models with categorical outcomes, in a form that was readily understood by my clients and collaborators, I decided to write a procedure to implement them in Genstat. So, let’s take a look…

Ordering and coloring: Creating the foundation of a separation plot

In a nutshell, a separation plot is created by:

1. ordering from smallest to largest the predicted probabilities of success from the model,

and then,

2. plotting these by colour according to whether or not the observation corresponds to a success (i.e., an actual occurrence of the event of interest).

Illustrating separation plots with a toy example

In the table below, there are 10 binary observations, either success or failure of some event (for example, whether or not a patient was free from disease following treatment). Alongside are the predicted probabilities of success from some fitted model.

alt text

To create a separation plot, we order the data from smallest predicted probability of success to largest, like so:

alt text

Next, we colour the rows of the table according to the observed outcome:

alt text

And voilà, this is essentially a separation plot! Of course, in practice we try to improve the visualisation. For example, here’s a separation plot of the same data generated in Genstat.

alt text

Notice that some extra features have been added: a blue line graph of the ordered predicted probabilities of success, and a star denoting the expected number of successes.

Assessing model fit: What separation plots reveal

From the separation plot, the model’s fit (or predictive power) can be assessed by simply gauging the extent to which failures, here in pink, tend to concentrate on the left-hand side of the plot (i.e., the lower probability side) and successes, here in green, on the right-hand side. The plot also provides a simple summary of the distribution of successes and failures in the data, and helps you to identify potential clusters of false positives and false negatives.

Case study: Evaluating drug effectiveness through separation plots

Let’s look at a proper example, using data published in Finney (1971, Probit Analysis, 3rd Edition, page 103) 1. This data set is from an experiment comparing the effectiveness of four drugs. Fourteen groups of mice were tested for a treatment response to the drugs at a range of different doses. The variate N is the total number of mice in each group and R is the number of these that responded. The data were modelled using a generalized linear model (GLM) with a binomial distribution and a probit link function.

alt text

alt text

The separation plot from this analysis is shown below.

alt text

From the separation plot, we can see that the model is doing reasonably well, with successes (i.e., mice that have responded to the drug) tending to be on the right-side, and failures tending to be on the left. A model with poor predictive power would show no such separation; rather the successes and failures would be much more evenly distributed across the plot.

Alternative view: Handling large data sets with separation plots

There is a second flavour of separation plot that is important to mention, as it is particularly useful for large data sets. A shortcoming of the version above is that it may be hard to distinguish between successes and failures when plotting a very large number of observations. A solution to this problem is to plot the observed successes and failures in separate graphs. For example, revisiting our original toy data set, we first divide the data into two parts: one containing the observed successes and the other containing the observed failures. Then, as before, we order the predicted probabilities from smallest to largest. These are then coloured using a graduated band of colours formed by grouping the predicted probabilities into a number of distinct bands.

alt text

Below is this alternative view of the separation plot for the drug example, as generated by Genstat.

alt text

Once again, this plot indicates that the model is capturing the data reasonably well, with successes tending to be predicted with higher probability (i.e., redder) than failures, and conversely, failures tending to be predicted with lower probability (i.e., yellower) than successes. In addition, from this plot we learn that the data contains 640 successes (i.e., 640 mice responded to the drug) and 591 failures.

Separation plots for models with polytomous (i.e., multi-categorical) outcomes

The separation plot approach can be readily extended to models predicting multi-categorical responses. For example, classifiers such as support vector machines, neural networks and random forests.

Let’s look at an example using Fisher’s classic iris data set 2. This data set contains measurements of sepal lengths and widths, and petal lengths and widths from iris plants belonging to three different species. Quadratic discriminant analysis was used to predict species membership probabilities for each plant.

Below is the classic form of the separation plot for polytomous data:

alt text

Here, for each species, the predicted probabilities of being a member of that species are ordered then plotted, and coloured according to whether or not the plant (i.e., observation) was indeed from that species. In this example, the model is describing the data extremely well, with the plot showing almost complete separation between “successes” (i.e., of that species) and “failures” (i.e., not of that species).

The alternative view of the separation plot is given below. Here, for each species, the predicted probabilities of being that species are ordered from smallest to largest, and then plotted using a graduated band of colours. This view clearly shows that the quadratic discrimination analysis is predicting the correct species for each plant with a very high probability, in the band (0.9, 1].

alt text

The procedure, DSEPARATIONPLOT, for creating separation plots was introduced in Genstat 21, and in Genstat 22, separation plots were made available via the menu interface. I hope that you find separation plots as useful as I do!


 

[1] For Genstat users, the data is in spreadsheet file Drug.gsh in the example data sets.


[2] For Genstat users, Iris.gsh can be found in the example data sets.


1 For Genstat users, the data is in spreadsheet file Drug.gsh in the example data sets. ↩

2 For Genstat users, Iris.gsh can be found in the example data sets. ↩

Picture of Dr. Vanessa Cave
Dr. Vanessa Cave
Dr. Vanessa Cave is an applied statistician interested in the application of statistics to the biosciences, in particular agriculture and ecology, and is a developer of the Genstat statistical software package. She has over 15 years of experience collaborating with scientists, using statistics to solve real-world problems. Vanessa provides expertise on experiment and survey design, data collection and management, statistical analysis, and the interpretation of statistical findings. Her interests include statistical consultancy, mixed models, multivariate methods, statistical ecology, statistical graphics and data visualisation, and the statistical challenges related to digital agriculture. Vanessa is a past President of both the Australasian Region of the International Biometric Society and the New Zealand Statistical Association, on the Editorial Board of The New Zealand Veterinary Journal and an honorary academic at the University of Auckland. She has a PhD in statistics from the University of St Andrew.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Related articles

How much of the variation in your field trial comes from the treatments, and how much comes from...
What should you do when count data are more variable than your model expects? Vanessa Cave and David...
Precision breeding can deliver scientifically impressive traits, but practical value depends on more than technical success. Owen McIntosh...