Detects and determines outliers and simultaneously estimates the model parameters in a time series whose underlying outlier free series follows a general seasonal or nonseasonal ARMA model.
Required Arguments
MODEL — Array of length 4 containing the order (p, 0, q) x (0, d, 0)s of the ARIMA model the outlier free series is following. Specifically, MODEL(1) = p, MODEL(2) =q, MODEL(3) = s, MODEL(4) = d. (Input)
W — Array of length NOBS containing the original time series. (Input)
X — Array of length NOBS containing the outlier free series. (Output)
Optional Arguments
NOBS — Number of observations in time series W. (Input) Default: NOBS = size (W).
DELTA — The dynamic dampening effect parameter used in the detection of a Temporary Change Outlier (TC), 0.0 < DELTA < 1.0. (Input) Default: DELTA = 0.7 .
CRITICAL — Critical value used as a threshold for outlier detection, CRITICAL > 0. (Input) Default: CRITICAL = 3.0.
EPSILON — Positive tolerance value controlling the accuracy of parameter estimates during outlier detection. (Input) Default: EPSILON = 0.001.
RELERR — Stopping criterion for use in the nonlinear equation solver used by NSPE, see routine NSPE for more details. (Input) Default: RELERR = 1.0e‑10.
TOLSS — Tolerance level used to determine convergence of the nonlinear least‑squares algorithm used by NSLSE, see routine NSLSE for more details. (Input) TOLSS must be greater than zero and less than one. Default: TOLSS = 0.9 × AMACH(4).
RESIDUAL — Array of length NOBS containing the residuals for the outlier free series. (Output)
RESSIGMA — Residual standard error of the outlier free series. (Output)
NOUTLIERS — The number of outliers detected. (Output)
IOUTLIERSTATS — Pointer to an array of size NOUTLIERS by 2 containing outlier statistics. The first column contains the time at which the outlier was observed () and the second column contains an identifier indicating the type of outlier observed. Outlier types fall into one of five categories:
IOUTLIERSTATS
Category
0
Innovational Outliers (IO)
1
Additive Outliers (AO)
2
Level Shift Outliers(LS)
3
Temporary Change Outliers(TC)
4
Unable to Identify(UI)
If no outliers are detected, an array of size 0 is returned. (Output)
TAUSTAT — Pointer to an array of length NOUTLIERS containing the t value for each detected outlier. (Output)
OMEGA — Pointer to an array of length NOUTLIERS containing the computed weights for the detected outliers. (Output)
PARAMS — Array of length 1+p+q containing the estimated constant, AR and MA parameters, respectively. (Output)
AIC — Akaike's Information Criterion (AIC) for the fitted model. (Output)
AICC— Akaike's Corrected Information Criterion (AICC) for the fitted model. (Output)
BIC — Bayesian Information Criterion (BIC) for the fitted model. (Output)
Specific: The specific interface names are S_TS_OUTLIER_IDENTIFICATION and D_TS_OUTLIER_IDENTIFICATION.
Description
Consider a univariate time series {Yt} that can be described by the following multiplicative seasonal ARIMA model of order (p, 0, q) x (0, d, 0)s:
Here, , . B is the lag operator, , is a white noise process, and μ denotes the mean of the series {Yt}.
In general, {Yt} is not directly observable due to the influence of outliers. Chen and Liu (1993) distinguish between four types of outliers: innovational outliers (IO), additive outliers (AO), temporary changes (TC) and level shifts (LS). If an outlier occurs as the last observation of the series, then Chen and Liu’s algorithm is unable to determine the outlier’s classification. In TS_OUTLIER_IDENTIFICATION, such an outlier is called a UI (unable to identify) and is treated as an innovational outlier.
In order to take the effects of multiple outliers occurring at time points t1, t2, …, tm into account, Chen and Liu consider the following model:
Here, {Yt*} is the observed outlier contaminated series, and ωj and Lj(B) denote the magnitude and dynamic pattern of outlier j, respectively. It(tj) is an indicator function that determines the temporal course of the outlier effect, Itj(tj) = 1, It(tj) = 0 otherwise. Note that Lj(B) operates on It via BkIt = It-k, k = 0, 1, … .
The last formula shows that the outlier free series {Yt} can be obtained from the original series {Yt*} by removing all occurring outlier effects:
The different types of outliers are characterized by different values for :
1. for an innovational outlier,
2. for an additive outlier,
3. for a level shift outlier and
4. for a temporary change outlier.
TS_OUTLIER_IDENTIFICATION is an implementation of Chen and Liu’s algorithm. It determines the coefficients inφ (B), θ (B), and the outlier effects in the model for the observed series jointly in three stages. The magnitude of the outlier effects is determined by least squares estimates. Outlier detection itself is realized by examination of the maximum value of the standardized statistics of the outlier effects. For a detailed description, see Chen and Liu’s original paper (1993).
Intermediate and final estimates for the coefficients in φ (B) and θ (B) are computed by routines NSPE and NSLSE. If the roots of φ (B) or θ (B) lie on or within the unit circle, then the algorithm stops with an appropriate error message. In this case, different values for p and q should be tried.
Examples
Example 1
This example is based on estimates of the Canadian lynx population. TS_OUTLIER_IDENTIFICATION is used to fit an ARIMA(2,2,0) model of the form , t = 1, 2, ..., 144, {at} Gaussian White noise, to the given series. TS_OUTLIER_IDENTIFICATION computes parameters φ1 = 0.123609 and φ2 = ‑0.178963, and identifies a LS outlier at time point t = 16.
use umach_int
use ts_outlier_identification_int
implicit none
integer :: i, nout
integer :: noutliers
integer, dimension(4) :: model
integer, dimension(:,:), pointer :: outlierstat
real(kind(1e0)) :: ressigma, aic
real(kind(1e0)), dimension(3) :: parameters
real(kind(1e0)), dimension(114) :: w, x
w = (/ 0.24300E01,0.25060E01,0.27670E01,0.29400E01,0.31690E01,&