40

The following solution is based on a post by Roger Bivand on R-sig-Geo. I took his example replacing the German shapefile with some census data from Oregon you can download from here (take all shapefile components from 'Oregon counties and census data'). Let's start with loading the required packages and importing the shapefile into R. # Required packages ...


29

This question has been converted to Community Wiki and wiki locked because it is an example of a question that seeks a list of answers and appears to be popular enough to protect it from closure. It should be treated as a special case and should not be viewed as the type of question that is encouraged on this, or any Stack Exchange site, but if ...


20

My guess is that you coordinate transformations have introduced tiny rounding errors (see an example below). As there is no way to set the tolerance in ST_Equals, this is causing ST_Equals to return false for some geometries that only differ in the nth decimal place, as the geometries have to be identical in every respect -- see the intersection matrix ...


18

Here is a solution based on Find clusters of points based distance rule, but using the distm function from the geosphere package: library(sp) library(rgdal) library(geosphere) # example data from the thread x <- c(-1.482156, -1.482318, -1.482129, -1.482880, -1.485735, -1.485770, -1.485913, -1.484275, -1.485866) y <- c(54.90083, 54.90078, 54.90077, 54....


18

A couple I've found useful: I'd strongly recommend Analysing spatial point patterns in 'R' by Prof. Adrian Baddeley at the CSIRO in Australia. It covers the spatstat module in depth and I think it's a great resource for cluster analysis. Applied Spatial Data Analysis in R (Bivand, Roger S., Pebesma, Edzer J., Gómez-Rubio, Virgilio) and Spatial Statistics ...


17

This is a difficult question as there just have not been many, if any, spatial process statistics developed for line features. Without seriously digging into equations and code, point process statistics are not readily applicable to linear features and thus, statistically invalid. This is because the null, that a given pattern is tested against, is based on ...


16

Few more from my side: Virgilio Gómez Rubio's (he is the author of the famous/superuseful ASDAR book, mentioned in other answers) website provides materials to his tutorials from useR! conferences - slides, data and code are available. Apart from ADAR, there is now new book 'An Introduction to R for Spatial Analysis and Mapping' by Brundson & Comber ...


16

Spatial statistics, like most statistical methods, is a large topic. If you would like spatial statistical theory presented in a statistical/mathematical framework my favorite is Cressie's book "Statistics for Spatial Data". Since Diggle's point process book is out of print, A good alternative, specific to point pattern analysis, is "Statistical Analysis ...


16

Here is a solution using the sf package: library(tidycensus) library(dplyr) library(sf) library(ggplot2) # get data from tindycensus for demonstration (note you need an API key, folow instructions here: https://walkerke.github.io/tidycensus/articles/basic-usage.html) census <- tidycensus::get_acs(geography = "tract", variables = "B19013_001", ...


15

Evaluation of the options Contour lines represent continuous surfaces, so their comparison ultimately is a proxy for comparing those surfaces. Because both the surface values (elevations) and locations are potentially subject to error, there are two components to the comparison: in terms of value and in terms of position. The two cannot be separated, ...


15

Learning by doing is my preferred way. And when it comes to spatial statistics, R is getting seriously powerful tool. So if this is an option browse through some course materials, download the data and try it yourself. Few starting points covering spatial autocorrelation (SA) (and generally speaking handling spatial stuff in R): Center for Studies in ...


14

You might want to look into Fréchet distance. I only recently found out about this after a recent question looking for a python implementation. This is a metric for finding spatial similarity of linestrings. It's a similar idea to Hausdorff distance, the equivalent for polygon similarity measures, but for linestrings with a direction. The Fréchet ...


13

