forecast: Forecast From ARIMA Fits

View source: R/forecast.R

forecastR Documentation

Forecast From ARIMA Fits

Description

Forecasts from models fitted by arima or estimate function.

Usage

forecast(object, lead = 1, id = NULL, alpha = 0.05, output = TRUE)

Arguments

object

the result of an arima or estimate fit.

lead

the number of steps ahead for which prediction is required. The default is 1.

id

the id of the observation which is the time. The default is NULL.

alpha

the significant level for constructing the confidence interval of prediction. The default is 0.05.

output

a logical value indicating to print the results in R console. The default is TRUE.

Details

This function is originally from predict.Arima in stats package, but has a nice output including 100*(1 - \alpha)% confidence interval and a prediction plot. It is similar to FORECAST statement in PROC ARIMA of SAS.

Value

A matrix with lead rows and five columns. Each column represents the number of steps ahead (Lead), the predicted values (Forecast), the standard errors (S.E) and the 100*(1 - \alpha)% lower bound (Lower) and upper bound (Upper) of confidence interval.

Author(s)

Debin Qiu

See Also

predict.Arima

Examples

x <- arima.sim(list(order = c(3,0,0),ar = c(0.2,0.4,-0.15)),n = 100)
fit <- estimate(x,p = 3) # same as fit <- arima(x,order = c(3,0,0))
forecast(fit,lead = 4)

# forecast with id
t <- as.Date("2014-03-25") + 1:100
forecast(fit,lead = 4, id = t)

aTSA documentation built on May 29, 2024, 8:50 a.m.