View source: R/pariwise-colocation-impl.R
pairwise_colocation | R Documentation |
Calculate the pairwise colocation quotient (CLQ) for two categorical variables using conditional permutation.
pairwise_colocation(A, B, nb, nsim = 99)
A |
a character or factor vector. |
B |
a character or factor vector. |
nb |
a neighbors list e.g. created by |
nsim |
default |
The pairwise CLQ is used to test if there is a spatial directional association between subcategories of two vectors A
and B
. Compared to the cross-K metric and the join count statistic, the pairwise CLQ can elucidate the presence of an asymmetric relationship between subcategories of A and B. A and B can either be separate categorical vectors or the same categorical vector.
"The null hypothesis for a CLQ-based analysis is 'given the clustering of the joint population, there is no spatial association between pairs of categorical subsets.'"
The pairwise colocation quotient is defined as "the ratio of observed to expected proportions of B among A's nearest neighbors. Formally this is given by
CLQ_{A \to B} = \frac{{C_{A \to B} / N_A}}{N^{'}_{B} / (N - 1)}
" where C_{A \to B} = \sum_{i = 1}^{N_A}\sum_{j = 1}^{v}\frac{B_{ij}(1,0)}{v}
.
Inference is done using conditional permutation as suggested by Anselin 1995 where a number of replicates are created. The observed values are compared to the replicates and a the simulated p-value is the proportion of cases where the observed is more extreme as compared to replicate. The simulated p-value returns the lower p-value of either tail.
Given that the CLQ is a ratio of the observed to expected, we interpret values larger than one to mean that there is more colocation than to be expected under the null hypothesis of no spatial association. When the value is smaller than 0, we interpret it to mean that there is less colocation than expected under the null.
A matrix where the rownames are the unique values of A and the column names are the unique values of B and their simulated p-values in the form of p_sim_{B}
.
A <- guerry$main_city
B <- guerry$region
nb <- st_knn(sf::st_geometry(guerry), 5)
pairwise_colocation(B, A, nb)
pairwise_colocation(B, B, nb, 199)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.