One way to approach this interesting problem is to view it as a robust estimator of the center of a bivariate point distribution. A (well-known) solution is to peel away convex hulls until nothing is left. The centroid of the last non-empty hull locates the center. (This is related to the bagplot. For more information, search the Web for "convex hull ...


12

The ESRI Spatial Statistics tools do not calculate great circle distance if the data is in a geographic coordinate system (Lat/Long). As such, distance based spatial analysis is incorrect. The tools require that your projection units be in feet or meters. The "ZONE_OF_INDIFFERENCE" is a term made up by ESRI that basically means that within a local ...


12

Chris Brunsdon gave a paper on this issue at the 2008 GeoComputation conference - see http://www.geocomputation.org/2007/1B-Algorithms_and_Architecture1/1B2.pdf In the paper he discusses how to apply Principal Curve Analysis (Hastie and Stuetzle 1989) and makes some suggestions on how to increase robustness of the method. Further searching leads to a ...


11

The expected value of Moran's I is -1/(N-1), which for your sample of 38 cases equals -1/(38-1) = -0.02702703. This is what the software spit out, so that is a good start! So this means that there is really no evidence of negative auto-correlation here, as with random data you would expect it to be a negative value more often than positive. You interpret ...


10

Average slope sounds like a natural quantity but it's rather a strange thing. For instance, the average slope of a flat horizontal plain is zero, but when you add a tiny bit of random, zero-average noise to a DEM of that plain, the average slope can only go up. Other strange behaviors are the dependence of the average slope on DEM resolution, which I have ...


9

Sorry, I can not provide an answer for QGIS 3.4, but for 3.8+, in case you have a chance to update. The tool you need for this is called join attributes by nearest, which was introduced with 3.8. For earlier versions there is a plugin called NNJoin, but this allows only to join one nearest feature, not several. I have two point layers in UTM (so join ...


8

A Caveat A standard error is a useful way to estimate an uncertainty from sampled data when there is no systematic error in the data. That assumption is of dubious validity in this context, because (a) the KDE maps will locally have definite errors that may persist systematically among the layers and (b) a potentially huge component of uncertainty due to ...


8

After much searching in the back corners of ESRI documentation, I've concluded that there is no reasonable way run a bivariate Ripley's K function in Arcpy/ArcGIS. However, I have found a solution using R: # Calculates an estimate of the cross-type L-function for a multitype point pattern. library(maptools) library(spatstat) library(sp) # Subset certain ...


8

Yes, the Heatmap plugin can be used for this. Suppose we have a point layer called pointrates.shp with rates between 0 and 1 associated with each point: We can run the Heatmap plugin on this, using a Decay Ratio of 1 (which means that the value at the edge of each search radius is the same as at the center), and using the "Ratio" column as the Weight. In ...


8

This does not seem to be documented in the clusthr manual page, but because the source code is available, we can try to figure it out. By typing > clusthr at the R prompt (shown as the initial >), you can see the code. It's opaque, but a quick look indicates (1) there's no plotting or color selection going on and (2) the clustering is performed ...


8

Whenever you are doing an analysis that involves distance measurements you should project your data (at present the spatial statistics tools in ArcGIS do not calculate geodesic distances, unfortunately). This link will tell you more about projected coordinate systems: The ZONE OF INDIFFERENCE conceptualizations is not appropriate when your data is measured ...


8

The formula for global Moran's I is: where i is an index of analysis units (basically, measurement units of of your map, or in your case pixels in the raster) and j is an index of the neighbors of each map unit. The formula for local Moran's I is extremely similar, except that since local Moran's I is calculated separately for each analysis unit indexed by ...


8

Moran's I ranges between -1 (perfectly dispersed) and 1 (perfectly clustered), with a value of 0 indicating random distribution. While 0.003 isn't "perfectly" random, it's much, much closer to random than to dispersed or clustered. The question of whether it's random enough depends on your discipline, personal standards, and research question. I'd ...


8

It seems you are doing research. Here are some advices: Ask the domain experts: if you ask from an expert about the exploratory variables, he/she can easily filter many of the variables due to their irrelevancy to the response. If you don't have access to an expert, then review the literature. Use PCA (principal component analysis): PCA is a type of ...


7

Use focal statistics instead of block statistics: when using rectangular neighborhoods this produces the same results in the centers of the blocks, but focal stats are computed with moving (overlapping) windows, effectively creating a representation of a surface of relative slopes. Moreover, focal stats can be computed with more natural neighborhoods, such ...


7

You need to compute the total population within all possible distances, plot them together, and interpolate within that plot. I will illustrate using population for the District of Columbia (USA) represented on a 10m grid. It begins by computing the population density (the units do not matter; I used people per acre) and converting that to a grid. For the ...


7

Asking for a "Monte Carlo simulation" is akin to asking to determine the significance using multiplication: like multiplication, Monte Carlo is merely a computational technique. Thus, we first have to figure out what it is we should be computing. I would like to suggest considering a permutation test. The null hypothesis is that the data were ...


7

You can check the source code for the Nearest Neighbour Analysis tool from GitHub. More specifically, the following lines of code which shows how the different parameters are calculated: do = float(sumDist) / count de = float(0.5 / math.sqrt(count / A)) d = float(do / de) SE = float(0.26136 / math.sqrt(( count ** 2) / A)) zscore = float((do - de) / SE) ...


Only top voted, non community-wiki answers of a minimum length are eligible