[R-sig-Geo] testing for CSR based on F and G functions
Adrian Baddeley
adrian at maths.uwa.edu.au
Wed Jun 21 07:32:46 CEST 2006
Zhijie Zhang asked how to test for CSR using the
max absolute difference between the functions F and G.
A solution has been provided in package 'splancs'.
For comparison, here's how to do this in package 'spatstat',
illustrated for the 'cells' dataset.
library(spatstat)
FminG <- function(X, ...) {
FX <- Fest(X, ...)
GX <- Gest(X, r=FX$r)
return(eval.fv(FX - GX))
}
data(cells)
E <- envelope(cells, FminG, global=TRUE)
plot(E)
E
Plotting the envelope E shows that the null hypothesis of CSR is rejected.
(This plot even shows the correct y-axis label, "F(r) - G(r)", automatically).
Printing the envelope E prints the significance level of the test, etc.
By adding extra arguments to 'envelope' you can change the number of simulations (nsim),
the significance level (nrank/(nsim+1)), the interval of r values over which the
maximum absolute deviation is taken (ginterval) and the method of simulating from
the null hypothesis (simulate).
regards
Adrian Baddeley
More information about the R-sig-Geo
mailing list