Learn R Programming

composits

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.

Copy Link

Version

Install

install.packages('composits')

Monthly Downloads

14

Version

0.1.1

License

GPL-3

Maintainer

Sevvandi Kandanaarachchi

Last Published

May 24th, 2022

Functions in composits (0.1.1)

draw_table

Draws table from comp_tsout_ens or mv_tsout_ens output.
apportion_scores_mv

Apportions outlier scores to composites.
get_coords

Computes unconstrained null space coodinates for compositional data.
animate_ts_ensemble

Show tour animation of the data points.
mv_tsout_ens

Performs multivariate time series outlier ensembling.
comp_tsout_ens

Performs composite time series outlier ensembling.
apportion_scores_comp

Apportions outlier scores to composites.
Simulations

Function to simulate compositional time series data
draw_table_html

Draws an html table from comp_tsout_ens or mv_tsout_ens output.
spanish_morte

A dataset containing mortality counts in Spain by state.
plot_biplot

Plot "biplot" for different decomposition methods.
plot_decomposed_all

Plot all decomposed time series from comp_tsout_ens or mv_tsout_ens output.
plot_decomposed

Plot decomposed time series from comp_tsout_ens or mv_tsout_ens output.
uv_tsout_ens

Performs univariate time series outlier ensemble.