Calculates the least-square estimates of parameters for an
autoregressive moving average (ARMA) model, and returns the requested
moving average estimate.
Syntax
TS_ARMA_MA (timeseries_expression, ma_count, ma_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.
- ma_count – an integer containing the number of autoregressive values
to compute.
- ma_elem – an integer identifying the element to return from the computed moving
average array. The integer must be greater than 0 and less than
or equal to ma_count.
- method – (optional) an integer identifying the procedure to use to
calculate estimates. 0 (the default value) = method of
least squares and 1 = method of moments.
- window-spec – TS_ARMA_MA is an OLAP
function requiring an OVER () clause.
Usage
This time series function returns a double-precision floating-point
value representing the moving average estimate. TS_ARMA_MA calls
the function imsls_d_arma in
the IMSL libraries.
IMSL Mapping
The arguments of TS_ARMA_MA map
to the IMSL library function imsls_d_arma as
follows:
params = imsls_d_arma(n_objs, z, p, q, method_id, 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 – =1.
- q – maps to the user-defined aggregate function argument ma_count.
- method_id – maps to the method argument of TS_ARMA_MA.
For detailed information on how the function 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_MA 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 of an
array containing one element from the
data column
using the method of least squares:
SELECT TS_ARMA_MA(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_MA
res
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
0.105075
|
...
|
0.105075
|
Standards and Compatibility
- SQL – ISO/ANSI SQL compliant
- Sybase – not compatible with SQL Anywhere or Adaptive Server Enterprise