3
$\begingroup$

I have a set of many longitude and latitude points within a city. I constructed the nxn euclidean distance matrix. My goal is to know which is the average distance between any two points.

So my guess is that it should be as simple as calculating the mean of the matrix.

However, I'm not certain if this number would reflect what I'm looking for or maybe there's a better estimator. My ultimate goal is to use this estimator for comparison between cities.

$\endgroup$
  • $\begingroup$ The computation of the mean is straightforward as explained in the answer. But are you sure euclidean distance as the crow flies is the most relevant metric of distance within cities? $\endgroup$ – David Ernst Sep 5 '17 at 14:32
  • $\begingroup$ What do you mean by 'comparison between cities'? $\endgroup$ – user83346 Sep 5 '17 at 15:12
  • $\begingroup$ so, the idea was to have a measure of a 'within' (what's the average distance between points in a city) to compare between cities. That's what was not making a lot of sense back then when I asked the question $\endgroup$ – Matias Andina Sep 6 '17 at 1:41
3
$\begingroup$

The mean distance between points $i \not = j$ expressed with matrix operations: Let the matrix with the Euclidean distances be $D$, an $n\times n$ matrix with $i,j$-element given by $$ D_{ij} = \lVert x_i - x_j \rVert $$ There are $n(n-1)/2$ pairs, but to get a simpler matrix formula we include both (equal) terms $D_{i,j}$ and $D_{j,i}$ and can write the mean as $$ \frac{1}{n (n-1)} \sum_i \sum_{j\not= i} D_{i,j} $$ The formula simplifies if we include the zeros on the diagonal: $$ \DeclareMathOperator{\ones}{\mathbb{1}} \frac{1}{n(n-1)} \sum_i \sum_j D_{i,j} $$ and writing the vector of $n$ ones as $\ones$ we finally get the mean as $$ \frac{1}{n(n-1)} \ones^T D \ones $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.