This function is available only with RAP – The Trading Edition Enterprise.
Calculates the exact maximum likelihood estimation of the parameters in a univariate ARMA (autoregressive moving average) time series model, and returns the requested autoregressive estimate.
TS_MAX_ARMA_AR (timeseries_expression, ar_count, ar_elem)
OVER (window-spec)
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 element in the computed autoregressive array is to be returned. The integer must be greater than 0 and less than or equal to ar_count.
window-spec TS_MAX_ARMA_AR is an OLAP function requiring an OVER () clause.
This function returns a double-precision floating-point value containing the autoregressive estimate. TS_MAX_ARMA_AR calls the function imsls_d_max_arma in the IMSL libraries.
The arguments of TS_MAX_ARMA_AR map to the IMSL library function imsls_d_max_arma as follows:
params = imsls_d_max_arma(n_objs, z[], p, q, 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 ar_count argument.
For detailed information on how the IMSL function imsls_d_max_arma performs time series calculations, see IMSL Numerical Library User’s Guide: Volume 2 of 2 C Stat Library.
This example shows an input data table, a SQL statement containing the TS_MAX_ARMA_AR function, and the data values returned by the function. This example uses the following table (called DATASET) as its input data. The DATASET table contains 50 rows of time series data:
rownum |
data |
---|---|
1 |
0.315523 |
2 |
0.485859 |
3 |
0.676886 |
4 |
1.97381 |
5 |
2.77555 |
6 |
2.73657 |
7 |
2.64233 |
8 |
4.26118 |
9 |
3.13641 |
10 |
4.16566 |
11 |
2.95952 |
12 |
2.14504 |
13 |
1.98799 |
14 |
0.805859 |
15 |
0.833405 |
16 |
2.29075 |
17 |
1.30045 |
18 |
0.467122 |
19 |
-0.170107 |
20 |
-0.256657 |
21 |
-0.382597 |
22 |
-0.505511 |
23 |
-1.90147 |
24 |
-0.981688 |
25 |
-1.43116 |
26 |
-1.39389 |
27 |
-2.34823 |
28 |
-2.91122 |
29 |
-0.927423 |
30 |
-0.044383 |
31 |
-0.389648 |
32 |
0.545008 |
33 |
0.614096 |
34 |
0.364668 |
35 |
1.16043 |
36 |
-0.654063 |
37 |
0.616094 |
38 |
2.00875 |
39 |
1.86696 |
40 |
2.80171 |
41 |
3.78422 |
42 |
4.11499 |
43 |
2.77188 |
44 |
4.00312 |
45 |
4.21298 |
46 |
5.00413 |
47 |
4.74498 |
48 |
4.89621 |
49 |
3.93273 |
50 |
4.31592 |
The following SQL statement returns the second element from an array containing two autoregressive estimates of data from the data column:
select ts_max_arma_ar(data,2,2) 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:
res |
---|
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
0.179748 |
... |
0.179748 |
This example provides a sample query that returns two columns of results from the DATASET table—the first and second elements of the autoregressive estimates. See Table 4-48 for the DATASET table.
select ts_max_arma_ar(data,2,1) over (order by rownum rows between unbounded preceding and unbounded following) as ar_elem1, ts_max_arma_ar(data,2,2) over (order by rownum rows between unbounded preceding and unbounded following) as ar_elem2 FROM DATASET
Sybase IQ returns 50 rows of data, each containing the same two values:
ar_elem1 |
ar_elem2 |
---|---|
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
0.731164 |
0.179748 |
... |
... |
0.731164 |
0.179748 |
Chapter 2, “Using OLAP” in the System Administration Guide: Volume 2
IMSL Numerical Library User’s Guide: Volume 2 of 2 C Stat Library