Skip to content

Comparing spatial point patterns - Syrjala

12 messages · milton ruser, jiho, Jan Theodore Galkowski +4 more

#
I'm also interested here in comparing spatial point patterns.  So, if
anyone finds any further R-based, or S-plus-based work on the matter, or
any more recent references, might you please include me in the
distribution list?  

Thanks much!

  - Jan

  
--
#
# Jan Theodore Galkowski
# Senior Software Engineer
# Akamai Technologies
# Cambridge, MA 02142
#
# jgalkows at akamai.com
# bayesianlogic at acm.org
#
# 607.239.1834 (m)
# 617.547.1221 (h)
# 617.444.4995 (w)
#
#
Hi,

I went ahead and implemented something. However:
- I cannot garantie it gives correct results since, unfortunately, the  
data used in Syrjala 1996 is not published along with the paper. To  
avoid mistakes, I started by coding things in a fast and simple way  
and then tried to optimize the code. At least all versions given the  
same results.
- As expected, the test is still quite slow since it relies on  
permutations to compute the p.value. The successive optimizations  
allowed to go from 73 to 13 seconds on my machine, but 13 seconds is  
still a long time. Furthermore, I don't know how the different  
versions would scale according to the number of points (I only tested  
with one dataset). I'm not very good at "thinking vector" so if  
someone could look at this and further improve it, I would welcome  
patches. Maybe the only real solution would be to go the Fortran way  
and link some code to R, but I did not want to wander in such scary  
places ;)

The code and test data is here:
	http://cbetm.univ-perp.fr/irisson/svn/distribution_data/tetiaroa/trunk/data/lib_spatial.R
Warning: it probably uses non canonical S syntax, sorry for those with  
sensitive eyes.
On 2008-February-10 , at 17:02 , Jan Theodore Galkowski wrote:
Begin forwarded message:
JiHO
---
http://jo.irisson.free.fr/
#
There is this,

  "Analysis of Variance for Replicated Spatial Point Patterns in
  Clinical Neuroanatomy",
  PETER J DIGGLE, NICHOLAS LANGE, and FRANCINE M BENES, September 1991
  JASA, 
  Vol 86, No 415, pp 618 625
#
On 2008-February-10 , at 23:35 , Jan Theodore Galkowski wrote:
Thank you very much for this reference. However the problem it is  
dealing with is not really similar to the one I target. In this paper  
the authors assess the differences in positions of neurones in a 2D  
plane between three groups of patients, with replicates in each group.  
So the data of interest are the coordinates.
In my case, the positions of sampling stations are fixed (and on a  
grid if that helps [1]) and I want to assess the differences in  
abundances of two groups at these positions. So the data of interest  
are the abundances (normalized to remove the effect of total  
population sizes), and more specifically, the way the abundances are  
distributed on these points. Maybe the subject of this email is not  
correctly stated then. I am not a native english speaker and when it  
comes to technical terms, it is even worse.

Anyhow, I hope this email clarifies things.

[1] http://jo.irisson.free.fr/work/research/far.png

Jean-Olivier Irisson
---
UMR 5244 CNRS-EPHE-UPVD, 52 av Paul Alduy, 66860 Perpignan Cedex, France
+336 21 05 19 90
http://jo.irisson.free.fr/work/
#
jiho wrote:

            
"Spatial Point Pattern Analysis" only refers to cases where the 
locations of the points are 'interesting', which usually means they are 
generated by a stochastic process - like tree locations in a natural 
forest rather than rows of trees in a plantation.

  Analysis of data that comes from spatial locations that are 
'uninteresting' are another branch of statistics altogether. It will 
probably end up being generalised linear modelling with 
spatially-correlated errors, and how you deal with the correlations is 
the interesting part.

  See if you can write down a model for your data and include a 
smoothly-varying spatial error term.... Then maybe we can find some R 
code to solve it. I don't think we'll find it in Spatstat, which I think 
is still exclusively spatial point pattern analysis. Have a look at 
geoRglm maybe...

Barry
#
On 2008-February-11 , at 10:19 , Barry Rowlingson wrote:
Thanks for clarifying these terms. Indeed I am _not_ after spatial  
point pattern techniques. I changed the subject accordingly.
Thank you for the pointer. The vignette of geoRglm seems promising,  
though much is about prediction from a given model while I am most  
interested in which terms are in the model, i.e. which variables have  
a notable influence on the repartition of the organisms. My scenario  
seems simpler than those presented however, since the data are  
standardized by the sampling effort, meaning that the same Poisson law  
applies to all points.

A continuous variable than would represent the spatiality in this  
dataset could simply be the distance from the lower-left corner of the  
sampling grid for example, or the distance from the island around  
which the sampling grid is designed (such a distance would have a  
biological meaning since we expect the abundances to be inversely  
proportional to it). Is that something that could fit your definition  
of a "smoothly-varying spatial error term" or am I completely mistaken?

