outliers_by_density: Spatial outliers: DENSITY Method

View source: R/spaceout.R

outliers_by_densityR Documentation

Spatial outliers: DENSITY Method

Description

Spatial outlier method that uses kernel density to determine outlier status. The algorithm uses spatstat to compute a density grid, grDevices to create contour lines based on user-defined threshold value, and then determines outliers by intersecting points with the contours. The threshold value is based on some fraction of the maximum density, 0.1 in the absence of user input.

Usage

outliers_by_density(pts, thresh = 0.1, sigma = 0.1)

Arguments

pts

sf points

thresh

fraction of maximum density to use as outlier threshold

sigma

value passed to spatstat for kernel density size; the value is used as standard deviation of Gaussian for smoothing

Value

list with outlier status and sf polygon

See Also

points_to_density()

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

Examples

data("pdx_breweries")
pts <- pdx_breweries$geometry
x <- outliers_by_density(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.