The goal of composits is to find outliers in compositional, multivariate and univariate time series. It is an outlier ensemble method that uses the packages forecast, tsoutliers, anomalize and otsad.

Installation

You can install the released version of composits from CRAN with:

install.packages("composits")

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("sevvandi/composits")

Example

library(composits)
set.seed(100)
n <- 600
x <- sample(1:100, n, replace=TRUE)
x[320] <- 300
x2 <- sample(1:100, n, replace=TRUE)
x3 <- sample(1:100, n, replace=TRUE)
X <- cbind.data.frame(x, x2, x3)
x4 <- sample(1:100, n, replace=TRUE)
X <- cbind.data.frame(x, x2, x3, x4)
out <- mv_tsout_ens(X)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
#> Converting from tbl_df to tbl_time.
#> Auto-index message: index = date
#> frequency = 7 days
#> trend = 91 days
out$all
#>     Indices Total_Score Num_Coords Num_Methods     DOBIN      PCA       ICA
#> res     320        1.75          3           3 0.3144603 0.728004 0.7075357
#>     forecast tsoutliers otsad anomalize
#> res      0.5        0.5     0      0.75
out$outliers
#>     Indices Total_Score Num_Coords Num_Methods     DOBIN      PCA       ICA
#> res     320        1.75          3           3 0.3144603 0.728004 0.7075357
#>     forecast tsoutliers otsad anomalize
#> res      0.5        0.5     0      0.75

See our website or our paper (Kandanaarachchi et al. 2020) for more examples.

References

Kandanaarachchi, Sevvandi, Patricia Menendez, Ruben Loaiza-Maya, and Ursula Laa. 2020. “Outliers in Compositional Time Series Data.” Working Paper. https://www.researchgate.net/publication/343712288_Outliers_in_compositional_time_series_data.