Time series and forecasting functions

Sybase IQ 15.1 includes new functions for financial time series and forecasting analysis. These functions are available only with RAP – The Trading Edition Enterprise.

The new SQL functions call two third-party integrated libraries. The IMSL C Stat and C Math libraries, provided by Visual Numerics, contain C functions for time series and forecasting. Sybase IQ 15.1 automatically loads the IMSL libraries as needed when you call a valid function for time series and forecasting analysis. See “Loading the IMSL libraries for time series and forecasting functions” in Chapter 4, “SQL Functions,” in Reference: Building Blocks, Tables, and Procedures.

For information on how Sybase IQ handles and logs errors if a runtime error occurs when invoking IMSL library functions, see “IMSL library time series function error-handling” in Chapter 4, “SQL Functions,” in Reference: Building Blocks, Tables, and Procedures.

The new time series and forecasting SQL functions are:

TS_ARMA_AR Calculates the least-square estimates of parameters for an autoregressive moving average (ARMA) model and returns the requested autoregressive estimate.

TS_ARMA_CONST Calculates the least-square estimates of parameters for an autoregressive moving average (ARMA) model and returns an estimated constant.

TS_ARMA_MA Calculates the least-square estimates of parameters for an autoregressive moving average (ARMA) model, and returns the requested moving average estimate.

TS_AUTOCORRELATION Calculates the sample autocorrelation function of a stationary time series.

TS_AUTO_UNI_AR Performs automatic selection and fitting of a univariate autoregressive time series model.

TS_BOX_COX_XFORM Performs a forward or inverse Box-Cox power transformation.

TS_DIFFERENCE Differences a seasonal or nonseasonal time series.

TS_ESTIMATE_MISSING Estimates the missing values in a time series and returns them as a new time series interspersed with the original time series.

TS_LACK_OF_FIT Performs a lack-of-fit test for a univariate time series or transfer function given the appropriate correlation function.

TS_LACK_OF_FIT_P Same as TS_LACK_OF_FIT except that it returns the p-value of q, rather than returning q.

TS_MAX_ARMA_AR 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_CONST Calculates the exact maximum likelihood estimation of the parameters in a univariate ARMA time series model, and returns the constant estimate.

TS_MAX_ARMA_LIKELIHOOD Calculates the exact maximum likelihood estimation of the parameters in a univariate ARMA time series model, and returns likelihood value (ln) for the fitted model.

TS_MAX_ARMA_MA Calculates the exact maximum likelihood estimation of the parameters in a univariate ARMA time series model, and returns the requested moving average estimate.

TS_OUTLIER_IDENTIFICATION Detects and determines outliers and simultaneously estimates the model parameters in a time series where the underlying outlier-free series follows a general seasonal or nonseasonal ARMA model.

TS_PARTIAL_AUTOCORRELATION Calculates the sample partial autocorrelation function of a stationary time series.

TS_VWAP Calculates the ratio of the value traded to total volume traded over a particular time horizon. VWAP (Volume-Weighted Average Price) is a measure of the average price of a stock over a defined trading horizon.

NoteThe TS_VWAP function is used for financial time series calculations, but it does not load the IMSL libraries.

For detailed information on each of the above functions, including the mapping between a SQL function and its corresponding IMSL C function, see “Alphabetical list of functions” in Chapter 4, “SQL Functions,” in Reference: Building Blocks, Tables, and Procedures.

For reference information on the IMSL C functions, see IMSL Numerical Library Users Guide: Volume 2 of 2 C Stat Library.