Computes One-Sided Dynamic Principal Components, choosing the number of components and lags automatically, to minimize an information criterion.
crit.odpc(
Z,
k_list = 1:5,
max_num_comp = 5,
ncores = 1,
method,
tol = 1e-04,
niter_max = 500
)
Data matrix. Each column is a different time series.
List of values of k to choose from.
Maximum possible number of components to compute.
Number of cores to use in parallel computations.
A string specifying the algorithm used. Options are 'ALS', 'mix' or 'gradient'. See details in odpc
.
Relative precision. Default is 1e-4.
Integer. Maximum number of iterations. Default is 500.
An object of class odpcs, that is, a list of length equal to the number of computed components, each computed using the optimal value of k.
The i-th entry of this list is an object of class odpc
, that is, a list with entries
Coordinates of the i-th dynamic principal component corresponding to the periods \(k_1 + 1,\dots,T\).
Mean squared error of the reconstruction using the first i components.
Number of lags used to define the i-th dynamic principal component f.
Number of lags of f used to reconstruct.
Vector of intercepts corresponding to f.
Vector that defines the i-th dynamic principal component
Matrix of loadings corresponding to f. Row number \(k\) is the vector of \(k-1\) lag loadings.
The matched call.
Logical. Did the iterations converge?
We apply the same stepwise approach taken in cv.odpc
, but now to minimize an
information criterion instead of the cross-validated forecasting error. The criterion is
inspired by the \(IC_{p3}\) criterion proposed in Bai and Ng (2002).
Let \(\widehat{\sigma}^{2}_{1,k}\) be the reconstruction mean squared error for
the first ODPC defined using \(k\) lags. Let \(T^{\ast,1,k}=T-2k\).
Then we choose the
value \(k^{\ast,1}\) in k_list
that minimizes
$$
{BNG}_{1,k}=\log\left( \widehat{\sigma}^{2}_{1,k} \right)
+ ( k+1 ) \frac{\log\left(\min(T^{\ast,1,k},m)\right)}{\min(T^{\ast,1,k},m)}.
$$
Suppose now that max_num_comp
\(\geq 2\) and we
have computed \(q-1\) dynamic principal components, \(q-1 <\) max_num_comp
, each with \(k_{1}^{i}=k_{2}^{i}=k^{\ast, i}\) lags, \(i=1,\dots,q-1\).
Let \(\widehat{\sigma}^{2}_{q,k}\) be the reconstruction mean squared error for
the fit obtained using \(q\) components, where the first \(q-1\) components are defined using
\(k^{\ast, i}\), \(i=1,\dots,q-1\) and the last component is defined using \(k\) lags.
Let \(T^{\ast,q,k}=T-\max\lbrace 2k^{\ast,1},\dots,2k^{\ast,q-1},2k \rbrace\).
Let \(k^{\ast,q}\) be the value in k_list
that minimizes
$$
{BNG}_{q,k}=\log\left( \widehat{\sigma}^{2}_{q,k} \right)
+ \left(\sum_{i=1}^{q-1}(k^{\ast,i}+1) + k+1 \right) \frac{\log\left(\min(T^{\ast,q,k},m)\right)}{\min(T^{\ast,q,k},m)} .
$$
If \({BNG}_{q,k^{\ast,q}}\) is larger than \({BNG}_{q-1,k^{\ast,q-1}}\)
we stop and the final model is the ODPC with \(q-1\) components. Else we add the \(q\)-th component defined using \(k^{\ast,q}\)
and continue as before.
Pe<U+00F1>a D., Smucler E. and Yohai V.J. (2017). <U+201C>Forecasting Multiple Time Series with One-Sided Dynamic Principal Components.<U+201D> Available at https://arxiv.org/abs/1708.04705.
Bai J. and Ng S. (2002). <U+201C>Determining the Number of Factors in Approximate Factor Models.<U+201D> Econometrica, 70(1), 191<U+2013>221.
# NOT RUN {
T <- 50 #length of series
m <- 10 #number of series
set.seed(1234)
f <- rnorm(T + 1)
x <- matrix(0, T, m)
u <- matrix(rnorm(T * m), T, m)
for (i in 1:m) {
x[, i] <- 10 * sin(2 * pi * (i/m)) * f[1:T] + 10 * cos(2 * pi * (i/m)) * f[2:(T + 1)] + u[, i]
}
# Choose parameters to perform a one step ahead forecast. Use 1 or 2 lags, only one component
fit <- crit.odpc(x, k_list = 1:2, max_num_comp = 1)
# }
Run the code above in your browser using DataLab