neighbor_match_test {rgeoda} | R Documentation |
Local Neighbor Match Test
Description
The local neighbor match test is to assess the extent of overlap between k-nearest neighbors in geographical space and k-nearest neighbors in multi-attribute space.
Usage
neighbor_match_test(
df,
k,
scale_method = "standardize",
distance_method = "euclidean",
power = 1,
is_inverse = FALSE,
is_arc = FALSE,
is_mile = TRUE
)
Arguments
df |
A subset of sf object with selected variables. E.g. guerry[c("Crm_prs", "Crm_prp", "Litercy")] |
k |
a positive integer number for k-nearest neighbors searching. |
scale_method |
(optional) One of the scaling methods 'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust' to apply on input data. Default is 'standardize' (Z-score normalization). |
distance_method |
(optional) The type of distance metrics used to measure the distance between input data. Options are 'euclidean', 'manhattan'. Default is 'euclidean'. |
power |
(optional) The power (or exponent) of a number says how many times to use the number in a multiplication. |
is_inverse |
(optional) FALSE (default) or TRUE, apply inverse on distance value. |
is_arc |
(optional) FALSE (default) or TRUE, compute arc distance between two observations. |
is_mile |
(optional) TRUE (default) or FALSE, convert distance unit from mile to km. |
Value
A data.frame with two columns "Cardinality" and "Probability".
Examples
library(sf)
guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry <- st_read(guerry_path)
data <- guerry[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')]
nbr_test <- neighbor_match_test(data, 6)
nbr_test