sbss_asymp: Asymptotic Test for the White Noise Dimension in a Spatial...

View source: R/sbss_test.R

sbss_asympR Documentation

Asymptotic Test for the White Noise Dimension in a Spatial Blind Source Separation Model

Description

sbss_asymp uses asymptotic theory 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_asymp(x, ...)

## Default S3 method:
sbss_asymp(x, coords, q, kernel_parameters, 
           kernel_list = NULL, ...)
## S3 method for class 'SpatialPointsDataFrame'
sbss_asymp(x, ...)
## S3 method for class 'sf'
sbss_asymp(x, ...)

Arguments

x

either a numeric matrix of dimension c(n, p) where the p columns correspond to the entries of the random field and the n rows are the observations, an object of class SpatialPointsDataFrame or an object of class sf.

coords

a numeric matrix of dimension c(n,2) where each row represents the coordinates of a point in the spatial domain. Only needed if x is a matrix and the argument kernel_list is NULL.

q

an integer between 0 and p - 1 specifying the number of hypothetical signal components (null hypothesis) in the latent random field.

kernel_parameters

a numeric vector that gives the parameters for the ring kernel function. At least length of two, see details.

kernel_list

a list of spatial kernel matrices with dimension c(n,n), see details. Usually computed by the function spatial_kernel_matrix.

...

further arguments for the fast real joint diagonalization algorithm that jointly diagonalizes the local covariance matrices. See details and frjd.

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.

This function conducts the hypothesis test using the asymptotic null distribution of m, a chi-squared distribution with k(p - q)(p - q + 1)/2 degrees of freedom (k is the number jointly diagonalized local covariance matrices).

If more than one local covariance matrix is used sbss_asymp 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_asymp 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

degrees of freedom for the asymptotic chi-squared distribution of the test statistic under the null hypothesis.

p.value

the p-value of the test.

s

object of class(x) containing the estimated source random field.

coords

coordinates of the observations. Is NULL if x was a matrix and the argument kernel_list was not NULL at the sbss_asymp call.

w

estimated unmixing matrix.

w_inv

inverse of the estimated unmixing matrix.

d

matrix of stacked (jointly) diagonalized local covariance matrices with dimension c((length(kernel_parameters) / 2)*p,p).

x_mu

columnmeans of x.

cov_inv_sqrt

square root of the inverse sample covariance matrix of x.

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, \Sexpr[results=rd]{tools:::Rd_expr_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 asymptotic test for a hypothetical latent white noise dimension of q
  # q can lie between 0 and 3 in this case
  # using one ring kernel function and the null hypothesis q = 1
  asymp_res_1 <- 
    sbss_asymp(observed_field, coords, q = 1, kernel_parameters = c(0, 1))
  
  # using two ring kernel functions and the null hypothesis q = 3
  asymp_res_2 <- 
    sbss_asymp(observed_field, coords, q = 3, kernel_parameters = c(0, 1, 1, 2))
    
  # 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(asymp_res_1)
  print(asymp_res_2)
  
  # plot latent field (plot method for an object of class sbss)
  plot(asymp_res_1, colorkey = TRUE, as.table = TRUE, cex = 1)
  
  # predict latent fields on grid (predict method for an object of class sbss)
  predict(asymp_res_1, colorkey = TRUE, as.table = TRUE, cex = 1)
  
  # unmixing matrix (coef method for an object of class sbss)
  w_unmix <- coef(asymp_res_1)
}


SpatialBSS documentation built on July 26, 2023, 5:37 p.m.