anomalize() function is used to detect outliers in a distribution
with no trend or seasonality present. It takes the output of
which has be de-trended and applies anomaly detection methods to identify outliers.
1 2 3 4 5 6 7 8
A column to apply the function to
The anomaly detection method. One of
Controls the width of the "normal" range. Lower values are more conservative while higher values are less prone to incorrectly classifying "normal" observations.
The maximum percent of anomalies permitted to be identified.
A boolean. If
The return has three columns: "remainder_l1" (lower limit for anomalies), "remainder_l2" (upper limit for anomalies), and "anomaly" (Yes/No).
time_decompose() to decompose a time series prior to performing
anomaly detection with
performed on the "remainder" of the time series decomposition.
For non-time series data (data without trend), the
anomalize() function can
be used without time series decomposition.
anomalize() function uses two methods for outlier detection
each with benefits.
The IQR Method uses an innerquartile range of 25% and 75% to establish a baseline distribution around
the median. With the default
alpha = 0.05, the limits are established by expanding
the 25/75 baseline by an IQR Factor of 3 (3X). The IQR Factor = 0.15 / alpha (hense 3X with alpha = 0.05).
To increase the IQR Factor controling the limits, decrease the alpha, which makes
it more difficult to be an outlier. Increase alpha to make it easier to be an outlier.
The IQR method is used in
The GESD Method (Generlized Extreme Studentized Deviate Test) progressively eliminates outliers using a Student's T-Test comparing the test statistic to a critical value. Each time an outlier is removed, the test statistic is updated. Once test statistic drops below the critical value, all outliers are considered removed. Because this method involves continuous updating via a loop, it is slower than the IQR method. However, it tends to be the best performing method for outlier removal.
The GESD method is used in
tbl_time object or list depending on the value of
Anomaly Detection Methods (Powers
Time Series Anomaly Detection Functions (anomaly detection workflow):
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.