TS_ESTIMATE_MISSING function [Time Series]

NoteThis function is available only with RAP – The Trading Edition Enterprise.

Function

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

Syntax

TS_ESTIMATE_MISSING (timeseries_expression, method)
OVER (window-spec)

Parameters

timeseries_expression A numeric expression, generally a column name, containing an element in a time series to be differenced. If a null-value is provided, it is assumed to reflect a gap in the time series, the value of which will be computed by the function.

method (Optional) An integer specifying the method to use when determining missing values:

window-spec TS_ESTIMATE_MISSING is an OLAP function requiring an OVER () clause with an unbounded window. This function does not support value-based windows; for example, you cannot use a range specifier in the OVER () clause.

Usage

Use TS_ESTIMATE_MISSING to estimate any missing equidistant time points using one of the four estimation methods. TS_ESTIMATE_MISSING calls the function imsls_d_estimate_missing in the IMSL libraries

You cannot use TS_ESTIMATE_MISSING if more than two consecutive NULL values exist in your set of timepoints. If the first or last two values in the set of timepoints are NULL, the function returns NULL.

IMSL mapping

The arguments of TS_ESTIMATE_MISSING map to the IMSL library function imsls_d_estimate_missing as follows:

params = imsls_d_estimate_missing(n_objs, tpoints[], z[], method, 0);

n_objs Contains the number of rows in the current window frame.

tpoints An array of indexes for specifying missing values in a sequence of timepoints.

z[] The accumulated timeseries_expression, obtained during calls to next_value.

method Maps to the method argument defined in TS_ESTIMATE_MISSING.

For detailed information on how the function imsls_d_estimate_missing performs time series calculations, see IIMSL Numerical Library User’s Guide: Volume 2 of 2 C Stat Library.

Example

This example shows an input data table, a SQL statement containing the TS_ESTIMATE_MISSING function, and the data values returned by the function. This example uses the following table (called EST_MISSING_DATASET) as its input data. The EST_MISSING_DATASET table contains nine rows of time series data:

Table 4-42: Input data table EST_MISSING_DATASET

rownum

data

1

2.8223

2

-0.5721

3

2.2771

4

NULL

5

1.2648

6

1.0278

7

0.6991

8

-1.7539

9

-2.8875

The following SQL statement estimates the value of the data missing from the fourth row:

SELECT ts_estimate_missing(data,0) OVER (order by rownum rows between unbounded preceding and unbounded following) AS res FROM EST_MISSING_DATASET

Sybase IQ returns the following nine rows, replacing the NULL value with 1.0278:

Table 4-43: Values returned from TS_ESTIMATE_MISSING

res

2.8223

-0.5721

2.2771

1.0278

1.2648

1.0278

0.6991

-1.7539

-2.8875

Standards and compatibility

See also

Chapter 2, “Using OLAP” in the System Administration Guide: Volume 2

IMSL Numerical Library User’s Guide: Volume 2 of 2 C Stat Library