anomaly
is a function for detecting unusual (i.e., anomalous, abnormal, outlier) time-series in a set of time-series.
anomaly(x, n = 10, method = c("hdr", "ahull"), robust = TRUE, ordered = FALSE,
plot = TRUE, labels = TRUE, col)
A feature matrix returned by `tsmeasures` function
Number of unusual time-series to return
Bivariate outlier detection method used for detecting high density regions of the first two principal components extracted from the time-series
If TRUE
a robust PCA will be used for feature extraction
If TRUE
, the outliers are returned in order. This only applies when
method="ahull"
as the outliers are always ordered when method="hdr"
.
If TRUE
, a visualization of the anomalous time-series in the first two principal compoents will be shown
If TRUE
, labels will be added to give the anomlous time series an ordering index.
A vector of length 2 giving the colours for the first and second set of points respectively (and the corresponding axes). If a single colour is specified it will be used for both sets. If missing the default colour is used.
A vector showing the row index of the n
most unusual time-series and
a matrix of principal component scores. Returned invisibly if plot=TRUE
.
When method = "hdr", the outliers are those with the lowest density in the 2-dimensional PC space using a bivariate kernel density estimator. In this case, the outliers are always in order of increasing density.
When method = "ahull", the outliers are the first n
scores in the 2-dimensional PC space which break away as singletons when alpha-convex hulls are used with decreasing alpha. They are not ordered by default. If ordered=TRUE
, then the outliers are ordered based on when they first break away from the remaining points. This is much slower, especially for large n
, and so it is turned off by default.
# NOT RUN {
y <- tsmeasures(dat0, window = 24)
anomaly(y, n = 2, method = "ahull", ordered=TRUE)
# }
Run the code above in your browser using DataLab