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

# S3 method for AdditiveModelForecast
predict(
  model,
  data,
  logistic.growth.capacity = NULL,
  interval.width = NULL,
  uncertainty.samples = NULL
)

Arguments

model

R6Class object
An "AdditiveModelForecast" object for prediction.

data

DataFrame
Input data. The structure is as follows.

  • The first column: index (ID), timestamp.

  • The second column: placeholder column, must be double.

  • Other columns: external data.

logistic.growth.capacity

numeric, optional
Specify the carrying capacity for logistic growth.
Mandatory and valid only when the growth attribute is "logistic".

interval.width

numeric, optional
Width of the uncertainty intervals. Defaults to 0.8 if not provided.

uncertainty.samples

numeric, optional
Number of simulated draws used to estimate uncertainty intervals. Defaults to 1000 if not provided.

Format

S3 methods

Value

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

  • ID column: type timestamp.

  • YHAT: type DOUBLE, representing predicted values.

  • YHAT_LOWER: type DOUBLE, lower bound of confidence region.

  • YHAT_UPPER: type DOUBLE, upper bound of confidence region.

Examples

Input DataFrame data2:

> data2$Collect()
   TIMESTAMP          X
1 2007-12-11 -0.6361264
2 2007-12-12  3.0925087
3 2007-12-13 -0.7373356
4 2007-12-14 -3.1421910

Call the function with a "AdditiveModelForecast" object amf and obtain the result:

> res <- predict(amf, data2)
   TIMESTAMP       YHAT YHAT_LOWER YHAT_UPPER
1 2007-12-11  0.1378272  -1.922812  2.2191343
2 2007-12-12 -0.5874185  -2.610632  1.4819355
3 2007-12-13 -1.3126642  -3.376615  0.5591713
4 2007-12-14 -2.0379099  -4.086953  0.1144007

See also