Similar to other predict methods, this function predicts fitted values from a fitted "hanaml.ARIMA" object.

# S3 method for ARIMA
predict(
  model,
  data = NULL,
  key = NULL,
  forecast.method = NULL,
  forecast.length = NULL,
  show.explainer = FALSE,
  thread.ratio = NULL,
  top.k.attributions = NULL,
  trend.mod = NULL,
  trend.width = NULL,
  seasonal.width = NULL,
  group.key = NULL,
  group.params = NULL,
  ...
)

Format

S3 methods

Arguments

model

R6Class object
A "hanaml.ARIMA" object for prediction.

data

DataFrame, optional
Includes the ID column and external Data (exogeneous variables) for prediction.
Defaults to NULL.

key

character, optional
Name of the key in the data.
Defaults to NULL and if data is not NULL and key is not provided, defaults to the first column.

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".

forecast.length

integer, optional
Number of points to forecast.
Defaults to 1.

show.explainer

logical, optional
Indicate whether to invoke the hanaml.ARIMA with explainations function in the predict. Only valide when background.size is set when initializing an hanaml.ARIMA instance. If TRUE, the contributions of trend, seasonal, transitory irregular and exogenous are shown in a attribute called explainer of hanaml.ARIMA and hanaml.AutoARIMA instance.
Defaults to FALSE.

thread.ratio

double, optional
Controls the proportion of available threads to use.
The ratio of available threads.

  • 0: single thread.

  • 0~1: percentage.

  • Others: heuristically determined.

Defaults to -1. Valid only when show.explainer is TRUE.

top.k.attributions

integer, optional
Specifies the number of attributes with the largest contribution that will be output. 0-contributed attributes will not be output.
Valid only when show.explainer is TRUE.
Defaults to 10.

trend.mod

double, optional
The real AR roots with inverse modulus larger than trend.mod will be integrated into trend component. Valid only when show.explainer is TRUE.
Cannot be smaller than 0.
Defaults to 0.4.

trend.width

double, optional
Specifies the bandwidth of spectrum of trend component in unit of rad. Valid only when show.explainer is TRUE. Cannot be smaller than 0.
Defaults to 0.035.

seasonal.width

double, optional
Specifies the bandwidth of spectrum of seasonal component in unit of rad. Valid only when show.explainer is TRUE. Cannot be smaller than 0.
Defaults to 0.035.

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:


 > marm <- hanaml.ARIMA(data=df,
                        massive=TRUE,
                        background.size=5,
                        group.key="GROUP_ID",
                        group.params=list("Group_1"=list('output.fitted'=FALSE)))
> mres <- predict(model=marm,
                  data=pred.df,
                  group.key="GROUP_ID",
                  key="TIMESTAMP",
                  show.explainer=TRUE,
                  group.params = list("GROUP_A"=list("forecast.method"="innovations.algorithm"),
                                      "GROUP_B"=list("forecast.method"="innovations.algorithm")))
 
...

Reserved parameter.

Value

Predicted values are returned as a DataFrame, structured as follows:

  • ID: with same name and type the ID column of data.

  • FORECAST: type DOUBLE, representing predicted values.

  • SE: type DOUBLE, standard error.

  • LO80: type DOUBLE, low 80% values.

  • HI80: type DOUBLE, high 80% values.

  • LO95: type DOUBLE, low 95% values.

  • HI95: type DOUBLE, high 95% values.

Note that if show.explainer=TRUE, the attribute explainer is generated.
When massive=TRUE, an additional error message DataFrame is returned.

Examples

Apply predict:


> res <- predict(arm,
                 forecast.method="innovations.algorithm",
                 forecast.length=10)

  TIMESTAMP   FORECAST       SE       LO80       HI80       LO95       HI95
1         0  1.5577828 1.302436 -0.1113569  3.2269225 -0.9949452  4.1105108
2         1  3.7659871 1.315333  2.0803200  5.4516542  1.1879826  6.3439917
3         2 -0.5655989 1.315333 -2.2512660  1.1200682 -3.1436035  2.0124056
4         3 -3.6198158 1.315333 -5.3054829 -1.9341487 -6.1978203 -1.0418112
......

If you want to see the decomposed result of predict result, you could set background.size when initializing an instance and set show.explainer = TRUE in the predict():


> 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,
                      background.size=10)

Invoke the predict:


> result <- predict(arm,
                    forecast.method='innovations.algorithm',
                    forecast.length=3,
                    show.explainer=TRUE)

Show the explainer of a hanaml.ARIMA instance:


> arm$explainer$Collect()
  TIMESTAMP     TREND  SEASONAL TRANSITORY    IRREGULAR EXOGENOUS
 1        0 0.1008612  1.219432         NA  0.240144261
 2        1 0.4480173  2.702730         NA  0.623665918
 3        2 0.7581872 -1.321559         NA -0.006658614
 

See also