Learn R Programming

Rssa (version 0.13-1)

forecast: Perform SSA forecasting of series

Description

All-in-one function to perform SSA forecasting of one-dimensional series.

Usage

"forecast"(object, groups, len = 1, method = c("recurrent", "vector", "bootstrap-recurrent", "bootstrap-vector"), ..., drop = TRUE, drop.attributes = FALSE, cache = TRUE) "forecast"(object, groups, len = 1, method = c("recurrent", "vector", "bootstrap-recurrent", "bootstrap-vector"), ..., drop = TRUE, drop.attributes = FALSE, cache = TRUE) "predict"(object, groups, len = 1, method = c("recurrent", "vector", "bootstrap-recurrent", "bootstrap-vector"), ..., drop = TRUE, drop.attributes = FALSE, cache = TRUE) "predict"(object, groups, len = 1, method = c("recurrent", "vector", "bootstrap-recurrent", "bootstrap-vector"), ..., drop = TRUE, drop.attributes = FALSE, cache = TRUE) "predict"(object, groups, len = 1, method = c("recurrent-column", "recurrent-row", "vector-column", "vector-row"), ..., drop = TRUE, drop.attributes = FALSE, cache = TRUE)

Arguments

object
SSA object holding the decomposition
groups
list, the grouping of eigentriples to be used in the forecast
len
the desired length of the forecasted series
method
method of forecasting to be used. The confidence bounds are available only for bootstrap-based methods
...
further arguments passed for forecast routines (e.g. level argument to bforecast)
drop
logical, if 'TRUE' then the result is coerced to series itself, when possible (length of 'groups' is one)
drop.attributes
logical, if 'TRUE' then the forecast routines do not try to infer the time index arguments for the forecasted series.
cache
logical, if 'TRUE' then intermediate results will be cached in the SSA object.

Value

object of class 'forecast' for forecast function call, predicted series for predict call.

Details

This function is a convenient wrapper over other forecast routines (see 'See Also') turning their value into object of type 'forecast' which can be used with the routines from forecast package.

See Also

Rssa for an overview of the package, as well as, rforecast, vforecast, bforecast, forecast (package)

Examples

Run this code
s <- ssa(co2)
# Calculate 24-point forecast using first 6 components as a base
f <- forecast(s, groups = list(1:6), method = "bootstrap-recurrent", len = 24, R = 10)

# Plot the result including the last 24 points of the series
plot(f, include = 24, shadecols = "green", type = "l")
# Use of predict() for prediction
p <- predict(s, groups = list(1:6), method = "recurrent", len = 24)
# Simple plotting
plot(p, ylab = "Forecasteed Values")

Run the code above in your browser using DataLab