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.
The type double function is imsls_d_ts_outlier_identification.
Required Arguments
int n_obs (Input) Number of observations in the time series.
int model[] (Input) Vector of length 4 containing the numbers p, q, s, d of the ARIMA (p, 0, q) × (0, d, 0)s model the outlier free series is following.
floatw[] (Input) An array of length n_obs containing the time series.
Return Value
Pointer to an array of length n_obs containing the outlier free time series. If an error occurred, NULL is returned.
Synopsis with Optional Arguments
#include<imsls.h>
float*imsls_f_ts_outlier_identification(intn_obs, int model[], floatw[],
IMSLS_RETURN_USER, floatx[],
IMSLS_DELTA, floatdelta,
IMSLS_CRITICAL, floatcritical,
IMSLS_EPSILON, floatepsilon,
IMSLS_RELATIVE_ERROR, floatrelative_error,
IMSLS_RESIDUAL, float**residual,
IMSLS_RESIDUAL_USER, floatresidual[],
IMSLS_RESIDUAL_SIGMA, float*res_sigma,
IMSLS_NUM_OUTLIERS, int*num_outliers,
IMSLS_OUTLIER_STATISTICS, int**outlier_stat,
IMSLS_OUTLIER_STATISTICS_USER, intoutlier_stat[],
IMSLS_TAU_STATISTICS, float**tau_stat,
IMSLS_TAU_STATISTICS_USER, floattau_stat[],
IMSLS_OMEGA_WEIGHTS, float**omega,
IMSLS_OMEGA_WEIGHTS_USER, floatomega[],
IMSLS_ARMA_PARAM, float **parameters,
IMSLS_ARMA_PARAM_USER, floatparameters[],
IMSLS_AIC, float*aic,
0)
Optional Arguments
IMSLS_RETURN_USER, floatx[] (Output) A user supplied array of length n_obs containing the outlier free series.
IMSLS_DELTA, floatdelta (Input) The dampening effect parameter used in the detection of a Temporary Change Outlier (TC), 0<delta< 1.
Default: delta = 0.7
IMSLS_CRITICAL, floatcritical (Input) Critical value used as a threshold for outlier detection, critical> 0.
Default: critical=3.0
IMSLS_EPSILON, floatepsilon (Input) Positive tolerance value controlling the accuracy of parameter estimates during outlier detection.
Default: epsilon = 0.001
IMSLS_RELATIVE_ERROR, floatrelative_error (Input) Stopping criterion for the nonlinear equation solver used in function imsls_f_arma.
Default: relative_error = .
IMSLS_RESIDUAL, float**residual (Output) Address of a pointer to an internally allocated array of length n_obs containing the residuals for the outlier free series.
IMSLS_RESIDUAL_USER, floatresidual[] (Output) Storage for array residual is provided by the user. See IMSLS_RESIDUAL.
IMSLS_RESIDUAL_SIGMA, float*res_sigma (Output) Residual standard error of the outlier free series.
IMSLS_NUM_OUTLIERS, int*num_outliers (Output) The number of outliers detected.
IMSLS_OUTLIER_STATISTICS, int**outlier_stat (Output) Address of a pointer to an internally allocated array of length num_outliers× 2 containing outlier statistics. The first column contains the time at which the outlier was observed (t=1,2,...,n_obs) and the second column contains an identifier indicating the type of outlier observed.
Outlier types fall into one of five categories:
0
Innovational Outliers (IO)
1
Additive outliers (AO)
2
Level Shift Outliers (LS)
3
Temporary Change Outliers (TC)
4
Unable to Identify (UI).
Use IMSLS_NUM_OUTLIERS to obtain num_outliers, the number of detected outliers.
If num_outliers = 0, NULL is returned.
IMSLS_OUTLIER_STATISTICS_USER, intoutlier_stat[] (Output) A user allocated array of length n_obs× 2 containing outlier statistics in the first num_outliers locations. See IMSLS_OUTLIER_STATISTICS.
If num_outliers = 0, outlier_stat stays unchanged.
IMSLS_TAU_STATISTICS, float**tau_stat (Output) Address of a pointer to an internally allocated array of length num_outliers containing the t value for each detected outlier.
If num_outliers = 0, NULL is returned.
IMSLS_TAU_STATISTICS_USER, floattau_stat[] (Output) A user allocated array of length n_obs containing the t value for each detected outlier in its first num_outliers locations.
If num_outliers = 0, tau_stat stays unchanged.
IMSLS_OMEGA_WEIGHTS, float**omega (Output) Address of a pointer to an internally allocated array of length num_outliers containing the computed weights for the detected outliers.
If num_outliers = 0, NULL is returned.
IMSLS_OMEGA_WEIGHTS_USERfloatomega[] (Output) A user allocated array of length n_obs containing the computed weights for the detected outliers in its first num_outliers locations.
If num_outliers = 0, omega stays unchanged.
IMSLS_ARMA_PARAM, float**parameters (Output) Address of a pointer to an internally allocated array of length 1+p+q containing the estimated constant, AR and MA parameters.
IMSLS_ARMA_PARAM_USERfloatparameters[] (Output) A user allocated array of length 1+p+q containing the estimated constant, AR and MA parameters.
IMSLS_AIC, float*aic (Output) Akaike’s information criterion (AIC).
Description
Consider a univariate time series that can be described by the following multiplicative seasonal ARIMA model of order (p, 0, q) × (0, d, 0)s:
Here, , . is the lag operator, , is a white noise process, and denotes the mean of the series .
In general, 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 imsls_f_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 into account, Chen and Liu consider the following model:
Here, is the observed outlier contaminated series, and and denote the magnitude and dynamic pattern of outlier , respectively. is an indicator function that determines the temporal course of the outlier effect, , otherwise. Note that operates on via .
The last formula shows that the outlier free series can be obtained from the original series 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.
Function imsls_f_ts_outlier_identification is an implementation of Chen and Liu’s algorithm. It determines the coefficients in 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 and are computed by functions imsls_f_arma and imsls_f_max_arma. If the roots of or 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. In order to simulate a measurement error, the actual time series value at time point t=30, which is 0.25570e + 01, was replaced by 0.35570e + 01. Function imsls_f_ts_outlier_identification is used to fit an AR(2) model of the form , , {at} Gaussian White noise, to the given series. Function imsls_f_ts_outlier_identification computes parameters , and and identifies an additive outlier at time point t=30.