diff --git a/.gitignore b/.gitignore index c833a2c..47281dc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .RData .Ruserdata inst/doc +doc +Meta diff --git a/_pkgdown.yml b/_pkgdown.yml index 1edd27a..8e9f8dd 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -17,6 +17,8 @@ navbar: href: articles/anomalize_quick_start_guide.html - text: "Anomalize Methods" href: articles/anomalize_methods.html + - text: "Reduce Forecast Error by Cleaning Anomalies" + href: articles/forecasting_with_cleaned_anomalies.html - text: "News" href: news/index.html @@ -35,6 +37,7 @@ reference: - starts_with("time_decompose") - anomalize - starts_with("time_recompose") + - clean_anomalies - title: Visualization functions desc: __Plotting utilities for visualizing anomalies.__ contents: diff --git a/cran-comments.md b/cran-comments.md index a0b9cf6..af8d37c 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,11 +1,10 @@ ## Test environments -* local OS X install, R 3.4.4 -* ubuntu 14.04 (on travis-ci), R 3.4.4 +* local OS X install, R 3.5.3 +* ubuntu 14.04 (on travis-ci), R 3.5.3 * win-builder (devel and release) ## R CMD check results -R CMD check results 0 errors | 0 warnings | 0 notes -R CMD check succeeded +* This is a new release. diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..4a8a618 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,163 @@ + + + + + + + + +Page not found (404) • anomalize + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ +
+ + + + +
+ + + + + + + + diff --git a/docs/articles/anomalize_methods.html b/docs/articles/anomalize_methods.html index ed0b85b..93b76b1 100644 --- a/docs/articles/anomalize_methods.html +++ b/docs/articles/anomalize_methods.html @@ -1,44 +1,43 @@ - + Anomalize Methods • anomalize - - - - + + + + + - -
+
-
+
-

Anomaly detection is critical to many disciplines, but possibly none more important than in time series analysis. A time series is the sequential set of values tracked over a time duration. The definition we use for an anomaly is simple: an anomaly is something that happens that (1) was unexpected or (2) was caused by an abnormal event. Therefore, the problem we intend to solve with anomalize is providing methods to accurately detect these “anomalous” events.

