I am quite new to the area of spatial statistics, but I'm very interested. For learning and demo purposes, I've created three datsets.
Dataset - Persons: This describes individuals at a certain location with a few variables. Please note, that the persons are located in the provided cities. A short explanation:

  • POINT_X: X-coordinate of city.
  • POINT_Y: Y-coordinate of city.
  • city: The name of the city, where they live.
  • ill: "1" states that they are ill. For learning purposes, all persons are ill.
  • job: If they have a job or not. "1" means: they have one, "0" means they haven't got one.
  • disnw: The distance to the nearest waterpoint.
  • wID: not relevant.

Dataset - City: This describes a number of cities including some variables. A short explanation of these:

  • city: The name of the city.
  • population: The population of the city.
  • POINT_X: X-coordinate of city.
  • POINT_Y: Y-coordinate of city.
  • ill: Number of ill persons in the city.
  • notill: Number of healthy persons in the city.
  • disnw: The distance (in km) to the nearest waterfeature.
  • wID: not relevant
  • rate_ill: The rate of ill persons in the city.
  • rate_notill: The rate of healthy persons in the city.

Dataset - Waterfeatures: . Please note that the viallages are on the same location as persons. This is a collection of spatial points, which describes waterfeatures.

  • POINT_X: X-coordinate of a waterfeature.
  • POINT_Y: Y-coordinate of a waterfeature.

geographic overview about the setting (red are persons, blue are waterfeatures, yellow are cities) Plot

Now I want to check the hypothesis that cities, which are nearer to waterfeatures (so where the variable disnw is lower), have a higher number of ill persons. So is there a correlation between the number of ill persons(no_ill)/rate of ill (rate_ill) and the proximity to water features (disnw). I know, that the datasets are possibly not representative or suitable for my hyptothesis, but for now this fact shouldn't matter.
I've already looked at some functions and packages, but I'm very unsure about a suitable method. Methods, which might be useful (at least from my point of view): semivariogram, variogram, Ripley's K function, G-Function, correlation coefficient.

To give you a better overview, I've created example datasets. You can find these here:

persons = read.csv("http://pastebin.com/raw.php?i=3aMGi9Ax", header = TRUE, stringsAsFactors=FALSE)
city = read.csv("http://pastebin.com/raw.php?i=Lk3KXLQT", header = TRUE, stringsAsFactors=FALSE)
water = read.csv("http://pastebin.com/raw.php?i=hQRvMZwE", header = TRUE, stringsAsFactors=FALSE)

It would be awesome to get some input from your side. Maybe you have a tip, how to perform this kind of analysis.
Thanks in advance!

  • This does strike me as being more of a statistical issue rather than a GIS question. It involves GIS but the core problem is trying to prove/disprove your hypothesis. I would try Cross Validated instead. Mar 8, 2014 at 10:12

1 Answer 1


It seems that you are over complicating this problem. Just because data is spatial does not mean that you are compelled to apply a spatial statistical model.

If you distill down your question, all you are after is a statistical relationship between rate of illness (rate_ill) and distance to water (disw). This can be tested using a simple bivariate linear model where; y(rate_ill) ~ x(disw). Once you have a model specified you can test for iid assumptions and autocorrelation in the residuals to make sure that your model is supported. If the relationship is nonlinear in nature you could alternatively, implement a spline regression. In the bivariate case, splines can be readily interpreted.

In R, autocorrelation tests on linear models (lm or residuals objects) can be applied using the "Lagrange spatial dependence test" (lm.LMtests) or a "Moran's-I" test (lm.morantest), which are both available in the R package "spdep".

You do not seem to have a spatial process that you want to draw an inference from so, I just do not see the necessity nor validity of a spatial model. If you were to implement a formalized point pattern model it would have to be bivariate in nature. Semivariance is univariate in nature and as such, is not relevant here.

A statistic like the G-hat or Ripley's-K would show you clustering (from random) at various distance lags. In your case, this would not be informative unless it was in relation to the spatial process of another variable (e.g., illness in relation to water proximity). Since your stated hypothesis is a discrete point process in relation to a complex linear or lattice process this would be impossible to specify in the types of models that you have singled out.

If you do, in fact, have significant autocorrelation in your model, one option that you may explore is a "point process model" (PPM). These types of models can be implemented in the R package "spatstat" and specified in a Hierarchical Bayesian modeling framework using an MCMC. In this way the spatial process can be directly incorporated into the model and resulting inference. Scales can be tested in a hierarchical model term using a specified expected distribution or as an error term.

  • 1
    +1 for the first paragraph alone. (The rest is well worth reading too, of course.)
    – whuber
    Apr 1, 2014 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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