TS_AUTOCORRELATION Function [Aggregate]

Calculates the sample autocorrelation function of a stationary time series.

Syntax

TS_AUTOCORRELATION (timeseries_expression, lagmax, lag_elem)
OVER (window-spec)

Licensing Prerequisites

Available only with RAP – The Trading Edition Enterprise.

Parameters

Usage

This time series function returns a double-precision floating-point value representing the autocorrelation value. TS_AUTOCORRELATION calls the function imsls_d_autocorrelation in the IMSL libraries.

IMSL Mapping

The arguments of TS_AUTOCORRELATION map to the IMSL library function imsls_d_autocorrelation() as follows:

params = imsls_d_autocorrelation(n_objs, x[], lagmax, 0);

For detailed information on how the function imsls_d_autocorrelation 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_AUTOCORRELATION 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 second element from an array containing autocorrelations of the time series data from the data column:
SELECT TS_AUTOCORRELATION(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:

Values Returned from TS_AUTOCORRELATION

res

0.803659

0.803659

0.803659

0.803659

0.803659

0.803659

0.803659

0.803659

0.803659

...

0.803659

Standards and Compatibility

Related concepts
Aggregate Time Series Forecasting and Analysis Functions
Related reference
DATASET Example Input Data Table