Learn R Programming

forecastSNSTS (version 1.3-0)

f: Compute \(f(\delta)\) for a tvAR(p) process

Description

This functions computes the quantity \(f(\delta)\) defined in (24) of Kley et al. (2019) when the underlying process follows an tvAR(p) process. Recall that, to apply Theorem 3.1 in Kley et al. (2019), the function \(f(\delta)\) is required to be positive, which can be verified with the numbers returned from this function. The function returns a vector with elements \(f(\delta)\) for each \(\delta\) in which.deltas, with \(f(\delta)\) defined as $$f(\delta) := \min_{p_1,p_2 = 0, \ldots, p_{\max}} \min_{N \in \mathcal{N}} \Big| {\rm MSPE}_{s_1/T,m/T}^{(p_1,h)}(\frac{s_1}{T}) - (1+\delta) \cdot {\rm MSPE}_{N/T,m/T}^{(p_2,h)}(\frac{s_1}{T}) \Big|, \quad \delta \geq 0$$ where \(T, m, p_{\max}, h\) are positive integers, \(\mathcal{N} \subset \{p_{\max}+1, \ldots, T-m-h\}\), and \(s_1 := T-m-h+1\).

Usage

f(which.deltas, p_max, h, T, Ns, m, a, sigma)

Arguments

which.deltas

vector containing the \(\delta\)'s for which to to compute \(f(\delta)\),

p_max

parameter \(p_{\max}\),

h

parameter \(h\),

T

parameter \(T\),

Ns

a vector containing the elements of the set \(\mathcal{N}\),

m

parameter \(m\),

a

a list of real-valued functions, specifying the coefficients of the tvAR(p) process,

sigma

a positive-valued function, specifying the variance of the innovations of the tvAR(p) process,

Value

Returns a vector with the values \(f(\delta)\), as defined in (24) of Kley et al. (2019), where it is now denoted by \(q(\delta)\), for each \(\delta\) in which.delta.

Details

The function \({\rm MSPE}_{\Delta_1, \Delta_2}^{(p,h)}(u)\) is defined, for real-valued \(u\) and \(\Delta_1, \Delta_2 \geq 0\), in terms of the second order properties of the process: $${\rm MSPE}_{\Delta_1, \Delta_2}^{(p,h)}(u) := \int_0^1 g^{(p,h)}_{\Delta_1}\Big( u + \Delta_2 (1-x) \Big) {\rm d}x,$$ with \(g^{(0,h)}_{\Delta}(u) := \gamma_0(u)\) and, for \(p = 1, 2, \ldots\), $$g^{(p,h)}_{\Delta}(u) := \gamma_0(u) - 2 \big( v_{\Delta}^{(p,h)}(u) \big)' \gamma_0^{(p,h)}(u) + \big( v_{\Delta}^{(p,h)}(u) \big)' \Gamma_0^{(p)}(u) v_{\Delta}^{(p,h)}(u)$$ $$\gamma_0^{(p,h)}(u) := \big( \gamma_h(u), \ldots, \gamma_{h+p-1}(u) \big)',$$ where $$v^{(p,h)}_{\Delta}(u) := e'_1 \big( e_1 \big( a_{\Delta}^{(p)}(t) \big)' + H \big)^h,$$ with \(e_1\) and \(H\) defined in the documentation of predCoef and, for every real-valued \(u\) and \(\Delta \geq 0\), $$a^{(p)}_{\Delta}(u) := \Gamma^{(p)}_{\Delta}(u)^{-1} \gamma^{(p)}_{\Delta}(u),$$ where $$\gamma^{(p)}_{\Delta}(u) := \int_0^1 \gamma^{(p)}(u+\Delta (x-1)) {\rm d}x, \quad \gamma^{(p)}(u) := [\gamma_1(u)\;\ldots\;\gamma_p(u)]',$$ $$\Gamma^{(p)}_{\Delta}(u) := \int_0^1 \Gamma^{(p)}(u+\Delta (x-1)) {\rm d}x, \quad \Gamma^{(p)}(u) := (\gamma_{i-j}(u);\,i,j=1,\ldots,p).$$

The local autocovariances \(\gamma_k(u)\) are defined as the lag-\(k\) autocovariances of an AR(p) process which has coefficients \(a_1(u), \ldots, a_p(u)\) and innovations with variance \(\sigma(u)^2\), because the underlying model is assumed to be tvAR(p) $$Y_{t,T} = \sum_{j=1}^p a_j(t/T) Y_{t-j,T} + \sigma(t/T) \varepsilon_{t},$$ where \(a_1, \ldots, a_p\) are real valued functions (defined on \([0,1]\)) and \(\sigma\) is a positive function (defined on \([0,1]\)).

Examples

Run this code
# NOT RUN {
## because computation is quite time-consuming.
n <- 100
a <- list( function(u) {return(0.8+0.19*sin(4*pi*u))} )
sigma <- function (u) {return(1)}

Ns <- seq( floor((n/2)^(4/5)), floor(n^(4/5)),
           ceiling((floor(n^(4/5)) - floor((n/2)^(4/5)))/25) )
which.deltas <- c(0, 0.01, 0.05, 0.1, 0.15, 0.2, 0.4, 0.6)
P_max <- 7
H <- 1
m <- floor(n^(.85)/4)

# now replicate some results from Table 4 in Kley et al. (2019)
f( which.deltas, P_max, h = 1, n - m, Ns, m, a, sigma )
f( which.deltas, P_max, h = 5, n - m, Ns, m, a, sigma )
# }

Run the code above in your browser using DataLab