# 2D analog of standard deviation?

Consider the following experiment: a group of people is given a list of cities, and asked to mark the corresponding locations on an (otherwise unlabeled) map of the world. For each city, you will get a scattering of points roughly centered at the respective city. Some cities, say Istanbul, will exhibit less scattering than others, say Moscow.

Let's assume that for a given city, we get a set of 2D samples $\{(x_i, y_i)\}$, representing the $(x, y)$ position of the city (e.g. in a local coordinate system) on the map assigned by test subject $i$. I would like to express the amount of "dispersion" of the points in this set as a single number in the appropriate units (km).

For a 1D problem, I would choose the standard deviation, but is there a 2D analog that could reasonably be chosen for the situation as described above?

One thing you could use is a distance measure from a central point, ${\bf c}=(c_{1},c_{2})$, such as the sample mean of the points $(\overline{x}, \overline{y})$, or perhaps the centroid of the observed points. Then a measure of dispersion would be the average distance from that central point:

$$\frac{1}{n} \sum_{i=1}^{n} || {\bf z}_{i} - {\bf c} ||$$

where ${\bf z}_{i} = \{ x_{i}, y_{i} \}$. There are many potential choices for a distance measure but the $L_{2}$ norm (e.g. euclidean distance) may be a reasonable choice:

$$|| {\bf z}_{i} - {\bf c} || = \sqrt{ (x_{i}-c_{1})^{2} + (y_{i}-c_{2})^{2} }$$

There are lots of other potential choices, though. See http://en.wikipedia.org/wiki/Norm_%28mathematics%29

• While the distance will be nonzero this is indeed a strange choice as it doesn’t agree in the degenerate case with the usual standard deviation in one dimension. So consider $\|z_i-c\|^2$ instead. May 4, 2019 at 4:46
• I agree, @AlexR. Calculating the distances converts the 2D array into a 1D one. After that, the standard deviation formula could be applied Feb 16, 2021 at 15:38

A good reference on metrics for the spatial distribution of point patterns is the CrimeStat manual (in particular for this question, Chapter 4 will be of interest). Similar to the metric Macro suggested, the Standard Distance Deviation is similar to a 2D standard deviation (the only difference is that you would divide by "n-2" not "n" in the first formula Macro gave).

Your example experiment actually reminds me a bit of how studies evaluate Geographic Offender Profiling, and hence the metrics used in those works may be of interest. In particular the terms precision and accuracy are used quite a bit and would be pertinent to the study. Guesses could have a small standard deviation (i.e. precise) but still have a very low accuracy.

I actually ran into a similar problem recently. It sounds like you want a way to measure how well the points are scattered area-wise. Of course, for a given measurement, you’d have to realize that if all the points are in a straight line, the answer is zero, since there’s no 2 dimensional variety.

From the calculations I did, this is what I came up with:

$$\sqrt{S_{xx}S_{yy}-S_{xy}²}$$

In this case, Sxx and Syy are the variances of x and of y respectively, whereas Sxy is kinda like the mixed variance of x and y.

To elaborate, assuming there are n elements, and $$x_μ$$ represents the mean value of x and $$y_μ$$ represents the mean of y:

$$S_{xx}=\frac{1}{n} \sum_{i=1}^{n} (x-x_μ)²$$ $$S_{yy}=\frac{1}{n} \sum_{i=1}^{n} (y-y_μ)²$$ $$S_{xy}=\frac{1}{n} \sum_{i=1}^{n} (x-x_μ)(y-y_μ)$$

Hopefully this should work for you.

Also, if you’re wondering how to do it in higher dimensions, like measuring volume spread or surteron bulk in 4 dimensions, you have to form a matrix like such:

Sxx Sxy Sxz ...

Syx Syy Syz ...

Szx Szy Szz ...

... ... ... ...

And continue for however many dimensions you need. You should be able to figure out the S values given the provided definitions above, but for different variables.

Once the matrix is formed, take the determinant, find the square root, and you’re done.

I think you should use 'Mahalanobis Distance' rather than Euclidean distance norms, as it takes into account the correlation of the data set and is 'scale-invariant'. Here is the link:

http://en.wikipedia.org/wiki/Mahalanobis_distance

You could also use 'Half-Space Depth'. It is a bit more complicated but shares many attractive properties. The Half space Depth (also known as Location depth) of a given point a relative to a data set P is the minimum number of points of P lying in any closed halfplane determined by a line through a. Here are the links:

http://www.cs.unb.ca/~bremner/research/talks/depth-survey.pdf http://depth.johnhugg.com/DepthExplorerALENEXslides.pdf

• I understand using Mahalanobis distances when you're trying to tell whether particular points "belong" to the set, but isn't the average Euclidean distance from the centroid more closely related to the usual concept of variance/standard deviation that is used in a univariate setting? Jul 19, 2011 at 21:57
• Do you mind elaborating on the statements "takes into account the correlation of the data" and "is scale invariant"? What pertinence do either of these things have to the question at hand? Jul 20, 2011 at 4:14
• The usual extension of standard deviation to higher dimension is of course a way to calculate the distance of a particular point from the center of the data - but here we are normalizing each point, which makes it easy to perform cluster analysis or outlier detection. Also, Mahalanobis distance is more adaptive to cases where the distribution of points is non-spherical. For spherically symmetric cases, it is same as the usual extended standard deviation - where the covariance matrix of the data points reduce to identity matrix. Jul 20, 2011 at 14:19

For this specific example - where there is a predetermined "correct" answer - I would re-work the x/y cooridnates to be polar coordinates around the city they were being asked to mark on the map. The accuracy is then measured agains the radial component (mean, sd, etc.). An "average angle" could also be used to measure bias.

For myself, I'm still looking for a a good solution to when there is no pre-determined centre point, and don't like the idea of a pre-pass over the data to create a centroid.