Learn R Programming

timsac (version 1.3.8-4)

prdctr: Prediction Program

Description

Operate on a real record of a vector process and compute predicted values.

Usage

prdctr(y, r, s, h, arcoef, macoef = NULL, impulse = NULL, v, plot = TRUE)

Value

predct

predicted values : predct[i] (r\(\le i \le\)s\(+\)h).

ys

predct[i] - y[i] (r\(\le i \le n\)).

pstd

predct[i] + (standard deviation) (s\(\le i \le\)s\(+\)h).

p2std

predct[i] + 2*(standard deviation) (s\(\le i \le\)s\(+\)h).

p3std

predct[i] + 3*(standard deviation) (s\(\le i \le\)s\(+\)h).

mstd

predct[i] - (standard deviation) (s\(\le i \le\)s\(+\)h).

m2std

predct[i] - 2*(standard deviation) (s\(\le i \le\)s\(+\)h).

m3std

predct[i] - 3*(standard deviation) (s\(\le i \le\)s\(+\)h).

Arguments

y

a univariate time series or a multivariate time series.

r

one step ahead prediction starting position \(R\).

s

long range forecast starting position \(S\).

h

maximum span of long range forecast \(H\).

arcoef

AR coefficient matrices.

macoef

MA coefficient matrices.

impulse

impulse response matrices.

v

innovation variance.

plot

logical. If TRUE (default), the real data and predicted values are plotted.

Details

One step ahead Prediction starts at time \(R\) and ends at time \(S\). Prediction is continued without new observations until time \(S+H\). Basic model is the autoregressive moving average model of \(y(t)\) which is given by $$y(t) - A(t)y(t-1) -...- A(p)y(t-p) = u(t) - B(1)u(t-1) -...- B(q)u(t-q),$$ where \(p\) is AR order and \(q\) is MA order.

References

H.Akaike, E.Arahata and T.Ozaki (1975) Computer Science Monograph, No.6, Timsac74, A Time Series Analysis and Control Program Package (2). The Institute of Statistical Mathematics.

Examples

Run this code
# "arima.sim" is a function in "stats".
# Note that the sign of MA coefficient is opposite from that in "timsac".
y <- arima.sim(list(order=c(2,0,1), ar=c(0.64,-0.8), ma=c(-0.5)), n = 1000)
y1 <- y[1:900]
z <- autoarmafit(y1)
ar <- z$model[[1]]$arcoef
ma <- z$model[[1]]$macoef
var <- z$model[[1]]$v
y2 <- y[901:990]
prdctr(y2, r = 50, s = 90, h = 10, arcoef = ar, macoef = ma, v = var)

Run the code above in your browser using DataLab