hanaml.ARIMA is a R wrapper for SAP HANA PAL ARIMA algorithm.

hanaml.ARIMA(
  data = NULL,
  key = NULL,
  endog = NULL,
  exog = NULL,
  order = NULL,
  order.p = NULL,
  order.q = NULL,
  order.d = NULL,
  seasonal.order = NULL,
  seasonal.order.p = NULL,
  seasonal.order.d = NULL,
  seasonal.order.q = NULL,
  seasonal.order.s = NULL,
  method = NULL,
  include.mean = NULL,
  forecast.method = NULL,
  output.fitted = NULL,
  thread.ratio = NULL,
  background.size = NULL,
  massive = FALSE,
  group.key = NULL,
  group.params = 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.

exog

character or list of characters, optional
An optional array of exogenous variables. Valid only for ARIMAX; cannot be the first ID column and the name of endog column.
Defaults to NULL, i.e. no exogenous columns in data.

order

list/vector of integers, optional
(p, q, d) values of the auto regression, moving average and differentiation order.
If order is set, the value assignment of order.p, order.d and order.q will be ignored.
Defaults to c(0,0,0).

order.p

integer, optional
value of the auto regression order.
Defaults to 0.

order.q

integer, optional
value of the differentiation order.
Defaults to 0.

order.d

integer, optional
Value of the differentiation order.
Defaults to 0.

seasonal.order

list of integers, optional
(P, Q, D, S) values of the auto regression, differentiation, moving average order and seasonal period for the seasonal part.
If seasonal.order is set, the value assignment of seasonal.order.p, seasonal.order.d seasonal.order.q and seasonal.order.s will be ignored.
Defaults to (0,0,0,0).

seasonal.order.p

integer, optional
value of the auto regression order for the seasonal part.
Defaults to 0.

seasonal.order.d

integer, optional
value of the differentiation order for the seasonal part.
Defaults to 0.

seasonal.order.q

integer, optional
value of the moving average order for the seasonal part.
Defaults to 0.

seasonal.order.s

integer, optional
value of the seasonal period.
Defaults to 0.

method

c("css", "mle", "css-mle"), optional
The object function for integer optimization.

  • "css": use the conditional sum of squares.

  • "mle": use the maximized likelihood estimation.

  • "css-mle": use css to approximate starting values and mle to fit.


Defaults to "css-mle".

include.mean

logical, optional
ARIMA model includes a constant part if TRUE.
Valid only when d + D <= 1. if d + D = 0, TRUE. else FALSE

forecast.method

{"formula.forecast", "innovations.algorithm"}, optional
Store information for the subsequent forecast method.

  • "formula.forecast": compute future series via formula.

  • "innovations.algorithm": apply innovations algorithm to compute future series, which requires more original information to be stored

Defaults to "innovations.algorithm".

output.fitted

logical, optional
Output fitted result and residuals if TRUE.
Defaults to TRUE.

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 this range are ignored.
Defaults to 0.

background.size

integer, optional
Indicates the nubmer of data points used in hanaml. ARIMA with explainations in the predict.ARIMA function.
If you want to use the ARIMA with explainations, you must background.size to be larger than 0 or -1(auto mode) when initializing an hanaml.ARIMA instance the and then set show.explainer=TRUE in the predict function.
Defaults to NULL(no explainations).

massive

logical, optional
Specifies whether or not to use massive mode.
For parameter setting in massive mode, you could use both group.params (please see the example below) or the original parameters. Using original parameters will apply for all groups. However, if you define some parameters of a group, the value of all original parameter setting will be not applicable to such group.
An example is as follows:


 > ad <- hanaml.ARIMA(data=df,
                      massive=TRUE,
                      background.size=5,
                      group.key='ID',
                      group.params=list('Group_1'=list('output.fitted'=FALSE')))
 

In this example, as 'output_fitted' is set in group.params for Group_1, parameter setting of 'background.size' is not applicable to Group_1. Defaults to FALSE.

group.key

character, optional
The column of group key. The data type can be INT or NVARCHAR/VARCHAR. If data type is INT, only parameters set in the group.params are valid. This parameter is only valid when massive is TRUE.
Defaults to the first column of data if group.key is not provided.

group.params

list, optional
If the massive mode is activated (massive = TRUE), input data shall be divided into different groups with different parameters applied.
An example is as follows:


 > ad <- hanaml.ARIMA(data=df,
                      massive=TRUE,
                      background.size=5,
                      group.key='ID',
                      group.params=list("Group_1"=list("output.fitted"=FALSE)))
 

Valid only when massive is TRUE and defaults to NULL.

Value

Returns a "hanaml.ARIMA" object with the following attributes:

  • model: DataFrame
    The Fitted model.

  • fitted: DataFrame
    Predicted dependent variable values for training data. Set to NULL if the training data has no row IDs.

  • explainer: DataFrame
    The with explainations with decomposition of trend, seasonal, transitory, irregular and reason code of exogenous variables. This attributes only returns when setting background.size in the initializing an hanaml.ARIMA instance and show.explainer=TRUE in the predict function.

  • error.msg : DataFrame
    Error message and only valid if massive is TRUE.

Details

Autoregressive Integrated Moving Average ARIMA(p, d, q) model.

Examples

Input DataFrame data:


> data$Collect()
   TIMESTAMP           Y
1          1 -0.63612643
2          2  3.09250865
3          3 -0.73733556
4          4 -3.14219098
5          5  2.08881981
.......

Invoke the function:


> arm <- hanaml.ARIMA(data = data,
                      order.p = 0,
                      order.d = 0,
                      order.q = 1,
                      seasonal.order.p = 1,
                      seasonal.order.s = 4,
                      method = "mle",
                      thread.ratio = 1.0,
                      output.fitted = TRUE)

Output:


> arm$fitted$Collect()
   TIMESTAMP      FITTED  RESIDUALS
1          1  0.02337363 -0.6595001
2          2  0.11459591  2.9779127
3          3 -0.39656680 -0.3407688
4          4  0.10108234 -3.2432733
5          5 -0.43702717  2.5258470
6          6  2.34169970  0.8376030
......

See also