Learn R Programming

SepTest (version 0.0.1)

sim.procedures: Generate permuted versions (pure or block) of a spatio-temporal point pattern

Description

Implements two types of permutation procedures for resampling the time component of spatio-temporal point process data:

"pure"

Pure random permutation of the time coordinates.

"block"

Block permutation where the time dimension is divided into consecutive blocks, and permutations are applied at the block level.

These procedures are used for generating surrogate datasets under the null hypothesis of first-order separability.

Usage

sim.procedures(X, nperm = 1999, nblocks = 4, method = c("block", "pure"))

Value

A list of nperm matrices. Each matrix is a permuted version of the original input X, where the third column (time) has been resampled based on the selected method.

Arguments

X

A numeric matrix or data frame with at least three columns, where the third column represents time.

nperm

Integer. The number of permuted datasets to generate.

nblocks

Integer. The number of temporal blocks to use for block permutation. Must be > 2.

method

Character. The permutation strategy to use. One of "pure" or "block".

Examples

Run this code

set.seed(123)
X <- cbind(runif(100), runif(100), sort(runif(100)))

# Pure permutation
sims_pure <- sim.procedures(X, nperm = 10, method = "pure")
head(sims_pure[[1]])
# Block permutation
sims_block <- sim.procedures(X, nperm = 10, nblocks = 5, method = "block")

# Visualize the first result from block permutation
plot_stpp(sims_block[[1]], type = "3D")

Run the code above in your browser using DataLab