# Clustering of Spatial Data in R or Python [closed]

I am new to GIS.

Problem Domain :-
I have a stoppage data of different vehicle i.e. the point where vehicle stopped.There are some specific vehicle which stops at some particular point. So, I am trying to find out such specific point(anomaly detection) in the midst of random stoppages. I am assuming that Cluster analysis would let me know about the Percentage of vehicle at that stoppage point. If only a particular vehicle stops at that point , then obviously that's an anomaly point.

I have a large set of (latitude and longitude)spatial data. I am confused on which clustering method to adopt. I have came across two density based approach: DBSCAN and OPTICS. I am doubtful about the two approach since I don't have a particular minPts( 1 in my case). Obviously, I can't use K-means approach , K is unknown.

I have come across one more approach i.e X-means.

## closed as unclear what you're asking by Spacedman, Midavalo♦, PolyGeo♦Jun 1 '16 at 9:36

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• What precisely are you trying to achieve? What do you think this clustering is going to tell you? – Spacedman May 31 '16 at 13:29
• I have to analyse the clusters and find anomalies in the clusters. Thats why I intend to do clustering . – SK Singh May 31 '16 at 13:38
• What do you mean by "an anomaly" though? Nathematically or probabilistically speaking? That is what informs the method you use for analysis. – Spacedman May 31 '16 at 14:39
• It is quite unclear as to what you are after and it honestly, based on your comment of "finding anomalies", does not sound like clustering but, rather identifying outliers (distributionally or spatially). There are methods for selecting the optimal k but clustering methods are not optimal for "anomaly" detection because there is no underlying hypothesis as to what the cluster would indicate. Please edit your question to provide exactly what your expected results are and what you have already tried. – Jeffrey Evans May 31 '16 at 17:58
• I have a stoppage data of different vehicle i.e. the point where vehicle stopped. So, I am trying to find out a specific point(anomaly detection) if any exist.I am assuming that Cluster analysis would let me know about the Percentage of vehicle at that stoppage point. If only a particular vehicle stops at that point , then obviously thats an anomaly point. @Spacedman – SK Singh Jun 1 '16 at 5:39

There are an extremely large number of approaches to clustering, and your question is not answerable, short of writing a textbook describing all possible methods. Therefore, the question I will answer is What information would help me select a clustering method?

1. What is your problem domain? Or, to put it another way, what do the points represent? It could make a difference if the points are wildlife sightings, murders, cancer cases, cell phone towers, etc.
2. Are you just looking for a spatial cluster of cases/entities, or are you looking to cluster on attributes of the cases/entities? For example, if the points represent people, and you are trying to identify population centers, you might cluster on just the location. But if each person also has an income attribute, and you want to identify neighborhoods of similar socioeconomic status you would need to use a clustering method that accounts for proximity of the points and the value of the attribute of interest.
3. What question are you trying to answer? Are you trying to evaluate the degree to which the points are clustered (a global measure), find local clusters, prove the existence of a suspected cluster, look for potential causes of clusters?
4. If you are trying to look for potential causes of clusters, what additional data do you have? For example, to investigate causes of cancer you might have socioeconomic data, behavioral data (diet, smoking, etc.), and environmental data (air quality, water quality, etc.).

To give you an idea of the breadth of this subject, here are some links with additional information:

Please consider submitting a new question with more background on your data and your problem. Also, unless you have specific reason to prefer a method such as DBSCAN, there is probably no reason to list methods that you know about (or don't know about).

• How exactly is Moran's-I used as a clustering statistic? – Jeffrey Evans May 31 '16 at 17:01
• Yes, I am quite familiar with the Moran's-I statistic but, I still do not understand how you would use it for clustering. The LISA statistic (which integrates into the global Moran's-I) can be used to identify nonstationarity but, from a conventional clustering perspective, I would certainly not recommend using it for clustering data into nominal classes. It sounds like you are convolving the global statistic and the LISA, which is statistically incorrect. – Jeffrey Evans May 31 '16 at 18:03
• @JeffreyEvans Sorry for explaining what you already knew. Yes, Global Moran's I is not used for clustering, but to identify whether clustering is present. The question is extremely vague about nature of data and motivation. Consider: A clustering method could be used to create clusters on data that Moran's I near 0 indicates exhibits complete spatial randomness. My point was that questioner should think carefully about what they were doing and why. I'm open to edits or suggestions. – Lee Hachadoorian May 31 '16 at 18:31
• I have a stoppage data of different vehicle i.e. the point where vehicle stopped. So, I am trying to find out a specific point(anomaly detection) if any exist.I am assuming that Cluster analysis would let me know about the Percentage of vehicle at that stoppage point. I think clustering on the basis of location would be good enough in my case. @LeeHachadoorian – SK Singh Jun 1 '16 at 5:36