Calculates the least-square estimates of parameters for an
autoregressive moving average (ARMA) model, and returns the requested
autoregressive estimate.
Syntax
TS_ARMA_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 the element in the computed AR array
that should be returned. ar_elem must
be greater than 0 and less than or equal to ar_count.
-
method –
(optional) an integer that identifies the type of procedure
used to compute estimates. 0 (the default value) = method
of least squares; 1 = method of moments.
-
window-spec –
TS_ARMA_AR is an OLAP
function requiring an OVER () clause.
Usage
TS_ARMA_AR time series function returns
a double-precision floating-point value containing the autoregressive
estimate. TS_ARMA_AR calls the function imsls_d_arma in
the IMSL libraries.
IMSL mapping
The arguments of TS_ARMA_AR map to the IMSL
library function imsls_d_arma as
follows:
params = imsls_d_arma(n_objs, z, p, q, methodID, 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.
-
p –
maps to the user-defined aggregate function argument ar_count.
-
q –
=1.
-
methodID –
maps to the method argument of TS_ARMA_AR.
Can be set to either IMSLS_METHOD_OF_MOMENTS
or IMSLS_LEAST_SQUARES.
For detailed information on how imsls_d_arma 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_ARMA_AR function, and the data values returned
by the function. This example uses the example input data table (called DATASET)
as its input data. See DATASET example input data.
The following SQL statement returns the first element of an
autoregressive estimate consisting of one value from the
data column
using the method of least squares:
SELECT TS_ARMA_AR(data,1,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_ARMA_AR
res
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
0.898793
|
...
|
0.898793
|
Standards and compatibility
-
SQL –
ISO/ANSI SQL compliant
-
Sybase –
not compatible with SQL Anywhere or Adaptive Server Enterprise
See also
System Administration Guide: Volume 2 > Using OLAP
IMSL C Numerical Library User’s Guide: Volume 2 of 2 C Stat Library