n <- 10000
A <- rorth(6)
z1 <- arima.sim(n, model = list(ar = 0.7)) + rep(c(-1.52, 1.38),
c(floor(n*0.5), n - floor(n*0.5)))
z2 <- rtvAR1(n)
z3 <- rtvvar(n, alpha = 0.2, beta = 0.5)
z4 <- arima.sim(n, model = list(ma = c(0.72, 0.24), ar = c(0.14, 0.45)))
z5 <- arima.sim(n, model = list(ma = c(0.34)))
z6 <- arima.sim(n, model = list(ma = c(0.72, 0.15)))
Z <- cbind(z1, z2, z3, z4, z5, z6)
library(xts)
X <- tcrossprod(Z, A)
X <- xts(X, order.by = as.Date(1:n)) # An xts object
res <- SSAcomb(X, K = 12, tau = 1)
ggscreeplot(res, type = "lines") # Three non-zero eigenvalues
res$DTable # Components have different kind of nonstationarities
# Plotting the components as an xts object
plot(res, multi.panel = TRUE) # The first three are nonstationary
Run the code above in your browser using DataLab