| ssim_polygon | R Documentation |
Computes local and global SSIM (and its components SIM, SIV, SIP) for two polygon maps using an adaptive k-nearest-neighbour (k-NN) Gaussian kernel. Input variables can be optionally transformed (e.g. rank-based inverse normal scores or min–max normalization). Optionally performs permutation tests for global and local significance with BH-FDR correction. Under the null hypothesis for the permutation test, both variables are randomly permuted at each iteration, breaking spatial structure and association between them. Local p-values can be optionally adjusted using the Benjamini–Hochberg FDR procedure.
ssim_polygon(
shape,
map1,
map2,
global = TRUE,
bandwidth = NULL,
transform = c("normal_score", "percentile", "none", "minmax"),
k1 = NULL,
k2 = NULL,
do_test = FALSE,
R = 1000,
fdr = TRUE,
alpha = 0.05,
seed = NULL
)
shape |
An |
map1 |
Character string; column name in |
map2 |
Character string; column name in |
global |
Logical. If |
bandwidth |
Integer; adaptive k-NN size (number of neighbours). The
default is |
transform |
One of |
k1, k2 |
SSIM constants. If |
do_test |
Logical; if |
R |
Integer; number of permutations for the significance tests
(default |
fdr |
Logical; if |
alpha |
Numeric; significance threshold for local results (default
|
seed |
Optional integer; random seed for reproducibility of the permutation tests. |
If global = TRUE and do_test = FALSE, the function prints a
knitr table summarising the global mean, minimum, maximum, and standard
deviation of SSIM, SIM, SIV, and SIP, and returns this data.frame
(invisibly).
If global = TRUE and do_test = TRUE, the function prints the
same summary table plus a table of global permutation p-values (two-sided)
for SSIM, SIM, SIV, and SIP, and returns (invisibly) a list with
components:
summary: data.frame with global SSIM/SIM/SIV/SIP
summary statistics;
p_global: data.frame with global means and
permutation p-values for SSIM, SIM, SIV, SIP.
If global = FALSE, the function returns an sf object equal to
shape with additional columns:
SSIM, SIM, SIV, SIP: local similarity
metrics for each polygon;
p_value, q_value, sig (only if
do_test = TRUE): local permutation p-value, FDR-adjusted q-value,
and a logical flag indicating significance (q_value < alpha).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.