predCoef: h-step Prediction coefficients

Description Arguments Details Value References Examples

View source: R/RcppExports.R

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, …, H and p = 1, …, P.

Arguments

X

the data X_1, …, 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.

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 ≥q 1,

and

\hat v_{0,T}^{(p,h)}(t) := \hat v_{t,T}^{(p,h)}(t),

with

e_1 := ≤ft(\begin{array}{c} 1 \\ 0 \\ \vdots \\ 0 \end{array} \right), \quad H := ≤ft( \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Γ_{N,T}^{(p)}(t) \big)^{-1} \hatγ_{N,T}^{(p)}(t),

where

\hatΓ_{N,T}^{(p)}(t) := \big[ \hat γ_{i-j;N,T}(t) \big]_{i,j = 1, …, p}, \quad \hat γ_{N,T}^{(p)}(t) := \big( \hat γ_{1;N,T}(t), …, \hat γ_{p;N,T}(t) \big)'

and

\hat γ_{k;N,T}(t) := \frac{1}{N} ∑_{\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}, …, 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 ≤q p-1\},

(cf. Section 3.2, Step 3, in Kley et al. (2019)).

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).

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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]

Example output



forecastSNSTS documentation built on Sept. 2, 2019, 5:06 p.m.