
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.
You can install the development version from GitHub with:
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 'xts':
#> method from
#> as.zoo.xts zoo
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
#> Registered S3 methods overwritten by 'forecast':
#> method from
#> fitted.fracdiff fracdiff
#> residuals.fracdiff fracdiff
#> 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
#> Warning in outthres1$gapscore1 <- rep(0, length(indthres1)): Coercing LHS
#> to a list
out$all
#> Indices Total_Score Num_Coords Num_Methods DOBIN PCA
#> res 320 1.75 3 3 0.3144603 0.728004
#> ICA forecast tsoutliers otsad anomalize
#> res 0.7075357 0.5 0.5 0 0.75
out$outliers
#> Indices Total_Score Num_Coords Num_Methods DOBIN PCA ICA
#> 1 320 1.75 3 3 0.3144603 0.728004 0.7075357
#> forecast tsoutliers otsad anomalize Gap_Score_1
#> 1 0.5 0.5 0 0.75 2See our website or our paper (Kandanaarachchi et al. 2020) for more examples.
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.