View source: R/accessory_geo.R
distOutlier | R Documentation |
Outlier Mahalanobis Distances
distOutlier( lon, lat, method = "robust", n.min = 10, digs = 3, probs = c(0.5, 0.75, 0.9, 0.95, 0.975, 0.99, 1) )
lon |
numerical. Longitude in decimal degrees |
lat |
numerical. Latitude in decimal degrees |
method |
character. Type of method desired: 'classic' or 'robust' |
n.min |
numerical. Minimum number of unique coordinates to be used in the calculations. Default to 10 |
digs |
numerical. Number of digits to be returned after the decimal point. Default to 4 |
probs |
numerical. Vector of probabilities between 0 and 1 to calculate the sample quantiles. Default to c(0.5, 0.75, 0.9, 0.95, 0.975, 0.99, 100) |
The function returns the quantiles of the Mahalanobis distances for the spatial outliers detected automatically, which can be used in the decision making of the more appropriated distance cutoffs to flag spatial outliers.
The automatic detection of spatial outliers is based on an adjusted
threshold of the Mahalanobis distances based on function arw()
from
package mvoutlier.
If the number of unique coordinates is below n.min
or if the Minimum
Covariance Determinant (MCD) estimator has issues, the function returns
NAs. See the help of function mahalanobisDist()
for details on the other
parameters.
the number of unique coordinates ('n'), the number of outliers detected ('n.out') and the sample quantiles ('qt') of the Mahalanobis distances.
Renato A. Ferreira de Lima
mahalanobisDist.
set.seed(123) lon <- runif(100, -45, -35) lat <- runif(100, -35, -25) ## Not run: distOutlier(lon, lat, method = "classic") # no outliers found... distOutlier(lon, lat, method = "robust") # adding some noise lat[1:5] <- lat[1:5] + runif(5, 10, 20) lon[96:100] <- lon[96:100] + runif(5, 10, 20) distOutlier(lon, lat, method = "classic") # quantiles found for 10 outliers distOutlier(lon, lat, method = "robust") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.