Performs automatic selection and fitting of a univariate autoregressive
time series model.
Syntax
TS_AUTO_UNI_AR (timeseries_expression, ar_count, ar_elem, method)
OVER (window-spec)
Licensing prerequisites
Available only with RAP – The Trading Edition Enterprise.
Parameters
- timeseries_expression – a numeric expression, generally a column name, containing
an element in a time series.
- ar_count – an integer containing the number of autoregressive values
to compute.
- ar_elem – an integer identifying which computed autoregressive value
to return. The integer must be greater than zero, and less than
or equal to ar_count.
- method – (optional) an integer identifying which method to use when computing
AR coefficients, where:
0 = method of moments
1 = method of least squares (the default value)
2 = maximum likelihood.
- window-spec – TS_AUTO_UNI_AR is an OLAP function
requiring an OVER () clause.
Usage
This time series function returns a double-precision floating-point
number containing the autoregressive estimate. TS_AUTO_UNI_AR calls
the function imsls_d_auto_uni_ar in
the IMSL libraries.
IMSL mapping
The arguments of TS_AUTO_UNI_AR map
to the IMSL library function imsls_d_auto_uni_ar as
follows:
params = imsls_d_auto_uni_ar (n_objs, z[], maxlag, p, method, 0);
- n_objs – contains the number of rows in the current window frame.
- z[] – contains the value of timeseries_expression for
the current window frame.
- maxlag – maps to the user-defined aggregate function argument ar_count.
- p – the output parameter, representing the number of autoregressive parameters
in the model with minimum AIC.
- method – maps to the user-defined aggregate function argument method.
If ar_elem is greater than p, and if your IMSL library
time series function error-handling value is set to 0, Sybase IQ returns
a null. If your IMSL library time series function error-handling
value is set to a value other than 0, Sybase IQ displays an error
message indicating that ar_elem is greater than p.
For detailed information on how the function imsls_d_auto_uni_ar performs time
series calculations, see IMSL C Numerical Library User’s Guide: Volume 2 of 2 C Stat Library.
Example
This example shows a SQL statement containing
the TS_AUTO_UNI_AR function and the
data values returned by the function. This example uses the example input data
table (called DATASET) as its input data.
The following SQL statement returns the first element from
an array containing two elements from the
data column:
SELECT TS_AUTO_UNI_AR(data,2,1,0) OVER (ORDER BY ROWNUM rows BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS res FROM DATASET
Sybase IQ returns 50 rows, each containing the same value:
Values returned from TS_AUTO_UNI_AR
res
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
0.883453
|
...
|
0.883453
|
Standards and compatibility
- SQL – ISO/ANSI SQL compliant
- Sybase – not compatible with SQL Anywhere or Adaptive Server Enterprise