chi2.test: Chi-squared test for first-order separability of a...

View source: R/chi2_test.R

chi2.testR Documentation

Chi-squared test for first-order separability of a spatio-temporal point process

Description

Performs a chi-squared test for testing first-order separability of a spatio-temporal point process. Two procedures are available:

"pure_per"

Classical asymptotic chi-squared test of independence on a space–time count table.

"block_per"

Monte Carlo permutation test based on block-wise permutations of the time component.

Usage

chi2.test(
  X,
  sim.procedure = c("pure_per", "block_per"),
  nblocks = 5L,
  nperm = 199L,
  n.time = 2L,
  n.space = 3L,
  t.region = c(0, 1),
  s.region = c(0, 1, 0, 1)
)

Arguments

X

A numeric matrix or data frame with at least three columns giving event coordinates (x, y, t).

sim.procedure

Character string specifying the procedure: "pure_per" or "block_per".

nblocks

Integer (>= 2). Number of temporal blocks used for block permutation (only for "block_per").

nperm

Integer (>= 1). Number of Monte Carlo permutations (only for "block_per").

n.time

Integer (>= 2). Number of temporal intervals in the contingency table.

n.space

Integer (>= 2). The spatial domain is partitioned into n.space bins per axis (yielding n.space^2 spatial cells) for the contingency table.

t.region

Numeric vector of length 2 giving the temporal window c(tmin, tmax) with tmin < tmax.

s.region

Spatial window specification. By default, the bounding box c(0, 1, 0, 1) corresponding to c(xmin, xmax, ymin, ymax). Passed to chisq.test.stPP.

Details

The classical procedure ("pure_per") applies a chi-squared test of independence to the n.space^2 by n.time contingency table of counts.

The permutation procedure ("block_per") generates up to nperm block-permuted datasets under the null using sim.procedures with method = "block", recomputes the chi-squared statistic for each, and returns a Monte Carlo p-value computed as (1 + \#\{T_i \ge T_{obs}\})/(nperm + 1).

Value

Numeric scalar: the p-value of the test.

Author(s)

Mohammad Ghorbani mohammad.ghorbani@slu.se
Nafiseh Vafaei nafiseh.vafaei@slu.se

References

Ghorbani M., Vafaei N., Dvořák J., Myllymäki M. (2021). Testing the first-order separability hypothesis for spatio-temporal point patterns. Computational Statistics and Data Analysis, 161, 107245.

Ghorbani, M., Vafaei, N. and Myllymäki, M. (2025). A kernel-based test for the first-order separability of spatio-temporal point processes, TEST.

See Also

chisq.test.stPP, sim.procedures, block.permut

Examples


set.seed(124)
lambda <- get.lambda.function(N = 200, g = 50, model = 4)
Lmax <- get.lambda.max(N = 200, g = 50, model = 4)
X <- rstpoispp(lambda, Lmax)


# Classical chi-squared test
chi2.test(X, sim.procedure = "pure_per", n.time = 2, n.space = 3)

# Monte Carlo permutation test with blocks
chi2.test(X, sim.procedure = "block_per", nblocks = 5, nperm = 100)


SepTest documentation built on Feb. 3, 2026, 5:07 p.m.

Related to chi2.test in SepTest...