snss_sd {SpatialBSS} | R Documentation |
Spatial Non-Stationary Source Separation Simultaneous Diagonalization
Description
snss_sd
estimates the unmixing matrix assuming a spatial non-stationary source separation model implying non-constant covariance by simultaneously diagonalizing two covariance matrices computed for two corresponding different sub-domains.
Usage
snss_sd(x, ...)
## Default S3 method:
snss_sd(x, coords, direction = c('x', 'y'),
ordered = TRUE, ...)
## S3 method for class 'list'
snss_sd(x, coords, ordered = TRUE, ...)
## S3 method for class 'SpatialPointsDataFrame'
snss_sd(x, ...)
## S3 method for class 'sf'
snss_sd(x, ...)
Arguments
x |
either a numeric matrix of dimension |
coords |
a numeric matrix of dimension |
direction |
a string indicating on which coordinate axis the domain is halved. Either |
ordered |
logical. If |
... |
further arguments to be passed to or from methods. |
Details
This function assumes that the random field x
is formed by
x(t) = A s(t) + b,
where A
is the deterministic p \times p
mixing matrix, b
is the p
-dimensional location vector, x
is the observable p
-variate random field given by the argument x
, t
are the spatial locations given by the argument coords
and s
is the latent p
-variate random field assumed to consist of uncorrelated entries that have zero mean but non-constant variances. This function aims to recover s
by
W(x(t) - \bar{x}),
where W
is the p \times p
unmixing matrix and \bar{x}
is the sample mean. The function does this by splitting the given spatial domain in half according to the first coordinate (argument direction
equals 'x'
) or the second coodinate (argument direction
equals 'y'
) and simultaneously diagonalizing the sample covariance matrices for each of the two sub-domains.
Alternatively the domain subdivison can be defined by providing lists of length two for the arguments x
and coords
where the first list entries correspond to the values and coordinates of the first sub-domain and the second entries to the values and coordinates of the second sub-domain.
Value
Similarly as sbss
the function snss_sd
returns a list of class 'snss'
and 'sbss'
with the following entries:
s |
object of |
coords |
coordinates of the observations. Only given if |
w |
estimated unmixing matrix. |
w_inv |
inverse of the estimated unmixing matrix. |
d |
diagonal matrix containing the eigenvalues of the eigendecomposition. |
x_mu |
columnmeans of |
cov_inv_sqrt |
square root of the inverse sample covariance matrix for the first sub-domain. |
References
Muehlmann, C., Bachoc, F. and Nordhausen, K. (2022), Blind Source Separation for Non-Stationary Random Fields, Spatial Statistics, 47, 100574, doi:10.1016/j.spasta.2021.100574.
See Also
Examples
# simulate coordinates
n <- 1000
coords <- runif(n * 2) * 20
dim(coords) <- c(n, 2)
# simulate random field
field_1 <- rnorm(n)
field_2 <- 2 * sin(pi / 20 * coords[, 1]) * rnorm(n)
field_3 <- rnorm(n) * (coords[, 1] < 10) + rnorm(n, 0, 3) * (coords[, 1] >= 10)
latent_field <- cbind(field_1, field_2, field_3)
mixing_matrix <- matrix(rnorm(9), 3, 3)
observed_field <- latent_field %*% t(mixing_matrix)
observed_field_sp <- sp::SpatialPointsDataFrame(coords = coords,
data = data.frame(observed_field))
sp::spplot(observed_field_sp, colorkey = TRUE, as.table = TRUE, cex = 1)
# apply snss_sd with split in x
res_x <- snss_sd(observed_field, coords, direction = 'x')
JADE::MD(W.hat = coef(res_x), A = mixing_matrix)
# apply snss_sd with split in y
# should be much worse as field shows only variation in x
res_y <- snss_sd(observed_field, coords, direction = 'y')
JADE::MD(W.hat = coef(res_y), A = mixing_matrix)
# print object
print(res_x)
# plot latent field
plot(res_x, colorkey = TRUE, as.table = TRUE, cex = 1)
# predict latent fields on grid
predict(res_x, colorkey = TRUE, as.table = TRUE, cex = 1)
# unmixing matrix
w_unmix <- coef(res_x)
# apply snss_sd with SpatialPointsDataFrame object
res_x_sp <- snss_sd(observed_field_sp, direction = 'x')
# apply with list arguments
# first axis split by 5
flag_coords <- coords[, 1] < 5
coords_list <- list(coords[flag_coords, ],
coords[!flag_coords, ])
field_list <- list(observed_field[flag_coords, ],
observed_field[!flag_coords, ])
plot(coords, col = flag_coords + 1)
res_list <- snss_sd(x = field_list,
coords = coords_list)
plot(res_list, colorkey = TRUE, as.table = TRUE, cex = 1)
JADE::MD(W.hat = coef(res_list), A = mixing_matrix)