
Calculate Nearest-Neighbor Label Mismatch Proportion
Source:R/01_metrics_distribution.R
calc_nn_mismatch.RdIntegrated from countsimQC (Soneson & Robinson). Evaluates whether the dataset label composition in k-NN neighborhoods departs significantly from the overall global dataset proportion using Chi-squared tests. Works for both 1D numeric vectors and 2D matrices.