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

View source: R/chisq_test_STPP.R

chisq.test.stPPR Documentation

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

Description

Performs the classical (asymptotic) chi-squared test of first-order separability by constructing a space-time contingency table of counts and applying a chi-squared test of independence.

Usage

chisq.test.stPP(
  X,
  n.space = 2L,
  n.time = 3L,
  s.region = c(0, 1, 0, 1),
  t.region = c(0, 1)
)

Arguments

X

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

n.space

Integer (>= 2). Number of bins per spatial axis. The contingency table has n.space^2 rows.

n.time

Integer (>= 2). Number of temporal bins (columns of the contingency table).

s.region

Numeric vector of length 4 giving the spatial bounding box c(xmin, xmax, ymin, ymax). Defaults to the unit box c(0,1,0,1).

t.region

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

Details

The spatial domain is partitioned into n.space bins in each coordinate direction (yielding n.space^2 spatial cells), and the temporal domain is partitioned into n.time intervals. Bin boundaries are defined using empirical quantiles of the observed coordinates, with the first/last boundaries fixed to the provided spatial and temporal windows.

Events falling outside s.region or t.region are ignored (with a warning). If the data contain many ties, quantile-based boundaries may coincide; in that case reduce n.space/n.time or jitter the coordinates slightly.

This implementation uses chisq.test on the contingency table of space–time counts. If expected counts are very small, the chi-squared approximation may be poor; in that case consider using a Monte Carlo approach (e.g., block permutation) as implemented in chi2.test.

Value

A list with components:

chisq_s

Numeric scalar. The chi-squared test statistic.

chisq_p

Numeric scalar. The p-value of the chi-squared test.

counts

Integer matrix of dimension n.space^2 by n.time containing the space–time counts.

Author(s)

Jiří Dvořák dvorak@karlin.mff.cuni.cz

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.

See Also

chi2.test, chisq.test

Examples


lambda <- get.lambda.function(N = 200, g = 50, model = 4)
Lmax <- get.lambda.max(N = 200, g = 50, model = 4)
X <- rstpoispp(lambda, Lmax)
result <- chisq.test.stPP(X, n.space = 2, n.time = 2)
print(result)


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