Your answer and the vignette of geoRglm highlight how little I know  
about all this (I am just a young biologist after all) and how much  
reading I need to do. The page of geoRglm has a nice list of  
publications:
	http://www.daimi.au.dk/~olefc/geoRglm/Intro/books.html
Could you (or someone else) direct me towards the best introductory  
text(s) on this matter please?

Thank you very much for your help.

Jean-Olivier Irisson
---
UMR 5244 CNRS-EPHE-UPVD, 52 av Paul Alduy, 66860 Perpignan Cedex, France
+336 21 05 19 90
http://jo.irisson.free.fr/work/
#
Jean-Olivier Irisson wrote:

            
I think you still need to fit a model, and then you can test how 
useful your covariates are with standard techniques.
Think about fitting a straight line through some points. You find the 
line that best fits your points. Then you look at the residual 
differences between the line and your points. All the usual linear model 
theory about predictions and significance depends on those residuals 
being uncorrelated and independent. If you are fitting a straight line 
to a curve then that won't be true, and if you then say something about 
your straight line based on the linear model theory you'll be wrong.

  Now, you could fit a non-spatial generalised linear model to your data 
using glm() in R and then map the residuals. If the residual map shows 
structure, then there's something else going on that your model hasn't 
accounted for. Perhaps there is an obvious trend due to a covariate 
you've not included, such as elevation above sea level. You could then 
add this to your model. If the residual surface looks like random noise 
then you can use standard linear model theory to make conclusions about 
your covariate parameters.

  If the residual surface doesn't look like random noise then that's 
