I have two sets of data points where each data point is a latitude-longitude combination. The two sets represent two different time frames, let's say 2010-2014 and 2015-2018. The number of data points within the first time frame does not equal the number of data points in the second time frame. The data points are also independent, meaning that there exists no mapping from time frame 1 to time frame 2.

I would like to know if there exists a statistical test to compare the two sets of data points and see if the data points have shifted in geographical location, or stayed the same?

For instance, let's say the bulk of data points from 2010-2014 lies within the US, and within time frame 2015-2018 the majority of points is still in the US but also in Canada. Can we statistically say something about the shifting spatial characteristics of the two time frames.

I have tried figuring out a way to do this (PySAL for Python) but I seem to be lost.

  • 1
    So, do you wish to assess the two datasets relative to some underlying geography (e.g., US/Canda), or do you wish to compare them directly with each other? These are very different goals.
    – Tom
    Jul 2, 2018 at 20:29
  • I wish to compare them directly with each other. The geographical reference was just to illustrate the question I would like answer: have the data points (statistically?) moved/changed from time frame 1 to time frame 2. Jul 3, 2018 at 8:07
  • 1
    You are generally referring to branch of spatial statistics called Point Pattern Analysis (PPA). There may be a Python package that I am not aware of but PySAL does not have the functionality that you are after. You want to not only test the significance of the difference between the point features but also if they are significant from a Complete Spatial Random (CSR) Poisson process, otherwise you cannot infer any spatial process in the observed time-periods. There is a huge body of literature on this topic. Jul 5, 2018 at 16:17

1 Answer 1


You can calculate the average point of data-set A and the average point of data-set B and then take the distance between the two points to see if your points are shifting.

Calculating the Statistical dispersion of your points would tell you if your points are getting closer to each other or farther apart

  • So in a way, I can calculate the centroids of the two data sets, and then calculate the difference/distance between those two centroids as a measure of spatial change. Is there a way to know if this shift is statistically significant? Let's say the distance between the two centroids is 200km, what does this mean statistically? Jul 3, 2018 at 8:11
  • 1
    I am not a statistician, however, if the average point of data-set B is more than a standard deviation from the average point of data-set A, I would say that is significant. I think we would also need to know more about the data points for example knowing if these points are just a sample of a larger population and if so what percentage of the population.
    – Squanchy
    Jul 3, 2018 at 13:35
  • @Squanchy, this is an erroneous assumption. Evaluating statistical dispersion will not revel significant difference between the spatial processes, especially standard deviation as the data are bound to follow a non-normal distribution. One must test the spatial assumption of CSR before any evaluation of differences between two point processes. Examples of appropriate statistics for unmarked point process include, univariate instances of the G, K and Geits-Ord (Besag's L) and their bivariate (cross) corollaries, for testing differences, in a Monte Carlo framework. Jul 5, 2018 at 18:52
  • @JeffreyEvans you should post an answer. Why is it wrong to assume the points are shifting if the average point of set A is more than a standard deviation from the average point of set B (probably should have said median points)?
    – Squanchy
    Jul 6, 2018 at 2:20
  • But what about correcting for distortion from the projection? i.e, a degree of longitude varies. Are there any software libraries that can handle this?
    – user14241
    Feb 2, 2021 at 23:11

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.