Learn R Programming

itsmr (version 1.1)

forecast: Forecast future values

Description

Forecast future values

Usage

forecast(x, xv, a, h = 10, opt = 2)

Arguments

x
Data vector
xv
Transform vector
a
ARMA model
h
Steps ahead
opt
Display option (0 silent, 1 tabulate, 2 plot and tabulate)

Value

  • Returns the following list invisibly.
  • predPredicted values
  • seStandard errors (not included if there is a log transform)
  • lLower bounds (95% confidence interval)
  • uUpper bounds

Details

The transform vector can be NULL for none. Otherwise xv is a vector that specifies a sequence of transform functions.

Example:

xv = c("log","season",12,"trend",1)

The above tansform vector takes the log of the data, then subtracts a seasonal component of period 12, then subtracts a linear trend component.

There are five functions from which to choose. ll{ diff Difference the data. Has a single argument, the lag. hr Subtract harmonic components. Has one or more arguments, each specifying the number of observations per harmonic. log Take the log of the data, has no arguments. season Subtract a seasonal component. Has a single argument, the number of observations per season. trend Subtract a trend component. Has a single argument, the order of the trend (1 linear, 2 quadratic, etc.) }

At the end of the transform vector there is an implied subtraction of the mean operation. Hence the resulting time series always has zero mean.

All of the transformations are inverted before the forecast results are displayed.

See Also

arma Resid test

Examples

Run this code
xv = c("log","season",12,"trend",1)
e = Resid(wine,xv)
a = arma(e,1,1)
forecast(wine,xv,a)

Run the code above in your browser using DataLab