Learn R Programming

timsac (version 1.3.0)

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, impuls=NULL, v, plot=TRUE)

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.
impuls
impulse response matrices.
v
innovation variance.
plot
logical. If TRUE (default) the real data and predicted values are plotted.

Value

  • predctpredicted values : predct(i) (r$<=i<=$s$+$h).
  • yspredct(i) - y(i) (r$<=i<=n$).< description="">
  • pstdpredct(i) + (standard deviation) (s$<=i<=$s$+$h).
  • p2stdpredct(i) + 2*(standard deviation) (s$<=i<=$s$+$h).
  • p3stdpredct(i) + 3*(standard deviation) (s$<=i<=$s$+$h).
  • mstdpredct(i) - (standard deviation) (s$<=i<=$s$+$h).
  • m2stdpredct(i) - 2*(standard deviation) (s$<=i<=$s$+$h).
  • m3stdpredct(i) - 3*(standard deviation) (s$<=i<=$s$+$h).

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