forecast.setartree {setartree}R Documentation

Forecast method for SETAR-Tree fits

Description

Obtains forecasts for a given set of time series or a dataframe/matrix of new instances from a fitted SETAR-Tree model.

Usage

## S3 method for class 'setartree'
forecast(object, newdata, h = 5, level = c(80, 95), ...)

Arguments

object

An object of class setartree which is a trained SETAR-Tree model.

newdata

A list of time series which needs 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-Tree").

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-Tree, 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 predictions, prediction intervals (upper and lower bounds), the size and standard deviations of the residuals of the models used to get each prediction is returned.

Examples


# Obtaining forecasts for a list of time series
tree1 <- setartree(chaotic_logistic_series)
forecast(tree1, chaotic_logistic_series)

# Obtaining forecasts for a set of test instances
tree2 <- setartree(data = web_traffic_train[,-1],
                   label = web_traffic_train[,1],
                   stopping_criteria = "both",
                   categorical_covariates = "Project")
forecast(tree2, web_traffic_test)



[Package setartree version 0.2.1 Index]