The methods that anomalize uses can be separated into two main tasks:

    @@ -129,7 +132,7 @@

    1.A. STL

    -

    The STL method uses the stl() function from the stats package. STL works very well in circumstances where a long term trend is present. The Loess algorithm typically does a very good job at detecting the trend. However, it circumstances when the seasonal component is more dominant than the trend, Twitter tends to perform better.

    +

    The STL method uses the stl() function from the stats package. STL works very well in circumstances where a long term trend is present. The Loess algorithm typically does a very good job at detecting the trend. However, it circumstances when the seasonal component is more dominant than the trend, Twitter tends to perform better.

    @@ -140,18 +143,18 @@

    1.C. Comparison of STL and Twitter Decomposition Methods

    Load two libraries to perform the comparison.

    - +
    library(tidyverse)
    +library(anomalize)

    Collect data on the daily downloads of the lubridate package. This comes from the data set, tidyverse_cran_downloads that is part of anomalize package.

    + head(10) %>% + knitr::kable()
    @@ -239,7 +242,7 @@

    # Show plots p1 p2 -

    +

    We can see that the season components for both STL and Twitter decomposition are exactly the same. The difference is the trend component:

    @@ -364,12 +377,13 @@

    +
    -

    Site built with pkgdown.

    +

    Site built with pkgdown 1.4.1.

    @@ -377,5 +391,6 @@

    + diff --git a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-1.png index 257b2a2..3a4e06f 100644 Binary files a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-1.png and b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-1.png differ diff --git a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-2.png b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-2.png index 4cc79d1..ce3cfab 100644 Binary files a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-2.png and b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-3-2.png differ diff --git a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-4-1.png index 47cc5c4..e60652d 100644 Binary files a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-1.png index 1060a92..52167fc 100644 Binary files a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-1.png and b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-2.png b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-2.png index 3fa68fc..dfd8e92 100644 Binary files a/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-2.png and b/docs/articles/anomalize_methods_files/figure-html/unnamed-chunk-5-2.png differ diff --git a/docs/articles/anomalize_quick_start_guide.html b/docs/articles/anomalize_quick_start_guide.html index d94816d..303a6d8 100644 --- a/docs/articles/anomalize_quick_start_guide.html +++ b/docs/articles/anomalize_quick_start_guide.html @@ -1,44 +1,43 @@ - + Anomalize Quick Start Guide • anomalize - - - - + + + + + - -
    +
    -
    +
    -

    The anomalize package is a feature rich package for performing anomaly detection. It’s geared towards time series analysis, which is one of the biggest needs for understanding when anomalies occur. We have a quick start section called “5-Minutes to Anomalize” for those looking to jump right in. We also have a detailed section on parameter adjustment for those looking to understand what nobs they can turn. Finally, for those really looking to get under the hood, we have another vignette called “Anomalize Methods” that gets into a deep discussion on STL, Twitter, IQR and GESD methods that are used to power anomalize.

    @@ -112,9 +115,9 @@

    5-Minutes To Anomalize

    Load libraries.

    - +
    library(tidyverse)
    +library(tibbletime)
    +library(anomalize)

    Get some data. We’ll use the tidyverse_cran_downloads data set that comes with anomalize. A few points:

    +#> 1 2017-01-01 873 tidyr +#> 2 2017-01-02 1840 tidyr +#> 3 2017-01-03 2495 tidyr +#> 4 2017-01-04 2906 tidyr +#> 5 2017-01-05 2847 tidyr +#> 6 2017-01-06 2756 tidyr +#> 7 2017-01-07 1439 tidyr +#> 8 2017-01-08 1556 tidyr +#> 9 2017-01-09 3678 tidyr +#> 10 2017-01-10 7086 tidyr +#> # … with 6,365 more rows

    We can use the general workflow for anomaly detection, which involves three main functions:

    1. @@ -155,18 +158,19 @@

      tidyverse_cran_downloads_anomalized %>% glimpse() #> Observations: 6,375 #> Variables: 12 -#> $ package <chr> "tidyr", "tidyr", "tidyr", "tidyr", "tidyr", "ti... -#> $ date <date> 2017-01-01, 2017-01-02, 2017-01-03, 2017-01-04,... -#> $ count <dbl> 873, 1840, 2495, 2906, 2847, 2756, 1439, 1556, 3... -#> $ observed <dbl> 8.730000e+02, 1.840000e+03, 2.495000e+03, 2.9060... -#> $ season <dbl> -2761.4637, 901.0113, 1459.7147, 1429.7532, 1238... -#> $ trend <dbl> 5052.582, 5046.782, 5040.983, 5035.183, 5029.383... -#> $ remainder <dbl> -1418.11842, -4107.79368, -4005.69726, -3558.935... -#> $ remainder_l1 <dbl> -3747.904, -3747.904, -3747.904, -3747.904, -374... -#> $ remainder_l2 <dbl> 3707.661, 3707.661, 3707.661, 3707.661, 3707.661... -#> $ anomaly <chr> "No", "Yes", "Yes", "No", "No", "No", "No", "No"... -#> $ recomposed_l1 <dbl> -1456.786, 2199.890, 2752.793, 2717.032, 2520.27... -#> $ recomposed_l2 <dbl> 5998.779, 9655.454, 10208.358, 10172.597, 9975.8...

    +#> Groups: package [15] +#> $ package <chr> "tidyr", "tidyr", "tidyr", "tidyr", "tidyr", "tidy… +#> $ date <date> 2017-01-01, 2017-01-02, 2017-01-03, 2017-01-04, 2… +#> $ count <dbl> 873, 1840, 2495, 2906, 2847, 2756, 1439, 1556, 367… +#> $ observed <dbl> 8.730000e+02, 1.840000e+03, 2.495000e+03, 2.906000… +#> $ season <dbl> -2761.4637, 901.0113, 1459.7147, 1429.7532, 1238.7… +#> $ trend <dbl> 5052.582, 5046.782, 5040.983, 5035.183, 5029.383, … +#> $ remainder <dbl> -1418.11842, -4107.79368, -4005.69726, -3558.93599… +#> $ remainder_l1 <dbl> -3747.904, -3747.904, -3747.904, -3747.904, -3747.… +#> $ remainder_l2 <dbl> 3707.661, 3707.661, 3707.661, 3707.661, 3707.661, … +#> $ anomaly <chr> "No", "Yes", "Yes", "No", "No", "No", "No", "No", … +#> $ recomposed_l1 <dbl> -1456.786, 2199.890, 2752.793, 2717.032, 2520.278,… +#> $ recomposed_l2 <dbl> 5998.779, 9655.454, 10208.358, 10172.597, 9975.843…

    Let’s explain what happened:

    1. @@ -210,7 +214,7 @@

      Adjusting the trend and seasonality are fundamental to time series analysis and specifically time series decomposition. With anomalize, it’s simple to make adjustments because everything is done with date or datetime information so you can intuitively select increments by time spans that make sense (e.g. “5 minutes” or “1 month”).

      To get started, let’s isolate one of the time series packages: lubridate.

      +#> 1 2017-01-01 643 lubridate +#> 2 2017-01-02 1350 lubridate +#> 3 2017-01-03 2940 lubridate +#> 4 2017-01-04 4269 lubridate +#> 5 2017-01-05 3724 lubridate +#> 6 2017-01-06 2326 lubridate +#> 7 2017-01-07 1107 lubridate +#> 8 2017-01-08 1058 lubridate +#> 9 2017-01-09 2494 lubridate +#> 10 2017-01-10 3237 lubridate +#> # … with 415 more rows

    Next, let’s perform anomaly detection.

    +#> $ date <date> 2017-01-01, 2017-01-02, 2017-01-03, 2017-01-04, 2… +#> $ observed <dbl> 6.430000e+02, 1.350000e+03, 2.940000e+03, 4.269000… +#> $ season <dbl> -2077.6548, 517.9370, 1117.0490, 1219.5377, 865.11… +#> $ trend <dbl> 2474.491, 2491.126, 2507.761, 2524.397, 2541.032, … +#> $ remainder <dbl> 246.1636, -1659.0632, -684.8105, 525.0657, 317.851… +#> $ remainder_l1 <dbl> -3323.425, -3323.425, -3323.425, -3323.425, -3323.… +#> $ remainder_l2 <dbl> 3310.268, 3310.268, 3310.268, 3310.268, 3310.268, … +#> $ anomaly <chr> "No", "No", "No", "No", "No", "No", "No", "No", "N… +#> $ recomposed_l1 <dbl> -2926.58907, -314.36218, 301.38509, 420.50889, 82.… +#> $ recomposed_l2 <dbl> 3707.105, 6319.331, 6935.079, 7054.202, 6716.417, …

    First, notice that a frequency and a trend were automatically selected for us. This is by design. The arguments frequency = "auto" and trend = "auto" are the defaults. We can visualize this decomposition using plot_anomaly_decomposition().

    -

    +

    @@ -301,7 +305,7 @@

    We can also adjust globally by using set_time_scale_template() to update the default template to one that we prefer. We’ll change the “3 month” trend to “2 weeks” for time scale = “day”. Use time_scale_template() to retrieve the time scale template that anomalize begins with, them mutate() the trend field in the desired location, and use set_time_scale_template() to update the template in the global options. We can retrieve the updated template using get_time_scale_template() to verify the change has been executed properly.

    -

    +

    @@ -405,7 +409,7 @@

    p6 p7

    -

    +

    In reality, you’ll probably want to leave alpha in the range of 0.10 to 0.02, but it makes a nice illustration of how you can also use max_anoms to ensure only the most aggregious anomalies are identified.

    @@ -415,10 +419,19 @@

    Further Understanding: Methods

    If you haven’t had your fill and want to dive into the methods that power anomalize, check out the vignette, “Anomalize Methods”.

    +
    +

    +Interested in Learning Anomaly Detection?

    +

    Business Science offers two 1-hour courses on Anomaly Detection:

    +
    @@ -434,12 +448,13 @@

    +
    -

    Site built with pkgdown.

    +

    Site built with pkgdown 1.4.1.

    @@ -447,5 +462,6 @@

    + diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-11-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-11-1.png index 16b03ce..66bdecd 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-11-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-11-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-13-1.png index 44366da..bf53ed3 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-13-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-13-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-1.png index 58652ca..e5090e0 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-2.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-2.png index 9168b73..0ee14f3 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-2.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-14-2.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-1.png index f1aca30..de980f9 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-2.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-2.png index f198471..5ff2174 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-2.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-15-2.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-4-1.png index 8311e95..2eda2e4 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-7-1.png index cfac358..a944dc8 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-1.png index 4faeb6b..dbd81ee 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-1.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-2.png b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-2.png index ab46145..b390cb7 100644 Binary files a/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-2.png and b/docs/articles/anomalize_quick_start_guide_files/figure-html/unnamed-chunk-9-2.png differ diff --git a/docs/articles/forecasting_with_cleaned_anomalies.html b/docs/articles/forecasting_with_cleaned_anomalies.html new file mode 100644 index 0000000..b473600 --- /dev/null +++ b/docs/articles/forecasting_with_cleaned_anomalies.html @@ -0,0 +1,288 @@ + + + + + + + +Reduce Forecast Error with Cleaned Anomalies • anomalize + + + + + + + + + + +
    +
    + + + + +
    +
    + + + + +
    +

    Forecasting error can often be reduced 20% to 50% by repairing anomolous data

    +
    +
    +

    +Example - Reducing Forecasting Error by 32%

    +

    We can often get better forecast performance by cleaning anomalous data prior to forecasting. This is the perfect use case for integrating the clean_anomalies() function into your forecast workflow.

    +
    library(tidyverse)
    +library(tidyquant)
    +library(anomalize)
    +library(timetk)
    +

    Here is a short example with the tidyverse_cran_downloads dataset that comes with anomalize. We’ll see how we can reduce the forecast error by 32% simply by repairing anomalies.

    + +

    Let’s take one package with some extreme events. We can hone in on lubridate, which has some outliers that we can fix.

    + +

    +
    +
    +

    +Forecasting Lubridate Downloads

    +

    Let’s focus on downloads of the lubridate R package.

    + +

    First, we’ll make a function, forecast_mae(), that can take the input of both cleaned and uncleaned anomalies and calculate forecast error of future uncleaned anomalies.

    +

    The modeling function uses the following criteria:

    +
      +
    • Split the data into training and testing data that maintains the correct time-series sequence using the prop argument.
    • +
    • Models the daily time series of the training data set from observed (demonstrates no cleaning) or observed and cleaned (demonstrates improvement from cleaning). Specified by the col_train argument.
    • +
    • Compares the predictions to the observed values. Specified by the col_test argument.
    • +
    + +
    +
    +

    +Workflow for Cleaning Anomalies

    +

    We will use the anomalize workflow of decomposing (time_decompose()) and identifying anomalies (anomalize()). We use the function, clean_anomalies(), to add new column called “observed_cleaned” that is repaired by replacing all anomalies with the trend + seasonal components from the decompose operation. We can now experiment to see the improvment in forecasting performance by comparing a forecast made with “observed” versus “observed_cleaned”

    + +
    + + +
    +

    +32% Reduction in Forecast Error

    +

    This is approximately a 32% reduction in forecast error as measure by Mean Absolute Error (MAE).

    + +
    +
    +

    +Interested in Learning Anomaly Detection?

    +

    Business Science offers two 1-hour courses on Anomaly Detection:

    + +
    +
    + + + +
    + + + +
    + +
    +

    Site built with pkgdown 1.4.1.

    +
    + +
    +
    + + + + + + diff --git a/docs/articles/forecasting_with_cleaned_anomalies_files/figure-html/unnamed-chunk-3-1.png b/docs/articles/forecasting_with_cleaned_anomalies_files/figure-html/unnamed-chunk-3-1.png new file mode 100644 index 0000000..04ac25c Binary files /dev/null and b/docs/articles/forecasting_with_cleaned_anomalies_files/figure-html/unnamed-chunk-3-1.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 0002257..c6da5ab 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,6 +1,6 @@ - + @@ -8,28 +8,41 @@ Articles • anomalize + - + - + + - + - + + - + + + + + - + + + + + + - + + - + + - -
    +
    - +
    - +
    -

    Site built with pkgdown.

    +

    Site built with pkgdown 1.4.1.

    @@ -146,6 +162,8 @@

    All vignettes

    + + diff --git a/docs/authors.html b/docs/authors.html index 03ea2dd..7f38891 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,6 +1,6 @@ - + @@ -8,28 +8,41 @@ Authors • anomalize + - + - + + - + - + + - + + + + + - + + + + + + - + + - + + - @@ -59,14 +69,15 @@

    date
    @@ -166,11 +180,10 @@

    Arg the lower (l1) and upper (l2) bounds.

    - +

    Value

    Returns a tibble / tbl_time object or list depending on the value of verbose.

    -

    Details

    The anomalize() function is used to detect outliers in a distribution @@ -199,85 +212,86 @@

    Details 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 AnomalyDection::AnomalyDetectionTs().

    -

    References

    -
      + +
      1. How to correct outliers once detected for time series data forecasting? Cross Validated, https://stats.stackexchange.com

      2. Cross Validated: Simple algorithm for online outlier detection of a generic time series. Cross Validated, https://stats.stackexchange.com

      3. -
      4. Owen S. Vallis, Jordan Hochenbaum and Arun Kejariwal (2014).A Novel Technique for Long-Term Anomaly Detection in the Cloud. Twitter Inc.

      5. -
      6. Owen S. Vallis, Jordan Hochenbaum and Arun Kejariwal (2014). AnomalyDetection: Anomaly Detection UsingSeasonal Hybrid Extreme Studentized Deviate Test. R package version 1.0.

      7. +
      8. Owen S. Vallis, Jordan Hochenbaum and Arun Kejariwal (2014). A Novel Technique for Long-Term Anomaly Detection in the Cloud. Twitter Inc.

      9. +
      10. Owen S. Vallis, Jordan Hochenbaum and Arun Kejariwal (2014). AnomalyDetection: Anomaly Detection Using Seasonal Hybrid Extreme Studentized Deviate Test. R package version 1.0.

      11. Alex T.C. Lau (November/December 2015). GESD - A Robust and Effective Technique for Dealing with Multiple Outliers. ASTM Standardization News. www.astm.org/sn

      - +

      See also

      -

      Anomaly Detection Methods (Powers anomalize)

        +

        Anomaly Detection Methods (Powers anomalize)

        -

        Time Series Anomaly Detection Functions (anomaly detection workflow):

        Examples

        -library(dplyr) - +library(dplyr)
        #> +#> Attaching package: ‘dplyr’
        #> The following objects are masked from ‘package:stats’: +#> +#> filter, lag
        #> The following objects are masked from ‘package:base’: +#> +#> intersect, setdiff, setequal, union
        # Needed to pass CRAN check / This is loaded by default set_time_scale_template(time_scale_template()) -data(tidyverse_cran_downloads) +data(tidyverse_cran_downloads) tidyverse_cran_downloads %>% time_decompose(count, method = "stl") %>% anomalize(remainder, method = "iqr")
        #> # A time tibble: 6,375 x 9 -#> # Index: date -#> # Groups: package [15] +#> # Index: date +#> # Groups: package [15] #> package date observed season trend remainder remainder_l1 remainder_l2 -#> <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 tidyr 2017-01-01 873. -2761. 5053. -1418. -3748. 3708. -#> 2 tidyr 2017-01-02 1840. 901. 5047. -4108. -3748. 3708. -#> 3 tidyr 2017-01-03 2495. 1460. 5041. -4006. -3748. 3708. -#> 4 tidyr 2017-01-04 2906. 1430. 5035. -3559. -3748. 3708. -#> 5 tidyr 2017-01-05 2847. 1239. 5029. -3421. -3748. 3708. -#> 6 tidyr 2017-01-06 2756. 367. 5024. -2635. -3748. 3708. -#> 7 tidyr 2017-01-07 1439. -2635. 5018. -944. -3748. 3708. -#> 8 tidyr 2017-01-08 1556. -2761. 5012. -695. -3748. 3708. -#> 9 tidyr 2017-01-09 3678. 901. 5006. -2229. -3748. 3708. -#> 10 tidyr 2017-01-10 7086. 1460. 5000. 626. -3748. 3708. -#> # ... with 6,365 more rows, and 1 more variable: anomaly <chr>
        - -
        +#> <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 tidyr 2017-01-01 873 -2761. 5053. -1418. -3748. 3708. +#> 2 tidyr 2017-01-02 1840 901. 5047. -4108. -3748. 3708. +#> 3 tidyr 2017-01-03 2495 1460. 5041. -4006. -3748. 3708. +#> 4 tidyr 2017-01-04 2906 1430. 5035. -3559. -3748. 3708. +#> 5 tidyr 2017-01-05 2847 1239. 5029. -3421. -3748. 3708. +#> 6 tidyr 2017-01-06 2756 367. 5024. -2635. -3748. 3708. +#> 7 tidyr 2017-01-07 1439 -2635. 5018. -944. -3748. 3708. +#> 8 tidyr 2017-01-08 1556 -2761. 5012. -695. -3748. 3708. +#> 9 tidyr 2017-01-09 3678 901. 5006. -2229. -3748. 3708. +#> 10 tidyr 2017-01-10 7086 1460. 5000. 626. -3748. 3708. +#> # … with 6,365 more rows, and 1 more variable: anomaly <chr>

+ +
+
-

Site built with pkgdown.

+

Site built with pkgdown 1.4.1.

@@ -285,6 +299,8 @@

Contents

+ + diff --git a/docs/reference/anomalize_methods.html b/docs/reference/anomalize_methods.html index a5cf7e9..45be568 100644 --- a/docs/reference/anomalize_methods.html +++ b/docs/reference/anomalize_methods.html @@ -1,6 +1,6 @@ - + @@ -8,31 +8,43 @@ Methods that power anomalize() — anomalize_methods • anomalize + - + - + + - + - + + - + + + + + - - + + + + + + - + + - + + - @@ -62,14 +71,15 @@