# Histogram Distance

In the previous section we studied the transient behavior of the Schlogl model by recording the populations in a series of histograms. We saw that the populations settled into a bi-modal distribution. The plot showing the probability distributions for the species population is reproduced below.

The total variation metric may be used to measure the distance between two probability distributions. For two histograms (with the same lower bound and bin width) having bin values of xi and yi, this metric is half the sum of the absolute values of the bin differences.

D = Σ|xi - yi| / 2

Because the histogram represents a probability distribution, the sum of the bins is unity, Σ xi = 1. The factor of 1/2 in the distance metric normalizes the distance to be between 0 and 1.

Hitting the histogram distance button in the simulation output panel will bring up a window that allows us to select a pair of histograms. (One may also select a set of histograms, in which case the average distance will be computed. In this way one may, for instance, determine the average distance for a set of species.) Below we see that as time advances the distance beween successive frames decreases.