1

I'm rather new in the field and I'm looking for advice in a problem.

I have a data set of several data points, each with category, latitude and longitude.

How can I find if there is a significant co-occurrence between different categories?

I'm working with QGIS and I'm familiar with typical data analysis libraries in Python (Pandas, numpy, etc.).

Edit: my dataset is a series of datapoints each point is representing a place like resturant hotel etc. the only daya i have about each point is it's lattitude, longtitude and the type(resturant, Atm,hotel, etc.) what i'm interested in is to see if there is any significant relationship between the placement of these different types of data you can take a look at my datasets here: Googlemap metaData of Moscow,Russia

8
  • 1
    Hi Zmey, welcome to GIS Stackexchange. I edited your question to better conform to our site policies. Specifically, I removed your second question to conform to the "one question per question" rule. Feel free to post it as a separate question. You can review, cancel or improve on the changes I made by clicking the edit link under your question.
    – csk
    Dec 17, 2019 at 19:47
  • Are you interested in spatial clustering in just one categorical variable or a spatial relationship between two variables? If the latter, are the points coincident (all points have measurements of each categorical variable) or are they in separate files such that all the observations on one variable are at different locations to the observations on the other. Finally, please confirm your variables are truly categorical (implying no underlying progressive relationship) or ordinal (with an underlying implicit order). I think you will get better answers if these are clarified. Dec 18, 2019 at 1:25
  • @LeighBettenay thanks for the help. my dataset is a series of datapoints each point is representing a place like resturant hotel etc. the only daya i have about each point is it's lattitude, longtitude and the type(resturant, Atm,hotel, etc.) what i'm interested in is to see if there is any significant relationship between the placement of these different types of data you can take a look at my datasets here: dataleaks.ir/datasets/show/…
    – Zmey
    Dec 18, 2019 at 15:14
  • For example, you have 1 point and you want to know if there are not several points behind this point? Dec 18, 2019 at 15:16
  • @VincentBré for example i'v got several points with the same category(resturants for example) and i want to see if hotels(for examples) tend to be closer to them
    – Zmey
    Dec 18, 2019 at 15:24

1 Answer 1

0

From what you say in your clarification, you have one layer containing points, and each point has a categorical variable which indicates it is either a hotel or a shop etc. No point can be more than one category at once. You are trying to evaluate if the distribution of one type of point relates in a spatial sense to the distribution of another. There is some useful information in a similar question here: Comparing two spatial point patterns?

First, you probably should re-project your data into a coordinate system based in metres- like the appropriate UTM system for that part of the world. You might also need to add a unique id field or name to the point layers if one does not exist. See this tutorial on how: https://anitagraser.com/2010/10/27/adding-a-unique-id-column-to-layers-in-qgis/

EDIT: It would also be useful to have a polygon layer containing the outline of the city. This will be the bounding space if you want to generate some random points, or to compare total area with area within buffers. If you don't have an outline then you can create a dummy one using Vector > Geoprocessing tools > Convex hull(s).

Next (though it can probably be done in one layer by experts) I would break the point layer up according to its type, so that you have separate layers for hotels, restaurants, etc. Information on the different ways to do this is well explained in answers here: Splitting shapefile into separate files for each feature using QGIS/GDAL/SAGA?

You now have to make a decision as to what will be your estimation metric of “closeness” between each category on a pair basis- that is, between say hotels and restaurants, hotels and atm’s etc. Your measurement of “closeness” could be established several ways, for example by the average of the minimum distances of each restaurant to any hotel (as I think was suggested by @VincentBré in his comment) or the number of occurrences of restaurants that fall into buffers around each of the points representing the hotels (for example, restaurants situated within 200 m from a hotel vs those situated more than 200 m from a hotel. These are both valid approaches and each answers a somewhat different question.

To accomplish the first, you could use the Distance Matrix tool with number of points set to 1 between the layer for restaurants and the layer for hotels (then the same for all the other pairs you want to test). This will give you the distance from each restaurant point to the nearest hotel point in a newly added variable called “Distance”. This link describes the process: https://www.qgistutorials.com/en/docs/3/nearest_neighbor_analysis.html

Then the average of this field is the average minimum distance of restaurants to hotels, etc. You can calculate a value for each pair type and compare them. For the second, you need first to decide what distance counts as “close” then to create a circular buffer around each hotel point with radius at the chosen distance. You can then count the number of restaurants, atm’s etc that fall within the buffers versus those that don’t. This link gives the work flow: Count points within each buffer QGIS

If you want to progress further, you could assess if the count you received was statistically different to the count you would get if the distribution of restaurant’s was random. You could even generate a couple of random point sets and make a comparison using the logic in this link: Generate random points within a polygon with minimum distances in QGIS 2.14

Note that just because you have a spatial association does not mean one causes the other- they might both relate to something else like transport hubs or population concentration.

Note also in closing that there is a very big but complex field of techniques for spatial analysis and statistical tests of significance of spatial association. If you want to delve more deeply then start with the terrific work of Luc Anselin, particularly these two papers which are both freely available: https://escholarship.org/content/qt3ph5k0d4/qt3ph5k0d4.pdf

https://onlinelibrary.wiley.com/doi/full/10.1111/j.0016-7363.2005.00671.x

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.