hanaml.SeasonalDecompose is a R wrapper for SAP HANA PAL seasonality test.

hanaml.SeasonalDecompose(
  data,
  key = NULL,
  endog = NULL,
  alpha = NULL,
  thread.ratio = NULL,
  extrapolation = NULL,
  smooth.width = NULL,
  auxiliary.normalitytest = NULL,
  periods = NULL
)

Arguments

data

DataFrame
DataFrame containting the data.

key

character, optional
Name of the ID column.
Defaults to the first column if not provided.

endog

character, optional
The endogenous variable, i.e. time series.
Defaults to the first non-ID column.

alpha

double, optional
The criterion for the autocorrelation coefficient. The value range is (0, 1). A larger value indicates stricter requirement for seasonality.
Defaults to 0.2.

thread.ratio

double, optional
Controls the proportion of available threads that can be used by this function.
The value range is from 0 to 1, where 0 indicates a single thread, and 1 indicates all available threads. Values between 0 and 1 will use up to that percentage of available threads.
Values outside the range from 0 to 1 are ignored, and the actual number of threads used is then be heuristically determined.
Defaults to -1.

extrapolation

logical, optional
Specifies whether to extrapolate the endpoints. Set to 1 when there’s an end-point issue.
Defaults to FALSE.

smooth.width

integer, optional
Specifies the width of the moving average applied to non-seasonal data. 0 indicates linear fitting to extract trends. Can not be larger than half of the data length.
Defaults to 0.

auxiliary.normalitytest

logical, optional
Specifies whether to use normality test to identify model types.
Defaults to FALSE.

periods

integer, optional
Length of the periods. When this parameter is specified between 2 and half of the series length, autocorrelation value is calculated for this number of periods and the result is compared to alpha parameter. If correlation value is equal to or higher than alpha, decomposition is executed with the value of periods. Otherwise, decomposition is executed with no seasonality. For other value of periods, decomposition is also executed with no seasonality.
Defaults to NULL.

Value

Returns a list of DataFrames:

  • DataFrame 1
    Statistics for time series, structured as follows:

    • STAT_NAME: includes type (additive or multiplicative), period (number of seasonality), acf (autocorrelation coefficient).
      STAT_VALUE:value of stats above.

  • DataFrame 2
    Seasonal decomposition table, structured as follows::

    • ID: index/time stamp.

    • SEASONAL: seasonality component.

    • TREND: trend component.

    • RANDOM: white noise component.

Examples

Input DataFrame data:


> data$Collect()
   TIMESTAMP    Y
1          1   10
2          2    7
3          3   17
4          4   34
5          5    9
......
31        31   83
32        32   55
33        33  207
34        34   25
35        35    0
36        36    0

Invoke the function:


> sd <- hanaml.SeasonalDecompose(data = data,
                                 thread.ratio = 0.5,
                                 alpha = 0.2)

Output:


> sd[[1]]$Collect()
  STAT_NAME     STAT_VALUE
1      type multiplicative
2    period              4
3       acf       0.501947

> sd[[2]]$Collect()
   TIMESTAMP  SEASONAL   TREND    RANDOM
1          1 1.2526605  10.125 0.7884453
2          2 0.3499516  14.000 1.4287688
3          3 0.7488509  16.875 1.3452711
4          4 1.6485370  16.750 1.2313043
......
33        33 1.2526605  82.125 2.0121557
34        34 0.3499516  64.875 1.1011706
35        35 0.7488509  32.125 0.0000000
36        36 1.6485370   3.125 0.0000000