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
testing for CSR based on F and G functions
3 messages · Adrian Baddeley, zhijie zhang
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20060621/69b73a6e/attachment.pl>
Zhijie Zhang writes:
> FminG <- function(X, ...) {
> FX <- Fest(X, ...)
> GX <- Gest(X, r=FX$r)
> return(eval.fv(FX - GX))
> }
> You use the default value of r. HELP says First-time users are strongly
> advised not to specify this argument. If i want to specify it , how to
> complete it in the above *FminG *functions?
Just pass the argument 'r=rvalues' to the function.
The "..." argument can be anything, including an argument 'r=rvalues',
so we can type
rvalues <- seq(0, 0.3, length=100)
FminG(cells, r=rvalues)
You can do the same thing with envelope(), e.g.
envelope(cells, FminG, r=rvalues, global=TRUE)
----
regards
Adrian Baddeley