forecast: Forecast From ARIMA Fits

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Forecasts from models fitted by arima or estimate function.

Usage

1
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 - α)% 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 - α)% lower bound (Lower) and upper bound (Upper) of confidence interval.

Author(s)

Debin Qiu

See Also

predict.Arima

Examples

1
2
3
4
5
6
7
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)

Example output

Attaching package: 'aTSA'

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

    identify

ARIMA(3,0,0) model is estimated for variable: x 

Conditional-Sum-of-Squares & Maximum Likelihood Estimation 
      Estimate    S.E t.value p.value Lag
MU     -0.0967 0.1502  -0.643 0.52152   1
AR 1    0.2907 0.0989   2.940 0.00411   1
AR 2    0.2917 0.0985   2.961 0.00387   2
AR 3   -0.1800 0.0983  -1.831 0.07016   3
-----
n = 100; 'sigma' = 0.9020852; AIC = 273.5167; SBC = 283.9374
------------------------------ 
Correlation of Parameter Estimates 
           MU   AR 1    AR 2   AR 3 
MU     1.0000 -0.2462 -0.2525 0.0155
AR 1  -0.2462  1.0000 -0.2491 0.0148
AR 2  -0.2525 -0.2491  1.0000 0.0184
AR 3   0.0155  0.0148  0.0184 1.0000
------------------------------ 
Autocorrelation Check of Residuals 
     lag     LB p.value
[1,]   4  0.705   0.951
[2,]   8  2.669   0.953
[3,]  12 11.696   0.470
[4,]  16 13.824   0.612
[5,]  20 16.209   0.704
[6,]  24 17.640   0.820
------------------------------ 
Model for variable: x 
Estimated mean: -0.09665571 
AR factors: 1 + 0.2907 B**(1) + 0.2917 B**(2) - 0.18 B**(3)
Forecast for univariate time series: 
    Lead Forecast   S.E Lower Upper
101    1  0.30740 0.902 -1.46  2.08
102    2  0.48765 0.939 -1.35  2.33
103    3 -0.08181 0.999 -2.04  1.88
104    4  0.00538 0.999 -1.95  1.96
------ 
Note: confidence level = 95 % 
Forecast for univariate time series: 
           Lead Forecast   S.E Lower Upper
2014-07-04    1  0.30740 0.902 -1.46  2.08
2014-07-05    2  0.48765 0.939 -1.35  2.33
2014-07-06    3 -0.08181 0.999 -2.04  1.88
2014-07-07    4  0.00538 0.999 -1.95  1.96
------ 
Note: confidence level = 95 % 

aTSA documentation built on May 1, 2019, 8:47 p.m.