25.10.2016 Views

SAP HANA Predictive Analysis Library (PAL)

sap_hana_predictive_analysis_library_pal_en

sap_hana_predictive_analysis_library_pal_en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.5.11 Seasonality Test<br />

This algorithm is used to test whether a time series has a seasonality or not. If it does, the corresponding<br />

additive or multiplicative seasonality model is identified, and the de-seasonalized series (both trend and<br />

seasonality are eliminated) is given.<br />

Typically, there are two decomposition models for a time series:<br />

1. Additive: x t = m t + s t + y t<br />

2. Multiplicative: x t = m t × s t × y t<br />

Where m t , s t , and y t are trend, seasonality, and random components, respectively. They satisfy the properties:<br />

Where d is the length of the seasonality cycle, that is, the period. It is believed that the additive model is useful<br />

when the seasonal variation is relatively constant over time, whereas the multiplicative model is useful when<br />

the seasonal variation increases over time.<br />

Autocorrelation is employed to identify the seasonality. The autocorrelation coefficient at lag h is given by:<br />

r h = c h / c 0<br />

Where c h is the autocovariance function<br />

The resulting r h has a value in the range of −1 to 1, and a larger value indicates more relevance.<br />

For an n-element time series, the probable seasonality cycle is from 2 to n/2. The main procedure to<br />

determine the seasonality, therefore, is to calculate the autocorrelation coefficients of all possible lags<br />

(d=2,3,...,n) in the case of both additive and multiplicative models. There is a user-specified threshold for<br />

the coefficient, for example, 0.2, indicating that only if the autocorrelation is larger than the threshold is the<br />

tested seasonality considered. If there is no lag satisfying the requirement, the time series is regarded to have<br />

no seasonality. Otherwise, the one having the largest autocorrelation is the optimal seasonality.<br />

Practically, the autocorrelation coefficient at lag of d is calculated as follows:<br />

1. Estimate the trend (t = q+1, ..., n−q). Here moving average is applied to estimate the trend,<br />

that is,<br />

2. De-trend the time series. For an additive model, this is done by subtracting the trend estimates from the<br />

series. For a multiplicative decomposition, likewise, this is done by dividing the series by the trend values.<br />

And then two sets (additive and multiplicative) of autocorrelation coefficients are calculated from the detrended<br />

series.<br />

416 P U B L I C<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Predictive</strong> <strong>Analysis</strong> <strong>Library</strong> (<strong>PAL</strong>)<br />

<strong>PAL</strong> Functions

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!