n <- 5000
A <- rorth(4)
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 <- arima.sim(n, model = list(ar = 0.5)) + rep(c(-0.75, 0.84, -0.45),
c(floor(n/3), floor(n/3), n - 2*floor(n/3)))
z3 <- arima.sim(n, model = list(ma = 0.72))
z4 <- arima.sim(n, model = list(ma = c(0.34)))
Z <- cbind(z1, z2, z3, z4)
X <- tcrossprod(Z, A)
res <- SSAsir(X, K = 6)
res$D # Two non-zero eigenvalues
screeplot(res, type = "lines") # This can also be seen in screeplot
# Plotting the components
plot(res) # The first two are nonstationary in mean
Run the code above in your browser using DataLab