PP.test {NTSS} | R Documentation |
Random shift test of independence in a bivariate point process
Description
Nonparametric test of independence between a pair of point processes based on random shifts. Either the torus correction or the variance correction can be used (note that the variance correction is not yet implemented in this package but the corresponding source codes can be obtained from the authors upon request).
Usage
PP.test(
X,
Y,
N.shifts = 999,
radius,
correction,
statistic,
rmax.K = NULL,
verbose = FALSE
)
Arguments
X |
first point pattern dataset (object of class |
Y |
second point pattern dataset (object of class |
N.shifts |
integer, how many random shifts should be performed in the random shift test |
radius |
positive real number determining the radius of the disk on which the shift vectors are uniformly distributed |
correction |
which correction should be applied in the random shift test (possible choices are "torus" and "variance") |
statistic |
which test statistic should be used (possible choices are "K12" and "ED12") |
rmax.K |
positive real number, for the cross K-function determines the maximum argument to be considered |
verbose |
logical value indicating whether auxiliary information should be printed and auxiliary figures plotted during the computation |
Details
The test statistic is either the cross K-function K12 or the expectation of the cross nearest-neighbor distance ED12, see the paper Mrkvička et al. (2021). It is recommended to use the K12 statistic for regular and Poisson processes, while it is recommended to use ED12 for cluster processes due to the potential liberality of K12 in this case.
The two observed point patterns to be tested should be supplied using the
arguments X
and Y
. The shift vectors are generated from the
uniform distribution on the disk with radius given by the argument radius
and centered in the origin.
The test statistic is determined by the argument statistic
. For "K12", the test statistic
is functional, the stationary cross K-function. The range of arguments is from 0 to rmax.K
(there
is a sensible default). The outcome of the test is determined by the global envelope test in this case.
Alternatively, the statistic
can be set to "ED12", meaning that the test statistic is scalar,
the expectation of the cross nearest-neighbor distance. The outcome of the test is determined by the
classical univariate Monte Carlo test in this case.
The argument verbose
determines if auxiliary information and plots should be provided.
Value
The p-value of the random shift test of independence between a pair of point processes.
References
T. Mrkvička, J. Dvořák, J.A. González, J. Mateu (2021): Revisiting the random shift approach for testing in spatial statistics. Spatial Statistics 42, 100430.
Examples
library(spatstat)
library(GET)
set.seed(123)
X <- rpoispp(150)
Y <- rpoispp(150)
# tests run with only 99 shifts to speed up the computation
out1 <- PP.test(X=X, Y=Y, N.shifts = 99, radius=0.5, statistic="K12",
correction="torus", verbose=TRUE)
out1
plot(out1$GET.outcome)
out2 <- PP.test(X=X, Y=Y, N.shifts = 99, radius=0.5, statistic="ED12",
correction="torus", verbose=TRUE)
out2