sbss_boot {SpatialBSS} | R Documentation |
Different Bootstrap Tests for the White Noise Dimension in a Spatial Blind Source Separation Model
Description
sbss_boot
uses bootstrap tests for the spatial blind source separation (SBSS) methodology to test if the last p - q
entries of the latent random field are white noise assuming that the p
-variate observed random field follows a SBSS model.
Usage
sbss_boot(x, ...)
## Default S3 method:
sbss_boot(x, coords, q, kernel_parameters,
boot_method = c('permute', 'parametric'),
n_boot = 200, kernel_list = NULL, ...)
## S3 method for class 'SpatialPointsDataFrame'
sbss_boot(x, ...)
## S3 method for class 'sf'
sbss_boot(x, ...)
Arguments
x |
either a numeric matrix of dimension |
coords |
a numeric matrix of dimension |
q |
an integer between |
kernel_parameters |
a numeric vector that gives the parameters for the ring kernel function. At least length of two, see details. |
boot_method |
a string indicating which bootstrap strategy is used, see details. Either |
n_boot |
positive integer specifying the number of bootstrap samples. Default is |
kernel_list |
a list of spatial kernel matrices with dimension |
... |
further arguments for the fast real joint diagonalization algorithm that jointly diagonalizes the local covariance matrices. See details and |
Details
This function uses the SBSS methodology in conjunction with local covariance matrices based on ring kernel functions to estimate the p
-variate latent random field s = x^{wh} w
, where x^{wh}
is the whitened version of the data and w
is the estimated unmixing matrix. The considered (adapted) local covariance matrices write as
LCov^* = 1/(n F^{1/2}_n) \sum_{i,j} I(r_i < d_{i,j} \le r_o) (x(s_i)-\bar{x}) (x(s_j)-\bar{x})'
with
F_n = 1 / n \sum_{i,j} I(r_i < d_{i,j} \le r_o).
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
(which is the i-th row of the argument x
and the location corresponds to the i-th row of the argument coords
) and \bar{x}
is the sample mean vector. The function argument kernel_parameters
determines the parameters of the used ring kernel functions or alternatively a list of kernel matrices can be given with the argument kernel_list
, see sbss
for details.
The null hypothesis specified with the argument q
states that the last p - q
components of the estimated latent field are white noise. The method orders the components of the latent field by the order of the decreasing sums of squares of the corresponding (pseudo-)eigenvalues of the local covariance matrices produced by the joint diagonalization algorithm (or the eigendecomposition if only one local covariance matrix is used). Under the null the lower right (p - q) * (p - q)
block matrices of the jointly diagonalized local covariance matrices equal zero matrices. Therefore, the sum of their squared norms m
is used as test statistic for the bootstrap based inference methods described below.
Compute the test statistic
m
based on the original datax
.The estimated latent field
s
(its dimension isc(n,p)
) is split into the signal part (firstq
columns) and the white noise part (lastp - q
columns).Replace the noise part by a bootstrap sample drawn based on one of the two strategies described below.
Recombine the signal part and resampled noise part by concatenating the columns leading to
s^{bs}
and back-transform it byx^{bs} = s^{bs} w^{-1}
.Compute the test statistic
m^{bs}
based onx^{bs}
.Repeat Step 2 - 5 for a total amount of
n_boot
times (default is200
) and the p-value of the bootstrap test is computed by(sum(m > m^{bs}) + 1) / (n_{boot} + 1).
The argument boot_method
(default is "permute"
) specifies the used resample strategy. The two following strategies are implemented:
-
boot_method = "permute"
: This strategy is non-parametric. It draws each bootstrap sample from the vector of alln(p - q)
observed hypothetical white noise observations. -
boot_method = "parametric"
: This is parametric. Each bootstrap sample is drawn independently and identically from the standard normal distribution.
If more than one local covariance matrix is used sbss_boot
jointly diagonalizes these matrices with the function frjd
. ...
provides arguments for frjd
, useful arguments might be:
-
eps
: tolerance for convergence. -
maxiter
: maximum number of iterations.
Value
sbss_boot
returns a list of class 'sbss_test'
inheriting from the classes 'htest'
and 'sbss'
with the following entries:
alternative |
a string containing the alternative hypothesis. |
method |
a string which indicates which test methods was used. |
data.name |
a string specifying the name of the used data. |
statistic |
the value of the test statistic. |
parameters |
a integer specifying the number of generated bootstrap samples (the value of the argument |
p.value |
the p-value of the test. |
s |
object of |
coords |
coordinates of the observations. Is |
w |
estimated unmixing matrix. |
w_inv |
inverse of the estimated unmixing matrix. |
d |
matrix of stacked (jointly) diagonalized local covariance matrices with dimension |
x_mu |
columnmeans of |
cov_inv_sqrt |
square root of the inverse sample covariance matrix of |
References
Muehlmann, C., Bachoc, F., Nordhausen, K. and Yi, M. (2022), Test of the Latent Dimension of a Spatial Blind Source Separation Model, to appear in Statistica Sinica, doi:10.5705/ss.202021.0326.
See Also
sbss
, spatial_kernel_matrix
, local_covariance_matrix
, sp
,
sf
, frjd
Examples
# simulate coordinates
n <- 1000
coords <- runif(n * 2) * 20
dim(coords) <- c(n, 2)
coords_df <- as.data.frame(coords)
names(coords_df) <- c("x", "y")
# simulate random field
if (!requireNamespace('gstat', quietly = TRUE)) {
message('Please install the package gstat to run the example code.')
} else {
library(gstat)
model_1 <- gstat(formula = z ~ 1, locations = ~ x + y, dummy = TRUE, beta = 0,
model = vgm(psill = 0.025, range = 1, model = 'Exp'), nmax = 20)
model_2 <- gstat(formula = z ~ 1, locations = ~ x + y, dummy = TRUE, beta = 0,
model = vgm(psill = 0.025, range = 1, kappa = 2, model = 'Mat'),
nmax = 20)
field_1 <- predict(model_1, newdata = coords_df, nsim = 1)$sim1
field_2 <- predict(model_2, newdata = coords_df, nsim = 1)$sim1
field_3 <- rnorm(n)
field_4 <- rnorm(n)
latent_field <- cbind(as.matrix(cbind(field_1, field_2)), field_3, field_4)
mixing_matrix <- matrix(rnorm(16), 4, 4)
observed_field <- latent_field %*% t(mixing_matrix)
# apply the bootstrap tests for a hypothetical latent white noise dimension of q
# q can lie between 0 and 3 in this case
# using one ring kernel function with the permute strategy
# and the null hypothesis q = 1
boot_res_1 <-
sbss_boot(observed_field, coords, q = 1, kernel_parameters = c(0, 1),
boot_method = 'permute', n_boot = 100)
# using two one ring kernel function with the parametric strategy
# and the null hypothesis q = 3
boot_res_2 <-
sbss_boot(observed_field, coords, q = 3, kernel_parameters = c(0, 1, 1, 2),
boot_method = 'parametric', n_boot = 100)
# the result is of class sbss_test which is inherited from htest and sbss
# print object (print method for an object of class htest)
print(boot_res_1)
print(boot_res_2)
# plot latent field (plot method for an object of class sbss)
plot(boot_res_1, colorkey = TRUE, as.table = TRUE, cex = 1)
# predict latent fields on grid (predict method for an object of class sbss)
predict(boot_res_1, colorkey = TRUE, as.table = TRUE, cex = 1)
# unmixing matrix (coef method for an object of class sbss)
w_unmix <- coef(boot_res_1)
}