Learn R Programming

forecastSNSTS (version 1.3-0)

predCoef: \(h\)-step Prediction coefficients

Description

This function computes the localised and iterated Yule-Walker coefficients for h-step ahead forecasting of \(X_{t+h}\) from \(X_{t}, ..., X_{t-p+1}\), where \(h = 1, \ldots,\) H and \(p = 1, \ldots,\) P.

Arguments

X

the data \(X_1, \ldots, X_T\)

P

the maximum order of coefficients to be computed; has to be a positive integer

H

the maximum lead time; has to be a positive integer

t

a vector of values \(t\); the elements have to satisfy max(t) <= length(X) and min(t) >= min(max(N[N != 0]),p).

N

a vector of values \(N\); the elements have to satisfy max(N[N != 0]) <= min(t) and min(N[N != 0]) >= 1 + P. \(N = 0\) corresponds to the case where all data is taken into account.

Value

Returns a named list with elements coef, t, and N, where coef is an array of dimension P \(\times\) P \(\times\) H \(\times\) length(t) \(\times\) length(N), and t, and N are the parameters provided on the call of the function. See the example on how to access the vector \(\hat v_{N,T}^{(p,h)}(t)\).

Details

For every \(t \in\) t and every \(N \in\) N the (iterated) Yule-Walker estimates \(\hat v_{N,T}^{(p,h)}(t)\) are computed. They are defined as $$\hat v_{N,T}^{(p,h)}(t) := e'_1 \big( e_1 \big( \hat a_{N,T}^{(p)}(t) \big)' + H \big)^h, \quad N \geq 1,$$ and $$\hat v_{0,T}^{(p,h)}(t) := \hat v_{t,T}^{(p,h)}(t),$$ with $$ e_1 := \left(\begin{array}{c} 1 \\ 0 \\ \vdots \\ 0 \end{array} \right), \quad H := \left( \begin{array}{ccccc} 0 & 0 & \cdots & 0 & 0 \\ 1 & 0 & \cdots & 0 & 0 \\ 0 & 1 & \cdots & 0 & 0 \\ \vdots & \ddots & \cdots & 0 & 0 \\ 0 & 0 & \cdots & 1 & 0 \end{array} \right)$$ and $$ \hat a_{N,T}^{(p)}(t) := \big( \hat\Gamma_{N,T}^{(p)}(t) \big)^{-1} \hat\gamma_{N,T}^{(p)}(t),$$ where $$\hat\Gamma_{N,T}^{(p)}(t) := \big[ \hat \gamma_{i-j;N,T}(t) \big]_{i,j = 1, \ldots, p}, \quad \hat \gamma_{N,T}^{(p)}(t) := \big( \hat \gamma_{1;N,T}(t), \ldots, \hat \gamma_{p;N,T}(t) \big)'$$ and $$\hat \gamma_{k;N,T}(t) := \frac{1}{N} \sum_{\ell=t-N+|k|+1}^{t} X_{\ell-|k|,T} X_{\ell,T}$$ is the usual lag-\(k\) autocovariance estimator (without mean adjustment), computed from the observations \(X_{t-N+1}, \ldots, X_{t}\).

The Durbin-Levinson Algorithm is used to successively compute the solutions to the Yule-Walker equations (cf. Brockwell/Davis (1991), Proposition 5.2.1). To compute the \(h\)-step ahead coefficients we use the recursive relationship $$\hat v_{i,N,T}^{(p)}(t,h) = \hat a_{i,N,T}^{(p)}(t) \hat v_{1,N,T}^{(p,h-1)}(t) + \hat v_{i+1,N,T}^{(p,h-1)}(t) I\{i \leq p-1\},$$ (cf. Section 3.2, Step 3, in Kley et al. (2019)).

References

Brockwell, P. J. & Davis, R. A. (1991). Time Series: Theory and Methods. Springer, New York.

Examples

Run this code
# NOT RUN {
T <- 100
X <- rnorm(T)

P <- 5
H <- 1
m <- 20

Nmin <- 25
pcoef <- predCoef(X, P, H, (T - m - H + 1):T, c(0, seq(Nmin, T - m - H, 1)))

## Access the prediction vector for p = 2, h = 1, t = 95, N = 25
p <- 2
h <- 1
t <- 95
N <- 35
res <- pcoef$coef[p, 1:p, h, pcoef$t == t, pcoef$N == N]
# }

Run the code above in your browser using DataLab