outliers_by_density | R Documentation |
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.
outliers_by_density(pts, thresh = 0.1, sigma = 0.1)
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 |
list with outlier status and sf polygon
points_to_density()
Other outlier functions:
outliers_by_box()
,
outliers_by_circle()
,
outliers_by_cluster()
,
outliers_by_iforest()
,
outliers_by_polygon()
,
spatial_outliers()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.