bforecast: Perform bootstrap SSA forecasting of the series

Description Usage Arguments Details Value See Also Examples

View source: R/forecast.R

Description

Perform bootstrap SSA forecasting of the one-dimensional series.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## S3 method for class '1d.ssa'
bforecast(x, groups, len = 1, R = 100, level = 0.95,
          type = c("recurrent", "vector"),
          interval = c("confidence", "prediction"),
          only.new = TRUE,
          only.intervals = FALSE, ...,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'toeplitz.ssa'
bforecast(x, groups, len = 1, R = 100, level = 0.95,
          type = c("recurrent", "vector"),
          interval = c("confidence", "prediction"),
          only.new = TRUE,
          only.intervals = FALSE, ...,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)

Arguments

x

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

R

number of bootstrap replications

level

vector of confidence levels for bounds

type

the type of forecast method to be used during bootstrapping

interval

type of interval calculation

only.new

logical, if 'FALSE' then confidence bounds for the signal as well as prediction are reported

only.intervals

logical, if 'TRUE' then bootstrap method is used for confidence bounds only, otherwise — mean bootstrap forecast is returned as well

...

additional arguments passed to forecasting routines

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 attributes of the input series are not copied to the reconstructed ones

cache

logical, if 'TRUE' then intermediate results will be cached in the SSA object

Details

The routine uses the reconstruction residuals in order to calculate their empirical distribution (the residuals are assumed to be stationary). Empirical distribution of the residuals is used to perform bootstrap series simulation. Such bootsrapped series are then extended via selected forecast method. Finally, the distribution of forecasted values is used to calculate bootstrap estimate of series forecast and confidence bounds.

Value

List of matricies. Each matrix has 1 + 2*length(level) columns and 'len' rows. First column contains the forecasted values, remaining columns — low and upper bootstrap confidence bounds for average forecasted values.

The matrix itself, if length of groups is one and 'drop = TRUE'.

See Also

Rssa for an overview of the package, as well as, rforecast, vforecast, forecast.

Examples

1
2
3
4
5
6
7
# Decompose 'co2' series with default parameters
s <- ssa(co2)
# Produce 24 forecasted values and confidence bounds of the series using
# the first 3 eigentriples as a base space for the forecast.

f <- bforecast(s, groups = list(1:3), len = 24, R = 50)
matplot(f, col = c("black", "red", "red"), type='l')

Example output

Loading required package: svd
Loading required package: forecast

Attaching package: 'Rssa'

The following object is masked from 'package:stats':

    decompose

Rssa documentation built on Oct. 4, 2017, 5:06 p.m.