single_oga {outliers.ts.oga}R Documentation

Detect and clean outlying effects in a single time series with OGA

Description

Algorithm for detecting and cleaning additive outliers and level shifts in a single time series with an Orthogonal Greedy Algorithm (OGA).

Usage

single_oga(yt,s=NULL)

Arguments

yt

A numeric vector or a ts object.

s

Optional, the time series frequency, i.e., the number of observations per unit of time (s=1 for non-seasonal, s=4 for quarterly, s=7 for weekly, s=12 for monthly, s=24 for daily, s=52 for yearly, or s=60 for hourly). If yt is of format ts, the value of the frequency in yt is taken. If not and the value of s is not given, the value s=1 is also taken.

Details

The program detects and cleans a time series from the effect of Additive Outliers (AOs) and Level Shifts (LSs). For this purpose, the procedure proposed in the paper 'Efficient outlier detection in heterogeneous time series databases' by Galeano, Peña and Tsay (2024) is used. The procedure can be divided into three automatic steps. The initial step involves fitting a sufficiently high-order AR model to yt using robust regression to obtain an AR representation and a residual series. Then, an Orthogonal Greedy Algorithm (OGA) procedure is applied to the residual series to identify a set of potential AOs and LSs and to remove their effects from yt. The identified set of outlying effects is referred to as the first set of potential outliers. The second step is to identify and fit an ARIMA or SARIMA model, depending on whether seasonality is detected, to the outlier-adjusted series of the first step and to obtain a new residual series. The OGA procedure is then applied to this new residual series to identify a new set of potential AOs and LSs, if any. The detected outlying effects form the second set of potential outliers. The third step involves combining the potential outliers identified in the first and second steps to remove any redundancies so as to obtain a final set of potential AOs and LSs, and fitting an ARIMA (or SARIMA) model jointly with the final set of potential outliers. Then, any negligible outlying effects, if any, are removed. Finally, any detected AOs and LSs are removed from the observed time series yt to produce an outlier-free time series.

Value

yt_clean

A ts object with the cleaned time series after removing the effects of the outliers in the observed time series.

aos

A matrix with the Additive Outliers (AOs) detected including location, size and t-test. If NULL, no AOs have been found in the series.

lss

A matrix with the Level Shifts (LSs) detected including location, size and t-test. If NULL, no LSs have been found in the series.

Author(s)

Pedro Galeano.

References

Galeano, P., Peña, D. and Tsay, R. S. (2024). Efficient outlier detection in heterogeneous time series databases. Working paper, Universidad Carlos III de Madrid.

See Also

db_hom_oga; db_het_oga.

Examples


## Load FREDMDApril19 dataset from the SLBDD package
data("FREDMDApril19",package="SLBDD")
Y <- FREDMDApril19

## Define time series yt and frequency s
yt <- Y[,1]
s <- 12

## Apply the function to yt
out_single_oga <- single_oga(yt,s=s)


[Package outliers.ts.oga version 0.0.1 Index]