View source: R/nb-match-test-impl.R
nb_match_test | R Documentation |
Implements the Local Neighbor Match Test as described in Tobler's Law in a Multivariate World (Anselin and Li, 2020).
nb_match_test(
x,
nb,
wt = st_weights(nb),
k = 10,
nsim = 499,
scale = TRUE,
.method = "euclidian",
.p = 2
)
x |
a numeric vector or a list of numeric vectors of equal length. |
nb |
a neighbor list object for example as created by |
wt |
a weights list as created by |
k |
the number of neighbors to identify in attribute space. Should be the same as number of neighbors provided in st_knn. |
nsim |
the number of simulations to run for calculating the simulated p-value. |
scale |
default |
.method |
default |
.p |
default 2. The power of Minkowski distance passed to the |
a data.frame
with columns
n_shared
(integer): the number of shared neighbors between geographic and attribute space
nb_matches
(list): matched neighbor indexes. Each element is an integer vector of same length as the ith observation of n_shared
knn_nb
(list): the neighbors in attribute space
probability
(numeric): the geometric probability of observing the number of matches
p_sim
(numeric): a folded simulated p-value
if (requireNamespace("dplyr", quietly = TRUE)) {
library(magrittr)
guerry %>%
dplyr::transmute(nb = st_knn(geometry, k = 10),
nmt = nb_match_test(list(crime_pers, literacy, suicides),
nb, nsim = 999)) %>%
tidyr::unnest(nmt)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.