gdpc {gdpc} | R Documentation |
Generalized Dynamic Principal Components
Description
Computes a single Generalized Dynamic Principal Component with a given number of lags.
Usage
gdpc(Z, k, f_ini = NULL, tol = 1e-4, niter_max = 500, crit = 'LOO')
Arguments
Z |
Data matrix. Each column is a different time series. |
k |
Integer. Number of lags to use. |
f_ini |
(Optional). Numeric vector. Starting point for the iterations. If no argument is passed the ordinary (non-dynamic) first principal component completed with k lags is used. |
tol |
Relative precision. Default is 1e-4. |
niter_max |
Integer. Maximum number of iterations. Default is 500. |
crit |
A string specifying the criterion to be used to evaluate the fitted model. Options are 'LOO', 'AIC', 'BIC' and 'BNG'. Default is 'LOO'. |
Details
See auto.gdpc
for the definition of criterion that is part of the output of this function.
Value
An object of class gdpc
, that is, a list with entries:
expart |
Proportion of the variance explained. |
mse |
Mean squared error. |
crit |
The value of the criterion of the reconstruction, according to what the user specified. |
k |
Number of lags used. |
alpha |
Vector of intercepts corresponding to f. |
beta |
Matrix of loadings corresponding to f. Column number |
f |
Coordinates of the first dynamic principal component corresponding to the periods |
initial_f |
Coordinates of the first dynamic principal component corresponding to the periods |
call |
The matched call. |
conv |
Logical. Did the iterations converge? |
niter |
Integer. Number of iterations. |
fitted
, plot
and print
methods are available for this class.
Author(s)
Daniel Peña, Ezequiel Smucler, Victor Yohai
See Also
Examples
T <- 200 #length of series
m <- 500 #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]
}
fit <- gdpc(x, k = 1) #find first DPC with one lag
fit
par(mfrow = c(1, 2)) #plot loadings
plot(fit, which = 'Loadings', which_load = 0, xlab = '', ylab = '')
plot(fit, which = 'Loadings', which_load = 1, xlab = '', ylab = '')