CWR.test {NTSS} | R Documentation |
Random shift test of independence between a point process and a covariate
Description
Nonparametric test of independence between a point process and a random field (covariate of interest), taking into account the possible effect of nuisance covariates, see Dvořák and Mrkvička (2022). The test is based on random shifts. Either the torus correction or the variance correction can be used, see Mrkvička et al. (2021).
Usage
CWR.test(
X,
covariate.interest,
covariates.nuisance,
N.shifts = 999,
radius,
correction,
type = "raw",
nonparametric = TRUE,
verbose = FALSE,
bw.factor.rhonhat = 1
)
Arguments
X |
point pattern dataset (object of class |
covariate.interest |
random field (object of class |
covariates.nuisance |
list of covariates (objects 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") |
type |
which type of residuals should be used when computing the test statistic (possible choices are "raw", "Pearson" and "inverse") |
nonparametric |
logical value indicating whether nonparametric residuals should be used when computing the test statistic |
verbose |
logical value indicating whether auxiliary information should be printed and auxiliary figures plotted during the computation |
bw.factor.rhonhat |
multiplicative factor used when determining the bandwidth in the nonparametric estimation of the intensity function depending on the nuisance covariates (defaults to 1) |
Details
The test statistic is the covariate-weighted residual measure of the observation window, see the paper Dvořák and Mrkvička (2022). If no nuisance covariates are given, the null model assumes a constant intensity function of the point process. If one or more nuisance covariates are provided, the null model assumes an intensity function depending on the nuisance covariates (but not on the covariate of interest) and the residuals are constructed using this intensity function.
The residuals can be constructed in a nonparametric way (see Baddeley et al. (2012))
or in a parametric way (assuming a log-linear form of the intensity function
and using the ppm
function from the spatstat
package,
see Baddeley et al. (2015)). This choice is given by the argument nonparametric
.
The nonparametric residuals are recommended if the log-linear form of the intensity function
is not clearly justified.
Also, different types of residuals can be considered (raw, Pearson or inverse,
see Baddeley et al. (2015)). This choice is given by the argument type
.
The torus correction can be applied for rectangular windows. On the other hand,
the variance correction is applicable both for rectangular and for irregular windows.
The choice of the correction is given by the argument correction
.
Based on the simulation studies in Dvořák and Mrkvička (2022),
the torus and variance corrections perform almost equally well for the CWR test.
Hence, the torus correction is recommended for its smaller computational cost.
The observed point pattern should be supplied using the argument X
.
The realization of the covariate of interest should be supplied using
the argument covariate.interest
. The set of nuisance covariates should
be supplied as a list using the argument covariates.nuisance
. This list
can be empty if no nuisance covariates are considered.
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 argument verbose
determines if
auxiliary information and plots should be provided.
In case the observation window accompanying the point pattern is irregular,
it must be specified in the form of a binary mask due to the specific implementation of the test.
For details on binary masks see the help for the spatstat
function owin
.
Value
The p-value of the random shift test of independence between a point process and a covariate, taking into account possible effects of nuisance covariates.
References
J. Dvořák, T. Mrkvička (2022): Nonparametric testing of the covariate significance for spatial point patterns under the presence of nuisance covariates. https://arxiv.org/abs/2210.05424
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.
A. Baddeley, E. Rubak, R. Turner (2015) Spatial Point Patterns: Methodology and Applications with R. Chapman & Hall Interdisciplinary Statistics Series. CRC Press, Boca Raton, Florida.
A. Baddeley, Y.-M. Chang, Y. Song, R. Turner (2012) Nonparametric estimation of the dependence of a point process on spatial covariates. Statistics and Its Interface 5(2), 221?236.
Examples
library(spatstat)
library(ks)
# the point pattern
X <- bei
plot(X)
# two covariates are available
elevation <- bei.extra$elev
slope <- bei.extra$grad
plot(elevation)
plot(slope)
# test with no nuisance covariates, with only 99 shifts to speed up the computation
out1 <- CWR.test(X, covariate.interest=elevation, covariates.nuisance=NULL, N.shifts = 99,
verbose=TRUE, correction="torus", radius=250)
out1
# test with one nuisance covariate, with only 99 shifts to speed up the computation
out2 <- CWR.test(X, covariate.interest=elevation, covariates.nuisance=list(slope=slope),
N.shifts = 99, verbose=TRUE, correction="torus", radius=250)
out2