CC.test {NTSS}R Documentation

Random shift test of independence in a bivariate random field

Description

Nonparametric test of independence between a pair of random fields based on random shifts. Either the torus correction or the variance correction can be used, see Mrkvička et al. (2021). The variance correction is recommended for random fields with nontrivial autocorrelations.

Usage

CC.test(
  covariateA,
  covariateB,
  test.points,
  N.shifts = 999,
  radius,
  correction,
  type = "Kendall",
  verbose = FALSE
)

Arguments

covariateA

first random field (object of class im)

covariateB

second random field (object of class im)

test.points

point pattern providing the set of sampling points (object of class ppp)

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 test statistic should be used (possible choices are "Kendall", "Pearson" and "covariance")

verbose

logical value indicating whether auxiliary information should be printed and auxiliary figures plotted during the computation

Details

The test statistic can be either the sample covariance or the sample Kendall's or Pearson's correlation coefficient. The choice of the test statistic 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 Mrkvička et al. (2021), the variance correction is recommended for random fields with nontrivial autocorrelations.

The two realizations of the random fields (defined on the same domain) to be tested should be supplied in the covariateA, covariateB arguments as objects of the class im as used in the spatstat package. The pattern of sampling points in which the test statistic is evaluated is given in the argument test.points as an object of the class ppp.

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.

Value

The p-value of the random shift test of independence between a pair of random fields.

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)

set.seed(123)

elevation <- bei.extra$elev
slope <- bei.extra$grad
plot(elevation)
plot(slope)

test.points <- runifpoint(100, win=bei$window)

# tests run with only 99 shifts to speed up the computation
out1 <- CC.test(covariateA=elevation, covariateB=slope, test.points=test.points, N.shifts=99,
                radius=250, type="Kendall", correction="torus", verbose=TRUE)
out1

out2 <- CC.test(covariateA=elevation, covariateB=slope, test.points=test.points, N.shifts=99,
                radius=250, type="Kendall", correction="variance", verbose=TRUE)
out2


[Package NTSS version 0.1.3 Index]