spatial_kernel_matrix | R Documentation |
spatial_kernel_matrix
computes spatial kernel matrices for a given kernel function with its parameters and a set of coordinates.
spatial_kernel_matrix(coords, kernel_type = c('ring', 'ball', 'gauss'),
kernel_parameters, angles = NULL)
coords |
a numeric matrix of dimension |
kernel_type |
a character string indicating which kernel function to use. Either |
kernel_parameters |
a numeric vector that gives the parameters for the kernel function. At least length of one for |
angles |
Optional argument specifying the anisotropic constraint. If |
Two versions of local covariance matrices can be defined:
'lcov'
:
LCov(f) = 1/n \sum_{i,j} f(d_{i,j}) (x(s_i)-\bar{x}) (x(s_j)-\bar{x})',
'ldiff'
:
LDiff(f) = 1/n \sum_{i,j} f(d_{i,j}) (x(s_i)-x(s_j)) (x(s_i)-x(s_j))',
'lcov_norm'
:
LCov^*(f) = 1/(n F^{1/2}_{f,n}) \sum_{i,j} f(d_{i,j}) (x(s_i)-\bar{x}) (x(s_j)-\bar{x})',
with
F_{f,n} = 1 / n \sum_{i,j} f^2(d_{i,j}).
Where d_{i,j} \ge 0
correspond to the pairwise distances between coordinates, x(s_i)
are the p
random field values at location s_i
, \bar{x}
is the sample mean vector, and the kernel function f(d)
determines the locality. The function spatial_kernel_matrix
computes a list of c(n,n)
matrices where each entry of these matrices correspond to the spatial kernel function evaluated at the distance between two points, mathematically the entry ij of each kernel matrix is f(d_{i,j})
. The following kernel functions are implemented and chosen with the argument kernel_type
:
'ring'
: parameters are inner radius r_i
and outer radius r_o
, with r_i < r_o
, and r_i, r_o \ge 0
:
f(d;r_i, r_o) = I(r_i < d \le r_o)
'ball'
: parameter is the radius r
, with r \ge 0
:
f(d;r) = I(d \le r)
'gauss'
: Gaussian function where 95% of the mass is inside the parameter r
, with r \ge 0
:
f(d;r) = exp(-0.5 (\Phi^{-1}(0.95) d/r)^2)
The argument kernel_type
determines the used kernel function as presented above, the argument kernel_parameters
gives the corresponding parameters for the kernel function. Specifically, if kernel_type
equals 'ball'
or 'gauss'
then kernel_parameters
is a numeric vector where each entry corresponds to one parameter. Hence, length(kernel_parameters)
spatial kernel matrices of type kernel_type
are computed. Whereas, if kernel_type
equals 'ring'
, then kernel_parameters
must be a numeric vector of even length where subsequently the inner and outer radii must be given (informally: c(r_i1, r_o1, r_i2, r_o2, ...)
). In that case length(kernel_parameters) / 2
spatial kernel matrices of type 'ring'
are computed.
If the optional argument angles
is provided, the computed spatial kernel matrices incorporate anisotropic constraints. The angles
argument must be a list of numeric vectors, where each vector consists of two values: \alpha_1
(the main direction) and \alpha_2
(the angular tolerance). The directional constraint ensures that only spatial relationships within the specified angle range are considered:
0 \leq \alpha_1 \leq 2\pi
defines the main direction in radians.
0 \leq \alpha_2 \leq \pi/2
specifies the angular tolerance.
When angles
is not NULL
, the function applies the kernel function only to points satisfying d_{ij} \angle e_{\alpha_1} \in [0, \alpha_2]
. If angles
is NULL
, the kernels are computed isotropically.
The output of this function can be used with the function sbss
to avoid unnecessary computation of kernel matrices when sbss
is called multiple times with the same coordinate/kernel function setting. Additionally, the output can be used with the function local_covariance_matrix
to actually compute local covariance matrices as defined above based on a given set of spatial kernel matrices.
spatial_kernel_matrix
returns a list with length of length(kernel_parameters)
(for 'ball'
and 'gauss'
kernel functions) or length(kernel_parameters) / 2
(for 'ring'
kernel function) containing numeric matrices of dimension c(n,n)
corresponding to the spatial kernel matrices.
Muehlmann, C., Cappello, C., De Iaco, S. and Nordhausen, K. (2025), Anisotropic Local Covariance Matrices for Spatial Blind Source Separation. Manuscript.
Muehlmann, C., Filzmoser, P. and Nordhausen, K. (2024), Spatial Blind Source Separation in the Presence of a Drift, Austrian Journal of Statistics, 53, 48-68, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.17713/ajs.v53i2.1668")}.
Bachoc, F., Genton, M. G, Nordhausen, K., Ruiz-Gazen, A. and Virta, J. (2020), Spatial Blind Source Separation, Biometrika, 107, 627-646, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/asz079")}.
sbss
, local_covariance_matrix
# simulate a set of coordinates
coords <- rnorm(100 * 2)
dim(coords) <- c(100, 2)
# computing two ring kernel matrices
kernel_params_ring <- c(0, 0.5, 0.5, 2)
ring_kernel_list <-
spatial_kernel_matrix(coords, 'ring', kernel_params_ring)
# computing three ball kernel matrices
kernel_params_ball <- c(0.5, 1, 2)
ball_kernel_list <-
spatial_kernel_matrix(coords, 'ball', kernel_params_ball)
# computing three gauss kernel matrices
kernel_params_gauss <- c(0.5, 1, 2)
gauss_kernel_list <-
spatial_kernel_matrix(coords, 'gauss', kernel_params_gauss)
# anisotropic examlple
# computing two ring kernel matrices each with two angles
kernel_params_ring <- c(0, 0.5, 0.5, 2)
angles_params <- list(c(pi / 4, pi / 4), c(3 * pi / 4, pi / 4))
ring_aniso_kernel_list <-
spatial_kernel_matrix(coords, 'ring', kernel_params_ring, angles_params)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.