when you get into geoRglm functions which (I think) fit a GLM where the 
error surface (that's your residuals) is defined by a gaussian random 
field with a fitted covariance structure. Once that's done, the geoRglm 
code will tell you about your covariate parameter significance (I think! 
It's been a while since I've used it. Maybe Paulo and Ole can expand on 
this).

  So what I'd do is:

  * fit a simple GLM using glm.
  * Look at parameter estimates and significance.
  * Draw a map of residuals.
  * Then worry about spatial correlation.

  Oh, I'd also, if I were you, try and find a local statistician expert!

Barry
#
I start by reposting my previous message which was sent from a  
different address and therefore probably did not reach the list. Sorry  
about this:
Now for the current message:
On 2008-February-11 , at 11:46 , Barry Rowlingson wrote:
Thank you very much for such a detailed explanation. This is very  
clear and helps me a lot. I already fitted a glm with spatial  
variables in it to inspect potential spatial effects but I never  
thought about mapping the residuals. I will refit the model excluding  
the spatial variables and check wether there is structure in the  
residuals as you advise. Then the inclusion of spatial variables may  
tell me something depending on their influence on the structure of the  
residuals.
That would probably be the hardest part :/ Unfortunately there's no  
statistics department nearby and although we have biostatisticians in  
the lab, this is far from their field of activity. This lack of local  
expertise is becoming more and more of a problem but statisticians are  
a rare species!

Thank you again for your help. Sincerely,

Jean-Olivier Irisson
---
UMR 5244 CNRS-EPHE-UPVD, 52 av Paul Alduy, 66860 Perpignan Cedex, France
+336 21 05 19 90
http://jo.irisson.free.fr/work/
#
Just to add to Barry email that geoRglm code
can indeed be used just to access covariate effects, without necessarily
perform any spatial interpolation.
Typicallyin tis implementation this will be via Bayesian framework
obtaining samples from the posterior distribution of the coefficients.


Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT  ufpr  br
http://www.leg.ufpr.br/~paulojus

-------------------------------------------------------------------------
53a Reuniao Anual da Regiao Brasileira da Soc. Internacional de Biometria
14 a 16/05/2008, UFLA, Lavras,MG
http://www.rbras.org.br/rbras53
-------------------------------------------------------------------------
On Mon, 11 Feb 2008, Barry Rowlingson wrote:

            
2 days later
#
Hello,
On 2008-February-11 , at 11:46 , Barry Rowlingson wrote:
Just to let you know how all this turned out. I started by fitting a  
regular glm (with poisson errors since I'm dealing with counts) trying  
to explain the abundances with environmental variables (wich are not  
spatial in essence but vary spatially). It did not explain much of the  
variability. I then added some explicitly spatial variables (location/ 
distance with respect to a point, latitude, longitude etc.) and after  
adding one of those most of the spatial variability is explained and  
the residuals don't show spatial patterns[1]. Of course the data does  
not show much spatial structure even at start and is highly variable  
but given the results of the model and the look of the residuals, I am  
still quite confident in saying that there was a spatial effect, and I  
can even interprete it biologically[2].

So thanks a lot for your detailed advice. The original question  
remains though:
	https://stat.ethz.ch/pipermail/r-sig-geo/2008-February/003138.html
I've explained some of the variability for the total abundance or for  
an assemblage of abundant species (a multivariate glm shows the same  
thing) but I would like to explicitly test wether the distribution of  
two species differ. Syrjala's test really looks like what I want to  
do. But either my implementation[3] is faulty (even two completely  
disjointed distributions are not significantly different) or it is  
meant to work on a much larger number of points to be efficient  
(Syrjala has 360 in the exemple presented in the paper). I think that,  
given that I have replicates of the same sampling, I should be able to  
gain some statistical power from this. Any advice would be welcome.

Thanks in advance.

[1] http://jo.irisson.free.fr/dropbox/spatial-residuals.pdf
The four columns represent data for the four successive sampling  
events. The first line shows the raw counts. There's not much spatial  
structure at the end but there are patterns of high abundance in  
rotation 1 and 2. The second line shows the residuals of the glm with  
only environmental factors which leaves much of the patterns in place.  
The third line is the residuals from a similar model with an added  
"location" factor which codes the windward/downwind situation of each  
point. It explains much of the spatial distribution of abundance,  
expect maybe for some points of rotation 1.

[2] For those interested in the details, the longitude or location  
with respect to the island both have an important and significant  
effect and show that the organisms are more abundant on the western or  
downwind side of the island, which is expected since water in enriched  
in nutrients at these locations.

[3] https://stat.ethz.ch/pipermail/r-sig-geo/2008-February/003143.html

Jean-Olivier Irisson
---
UMR 5244 CNRS-EPHE-UPVD, 52 av Paul Alduy, 66860 Perpignan Cedex, France
+336 21 05 19 90
http://jo.irisson.free.fr/work/
#
Dear Jo,

Variograms are a good tool to inspect spatial autocorrelation in the
data / residuals. But 36 locations is a rather small sample for doing
that. So you might get unstable variograms.

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-----Oorspronkelijk bericht-----
Van: r-sig-geo-bounces at stat.math.ethz.ch
[mailto:r-sig-geo-bounces at stat.math.ethz.ch] Namens jiho
Verzonden: donderdag 14 februari 2008 11:05
Aan: Barry Rowlingson
CC: r-sig-geo at stat.math.ethz.ch
Onderwerp: Re: [R-sig-Geo] Comparing abundances at fixed locations in
space -Syrjala test

Hello,
On 2008-February-11 , at 11:46 , Barry Rowlingson wrote:
Just to let you know how all this turned out. I started by fitting a  
regular glm (with poisson errors since I'm dealing with counts) trying  
to explain the abundances with environmental variables (wich are not  
spatial in essence but vary spatially). It did not explain much of the  
variability. I then added some explicitly spatial variables (location/ 
distance with respect to a point, latitude, longitude etc.) and after  
adding one of those most of the spatial variability is explained and  
the residuals don't show spatial patterns[1]. Of course the data does  
not show much spatial structure even at start and is highly variable  
but given the results of the model and the look of the residuals, I am  
still quite confident in saying that there was a spatial effect, and I  
can even interprete it biologically[2].

So thanks a lot for your detailed advice. The original question  
remains though:
	
https://stat.ethz.ch/pipermail/r-sig-geo/2008-February/003138.html
I've explained some of the variability for the total abundance or for  
an assemblage of abundant species (a multivariate glm shows the same  
thing) but I would like to explicitly test wether the distribution of  
two species differ. Syrjala's test really looks like what I want to  
do. But either my implementation[3] is faulty (even two completely  
disjointed distributions are not significantly different) or it is  
meant to work on a much larger number of points to be efficient  
(Syrjala has 360 in the exemple presented in the paper). I think that,  
given that I have replicates of the same sampling, I should be able to  
gain some statistical power from this. Any advice would be welcome.

Thanks in advance.

[1] http://jo.irisson.free.fr/dropbox/spatial-residuals.pdf
The four columns represent data for the four successive sampling  
events. The first line shows the raw counts. There's not much spatial  
structure at the end but there are patterns of high abundance in  
rotation 1 and 2. The second line shows the residuals of the glm with  
only environmental factors which leaves much of the patterns in place.  
The third line is the residuals from a similar model with an added  
"location" factor which codes the windward/downwind situation of each  
point. It explains much of the spatial distribution of abundance,  
expect maybe for some points of rotation 1.

[2] For those interested in the details, the longitude or location  
with respect to the island both have an important and significant  
effect and show that the organisms are more abundant on the western or  
downwind side of the island, which is expected since water in enriched  
in nutrients at these locations.

[3] https://stat.ethz.ch/pipermail/r-sig-geo/2008-February/003143.html

Jean-Olivier Irisson
---
UMR 5244 CNRS-EPHE-UPVD, 52 av Paul Alduy, 66860 Perpignan Cedex, France
+336 21 05 19 90
http://jo.irisson.free.fr/work/

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo