outliers_by_cluster: Spatial outliers: CLUSTER Method

View source: R/spaceout.R

outliers_by_clusterR Documentation

Spatial outliers: CLUSTER Method

Description

Spatial outlier method based on the dbscan spatial clustering algorithm. User should run dbscan::kNNdistplot() first to get a reasonable value for eps. The dbscan algorithm clusters according to a nominal distance between points (eps) and minimum number of points per cluster (MinPts) and puts all points that don't neatly fit into a group into cluster zero. This method draws a polygon around the non-cluster-zero points, applies some edge corrections, and determines outlier status accordingly.

Usage

outliers_by_cluster(
  pts,
  eps = 0.25,
  MinPts = 5,
  tension = 0.5,
  buffer_size = 0.05
)

Arguments

pts

sf points

eps

parameter passed to dbscan, distance between neighboring points

MinPts

parameter passed to dbscan, min points per cluster

tension

(optional) value from 0 to 1 to control how tight polygon should wrap around points

buffer_size

(optional) buffer around exterior points, in coordinate units

Value

list with outlier status and sf polygon

See Also

get_alphahull_polygon()

Other outlier functions: outliers_by_box(), outliers_by_circle(), outliers_by_density(), outliers_by_iforest(), outliers_by_polygon(), spatial_outliers()

Examples

data("pdx_breweries")
pts <- pdx_breweries$geometry
x <- outliers_by_cluster(pts)
plot(pts)
plot(pts[x[[1]]==-1], col="red", add=TRUE)
plot(x[[2]], add=TRUE)

nhoteling/spaceheater documentation built on Sept. 24, 2022, 3:04 p.m.