View source: R/chisq_test_STPP.R
| chisq.test.stPP | R Documentation |
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.
chisq.test.stPP(
X,
n.space = 2L,
n.time = 3L,
s.region = c(0, 1, 0, 1),
t.region = c(0, 1)
)
X |
A numeric matrix or data frame with at least three columns giving event coordinates
|
n.space |
Integer (>= 2). Number of bins per spatial axis. The contingency table has
|
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
|
t.region |
Numeric vector of length 2 giving the temporal window |
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.
A list with components:
Numeric scalar. The chi-squared test statistic.
Numeric scalar. The p-value of the chi-squared test.
Integer matrix of dimension n.space^2 by n.time containing the space–time counts.
Jiří Dvořák dvorak@karlin.mff.cuni.cz
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.
chi2.test, chisq.test
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.