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 setarforest which is a trained SETAR-Forest model.

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 newdata is a list of time series. Default value is 5.

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 forecast. Each list object is corresponding with a time series and its forecasts. Each list object contains 7 properties: method (the name of the forecasting method, SETAR-Forest, as a character string), x (the original time series), mean (point forecasts as a time series), series (the name of the series as a character string), upper (upper bound of confidence intervals), lower (lower bound of confidence intervals) and level (confidence level of prediction intervals).

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)



[Package setartree version 0.2.1 Index]