View source: R/calc_bandwidths_and_edgecorr.R
| calc.bandwidths.and.edgecorr | R Documentation |
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.
calc.bandwidths.and.edgecorr(
X,
s.region,
t.region,
n.grid,
epsilon = NULL,
delta = NULL
)
X |
A numeric matrix or data frame with at least three columns giving the |
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
|
n.grid |
An integer vector of length 3 giving the number of grid cells in the |
epsilon |
Optional positive numeric. Spatial bandwidth. If |
delta |
Optional positive numeric. Temporal bandwidth. If |
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.
A list with components:
Numeric vector of length 3: c(epsilon, epsilon, delta).
Numeric vector of length nrow(X) giving temporal edge masses
\int_{tmin}^{tmax} K_\delta(u-t_i)\,du.
Numeric vector of length nrow(X) giving spatial edge-correction
factors computed using the Diggle method for the polygonal window s.region.
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.
bw.diggle, density
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.