calc.bandwidths.and.edgecorr: Compute bandwidths and edge-correction factors for...

View source: R/calc_bandwidths_and_edgecorr.R

calc.bandwidths.and.edgecorrR Documentation

Compute bandwidths and edge-correction factors for spatio-temporal kernel intensity estimation

Description

Computes spatial and temporal bandwidths for kernel-based estimation of the intensity of a spatio-temporal point pattern. The spatial bandwidth is estimated from the spatial coordinates using Diggle's (1985) mean-square error method via bw.diggle. The temporal bandwidth is estimated from the time coordinates using the Sheather–Jones direct plug-in method (bw = "SJ-dpi") as implemented in density.

Usage

calc.bandwidths.and.edgecorr(
  X,
  s.region,
  t.region,
  n.grid,
  epsilon = NULL,
  delta = NULL
)

Arguments

X

A numeric matrix or data frame with at least three columns giving the x-, y-, and time coordinates t of observed spatio-temporal events. Each row corresponds to one event.

s.region

A numeric matrix with two columns giving the vertices of the polygonal spatial observation window in order (the first vertex need not be repeated at the end).

t.region

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

n.grid

An integer vector of length 3 giving the number of grid cells in the x, y, and time dimensions. Only n.grid[3] is used when estimating the temporal bandwidth.

epsilon

Optional positive numeric. Spatial bandwidth. If NULL, estimated using bw.diggle.

delta

Optional positive numeric. Temporal bandwidth. If NULL, estimated using density(..., bw = "SJ-dpi").

Details

Edge-correction factors are computed for Gaussian kernels as the kernel mass inside the observation window: c(x) = \int_W K_h(u-x)\,du. The temporal correction is computed exactly over t.region. The spatial correction is computed using the Diggle edge-correction method as implemented in spatstat.explore, which accounts for the polygonal spatial observation window.

The spatial window is converted to an owin object, and the spatial bandwidth is estimated using Diggle's mean-square error method via bw.diggle applied to the corresponding ppp object. Spatial edge-correction factors are computed using the Diggle edge-correction method implemented in spatstat.explore.

The temporal bandwidth is selected using the Sheather–Jones direct plug-in method (bw = "SJ-dpi") as implemented in density over t.region.

The returned edge-correction factors are kernel masses inside the window. If you use them for intensity estimation with edge correction, typical usage is to divide by these factors.

Value

A list with components:

bw

Numeric vector of length 3: c(epsilon, epsilon, delta).

time

Numeric vector of length nrow(X) giving temporal edge masses \int_{tmin}^{tmax} K_\delta(u-t_i)\,du.

space

Numeric vector of length nrow(X) giving spatial edge-correction factors computed using the Diggle method for the polygonal window s.region.

References

Baddeley A, Rubak E, Turner R (2015). Spatial Point Patterns: Methodology and Applications with R. Chapman and Hall/CRC Press.

Diggle, P.J. (1985). A Kernel Method for Smoothing Point Process Data. Journal of the Royal Statistical Society, Series C, 34, 138–147.

See Also

bw.diggle, density

Examples

  set.seed(123)
  X <- cbind(runif(100), runif(100), runif(100, 0, 10))
  s.region <- matrix(c(0,0, 1,0, 1,1, 0,1), ncol = 2, byrow = TRUE)
  t.region <- c(0, 10)
  n.grid <- c(25, 25, 20)
  res <- calc.bandwidths.and.edgecorr(X, s.region, t.region, n.grid)
  str(res)


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