Learn R Programming

gdpc (version 1.1.4)

plot.gdpcs: Plot Generalized Dynamic Principal Components

Description

Plots a gdpcs object.

Usage

# S3 method for gdpcs
plot(x, which_comp = 1, plot.type = 'multiple', ...)

Arguments

x

An object of class gdpcs, usually the result of auto.gdpc.

which_comp

Numeric vector indicating which components to plot. Default is 1.

plot.type

Argument to be passed to plot.zoo. Used only when the original data set was stored in an object of class zoo. Default is 'multiple'.

...

Additional arguments to be passed to the plotting functions.

Author

Daniel Peña, Ezequiel Smucler, Victor Yohai

See Also

gdpc, auto.gdpc, plot.gdpc

Examples

Run this code
T <- 200 #length of series
m <- 200 #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 number of lags using the LOO criterion.
#k_max=2 to keep computation time low
autofit <- auto.gdpc(x, k_max = 2, auto_comp = FALSE, num_comp = 2) 
autofit
plot(autofit, which_comp = c(1,2), xlab = '', ylab = '')

Run the code above in your browser using DataLab