TS_AUTO_ARIMA_OUTLIER accepts
an input time series and automatically determines the parameters
of a multiplicative seasonal autoregressive integrated moving average
(ARIMA) model. Whereas TS_AUTO_ARIMA uses
the ARIMA model to forecast values beyond the set of inputs,TS_AUTO_ARIMA_OUTLIER uses
the ARIMA model to identify statistical outliers in the input time
series, and returns the outlier type of each one.
Syntax
TS_AUTO_ARIMA_OUTLIER( <time_value>, <timeseries_expression> [ , <max_lag> [ , <critical > [ , <epsilon> [ , <criterion> [ , <confidence> [, <model> [ , <delta>]]]]]]] )
OVER (window-spec)
Licensing Prerequisites
Available only with RAP – The Trading Edition Enterprise.
Parameters
-
time_value –
the time value for each input time-series data point.
-
timeseries_expression –
a numeric expression, generally a column name, containing
an element in a time series to be differenced.
-
max_lag –
(optional) represents the maximum lag allowed when fitting
an AR(p) model. Must be a positive integer constant or constant
expression. The default is 10.
-
critical –
(optional) critical value used as a threshold for outlier detection.
The value must be greater than 0, and must be a double-precision
floating point constant or constant expression. The default is 3.0.
-
epsilon –
(optional) positive tolerance value controlling the accuracy
of parameter estimates during outlier detection. Must be a double-precision floating
point constant or constant expression. The default is 0.001.
-
criterion –
(optional) the information criterion used for optimum model selection.
Must be an integer constant or constant expression valued at 0,
1, or 2. The default is 0.
-
0 – (default) Akaike's
Information Criterion (AIC)
-
1 – Akaike's Corrected Information Criterion (AICC)
-
2 – Bayesian Information Criterion (BIC)
-
confidence –
(optional) confidence level for computing forecast confidence limits,
taken from the exclusive interval (0, 100). Typical choices for confidence
are 90.0, 95.0, and 99.0. Must be a double-precision floating point constant
or constant expression. The default is 95.0.
-
delta –
(optional) the dampening effect parameter used in the detection
of a temporary change outlier. Must be a double-precision floating
point constant or constant expression. The default is 0.7.
-
model –
(optional) represents a binary-encoded integer array, with
a length of four integers, containing the ARIMA values for p, q, s,
and d, in that order. If the model argument
is specified in the TS_INT_ARRAY function, then the TS_AUTO_ARIMA_OUTLIER function
determines the p, q, s,
and d, values using the method 3 (Specified
ARIMA) parameter of the (IMSLS_METHOD,
int method) argument of the imsls_d_auto_arima function in
the IMSL library. If the model parameter is NULL,
then the TS_AUTO_ARIMA_OUTLIER function
automatically calculates an ARIMA(p,0,0)X(0,d,0) model, which minimizes
the specified error criterion. The default is NULL.
-
window-spec –
TS_AUTO_ARIMA_OUTLIER is
an OLAP function requiring an OVER() clause containing
an ORDER BY clause. ROWS or RANGE specifiers
are not allowed in the OVER() clause
Usage
The inputs to TS_AUTO_ARIMA and TS_AUTO_ARIMA_OUTLIER are
nearly identical. However, TS_AUTO_ARIMA_OUTLIER returns
different values for each input row within a partition, while TS_AUTO_ARIMA returns
the same value for every row. Because of these differences in result
data type and result value scoping, you need not use SELECT
FIRST or SELECT DISTINCT to eliminate
the duplicate output values. TS_AUTO_ARIMA_OUTLIER does
not have any supporting scalar functions for decoding results.
Like TS_AUTO_ARIMA, TS_AUTO_ARIMA_OUTLIER requires
the TS_INT_ARRAY supporting
scalar function. TS_INT_ARRAY provides
the binary composite input.
The function returns an integer value for each input tuple,
specifying the type of outlier for the time and data value within
each tuple. If the time and data value is not an outlier, the
function returns NULL. The integer values are:
-
0 –
innovational outlier (IO).
-
1 –
additive outlier (AO).
-
2 –
level shift (LS).
-
3 –
temporary change (TC).
-
4 –
unable to identify (UI).
See IMSL C Numerical Library User’s Guide: Volume 2 of 2 C Stat Library for detailed information on the five outlier
types.
IMSL Mapping
Maps to the outlier identification logic of imsls_d_auto_arima.
Example
This example computes the ARIMA model for the time series
of the stock prices for XYZ, and then uses that model to identify
which of the trades are statistical outliers. For rows which are
not identified as outliers, TS_AUTO_ARIMA_OUTLIER returns
NULL. For rows which are identified as outliers, TS_AUTO_ARIMA_OUTLIER returns
an integer value between 0 and 4 representing the specific type
of outlier for the current row.
select stock_trade_time,
stock_price,
stock_trade_shares,
TS_AUTO_ARIMA_OUTLIER(stock_trade_time,
stock_price)
over (order by stock_trade_time) as outlier_type
from stock_trades
where stock_symbol = 'XYZ'
Standards and Compatibility
-
SQL –
ISO/ANSI SQL compliant
-
Sybase –
not compatible with SQL Anywhere or Adaptive Server Enterprise