| chi2.test | R Documentation |
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.
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)
)
X |
A numeric matrix or data frame with at least three columns giving event coordinates
|
sim.procedure |
Character string specifying the procedure: |
nblocks |
Integer (>= 2). Number of temporal blocks used for block permutation (only for |
nperm |
Integer (>= 1). Number of Monte Carlo permutations (only for |
n.time |
Integer (>= 2). Number of temporal intervals in the contingency table. |
n.space |
Integer (>= 2). The spatial domain is partitioned into |
t.region |
Numeric vector of length 2 giving the temporal window |
s.region |
Spatial window specification. By default, the bounding box |
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).
Numeric scalar: the p-value of the test.
Mohammad Ghorbani mohammad.ghorbani@slu.se
Nafiseh Vafaei nafiseh.vafaei@slu.se
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.
chisq.test.stPP, sim.procedures, block.permut
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.