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.