forecast.setarforest {setartree} | R Documentation |
Forecast method for SETAR-Forest fits
Description
Obtains forecasts for a given set of time series or a dataframe/matrix of new instances from a fitted SETAR-Forest model.
Usage
## S3 method for class 'setarforest'
forecast(object, newdata, h = 5, level = c(80, 95), ...)
Arguments
object |
An object of class |
newdata |
A list of time series which need forecasts or a dataframe/matrix of new instances which need predictions. |
h |
The required number of forecasts (forecast horizon). This parameter is only required when |
level |
Confidence level for prediction intervals. Default value is c(80, 95). |
... |
Other arguments. |
Value
If newdata
is a list of time series, then an object of class mforecast
is returned.
The plot
or autoplot
functions in the R forecast
package can then be used to produce a plot of any time series in the returned object which contains the following properties.
method |
A vector containing the name of the forecasting method ("SETAR-Forest"). |
forecast |
A list of objects of class |
If newdata
is a dataframe/matrix, then a list containing the prediction and prediction intervals (upper and lower bounds) of each instance is returned.
Examples
# Obtaining forecasts for a list of time series
forest1 <- setarforest(chaotic_logistic_series, bagging_freq = 2, num_cores = 1)
forecast(forest1, chaotic_logistic_series)
# Obtaining forecasts for a set of test instances
forest2 <- setarforest(data = web_traffic_train[,-1],
label = web_traffic_train[,1],
bagging_freq = 2,
num_cores = 1,
categorical_covariates = "Project")
forecast(forest2, web_traffic_test)