predict function

Predict method for modeling objects

Predict method for modeling objects

Obtains time series predictions based on a trained model and a particular prediction function defined in a modeling object.

## S3 method for class 'MLM' predict(object, mdl, data, n.ahead, ..., onestep = TRUE) ## S3 method for class 'linear' predict(object, mdl, data, n.ahead, ..., onestep = TRUE)

Arguments

  • object: An object of class modeling defining a particular model.

  • mdl: A time series model object used for prediction.

  • data: A list of time series data input for prediction.

  • n.ahead: Integer defining the number of observations to be predicted.

  • ...: Other parameters passed to pred_func of object.

  • onestep: Should the function produce one-step ahead predictions? If FALSE, a multi-step ahead prediction approach is adopted.

    For predict.MLM, sw of object may be used to transform the time series input in data into sliding windows used during prediction. Also, proc of object may be used to preprocess/postprocess the input during prediction.

Returns

A list containing object and the produced predictions.

Examples

data(CATS,CATS.cont) a <- ARIMA() model <- train(a,list(CATS[,1]))$results[[1]]$res pred_data <- predict(a,model,data=NULL,n.ahead=20,onestep=FALSE) n <- NNET(size=5, sw=SW(window_len = 5+1), proc=list(MM=MinMax())) model <- train(n,list(CATS[,1]))$results[[1]]$res pred_data <- predict(n,model,data=list(CATS.cont[,1]),n.ahead=20)

See Also

Other predict: predict.tspred()

Author(s)

Rebecca Pontes Salles

  • Maintainer: Rebecca Pontes Salles
  • License: GPL (>= 2)
  • Last published: 2021-01-21