Identify boundary locations among uncertain observations based on spatial nearest neighbors. An uncertain location is defined as a boundary location if:
it has at least one certain location among its \(n_neighbors\) nearest neighbors;
its \(n_neighbors\) nearest neighbors contain at least two distinct cluster labels; and
its own cluster label is represented among its \(n_neighbors\) nearest neighbors.
Arguments
- dat_loc
A numeric matrix of dimension \(n \times d\), where \(n\) is the number of observations and \(d\) is the number of spatial coordinates. Each row corresponds to one observation.
- cluster
A vector of length \(n\) giving hard cluster labels.
- is_uncertain
A logical vector of length \(n\) indicating whether each observation is uncertain.
- n_neighbors
An integer specifying the number of nearest neighbors.
Value
A list containing:
loc_boundary: Indices of boundary uncertain locations.
is_boundary: A logical vector of length \(n\) indicating uncertain boundary status.
loc_uncertain: Indices of uncertain locations.
loc_certain: Indices of certain locations.
n_boundary: Number of boundary uncertain locations.
prop_boundary_in_uncertain: Proportion of boundary uncertain locations among uncertain locations.