Title: | Stationary Subspace Analysis |
---|---|
Description: | Stationary subspace analysis (SSA) is a blind source separation (BSS) variant where stationary components are separated from non-stationary components. Several SSA methods for multivariate time series are provided here (Flumian et al. (2021); Hara et al. (2010) <doi:10.1007/978-3-642-17537-4_52>) along with functions to simulate time series with time-varying variance and autocovariance (Patilea and Raissi(2014) <doi:10.1080/01621459.2014.884504>). |
Authors: | Markus Matilainen [cre, aut] , Lea Flumian [aut], Klaus Nordhausen [aut] , Sara Taskinen [aut] |
Maintainer: | Markus Matilainen <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2024-12-22 06:46:01 UTC |
Source: | CRAN |
Stationary subspace analysis (SSA) is a blind source separation (BSS) variant where stationary components are separated from non-stationary components. Several SSA methods for multivariate time series are provided here (Flumian et al. (2021); Hara et al. (2010) <doi:10.1007/978-3-642-17537-4_52>) along with functions to simulate time series with time-varying variance and autocovariance (Patilea and Raïssi(2014) <doi:10.1080/01621459.2014.884504>).
Package: | ssaBSS |
Type: | Package |
Version: | 0.1.1 |
Date: | 2022-12-01 |
License: | GPL (>= 2) |
This package contains functions for identifying different types of nonstationarity
SSAsir
– SIR type function for mean non-stationarity identification
SSAsave
– SAVE type function for variance non-stationarity identification
SSAcor
– Function for identifying changes in autocorrelation
ASSA
– ASSA: Analytic SSA for identification of nonstationarity in mean and variance.
SSAcomb
– Combination of SSAsir
, SSAsave
, and SSAcor
using joint diagonalization
The package also contains function rtvvar
to simulate a time series with time-varying variance (TV-VAR), and function rtvAR1
to simulate a time series with time-varying autocovariance (TV-AR1).
Markus Matilainen, Léa Flumian, Klaus Nordhausen, Sara Taskinen
Maintainer: Markus Matilainen <[email protected]>
Flumian L., Matilainen M., Nordhausen K. and Taskinen S. (2021) Stationary subspace analysis based on second-order statistics. Submitted. Available on arXiv: https://arxiv.org/abs/2103.06148
Hara S., Kawahara Y., Washio T. and von Bünau P. (2010). Stationary Subspace Analysis as a Generalized Eigenvalue Problem, Neural Information Processing. Theory and Algorithms, Part I, pp. 422-429.
Patilea V. and Raïssi H. (2014) Testing Second-Order Dynamics for Autoregressive Processes in Presence of Time-Varying Variance, Journal of the American Statistical Association, 109 (507), 1099-1111.
ASSA (Analytic Stationary Subspace Analysis) method for identifying non-stationary components of mean and variance.
ASSA(X, ...) ## Default S3 method: ASSA(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' ASSA(X, ...)
ASSA(X, ...) ## Default S3 method: ASSA(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' ASSA(X, ...)
X |
A numeric matrix or a multivariate time series object of class |
K |
Number of intervals the time series is split into. |
n.cuts |
A K+1 vector of values that correspond to the breaks which are used for splitting the data. Default is intervals of equal length. |
... |
Further arguments to be passed to or from methods. |
Assume that a -variate
with
observations is whitened, i.e.
, for
where
is the sample covariance matrix of
.
The values of are then split into
disjoint intervals
. Algorithm first calculates matrix
where ,
is the number of breakpoints,
is an identity matrix, and
is the average of values of
and
is the sample variance of values of
which belong to a disjoint interval
.
The algorithm finds an orthogonal matrix via eigendecomposition
The final unmixing matrix is then . The first
rows of
are the eigenvectors corresponding to the non-zero eigenvalues and the rest correspond to the zero eigenvalues. In the same way, the first
rows of
project the observed time series to the subspace of non-stationary components, and the last
rows to the subspace of stationary components.
A list of class 'ssabss', inheriting from class 'bss', containing the following components:
W |
The estimated unmixing matrix. |
S |
The estimated sources as time series object standardized to have mean 0 and unit variances. |
M |
Used separation matrix. |
K |
Number of intervals the time series is split into. |
D |
Eigenvalues of M. |
MU |
The mean vector of |
n.cut |
Used K+1 vector of values that correspond to the breaks which are used for splitting the data. |
method |
Name of the method ("ASSA"), to be used in e.g. screeplot. |
Markus Matilainen, Klaus Nordhausen
Hara S., Kawahara Y., Washio T. and von Bünau P. (2010). Stationary Subspace Analysis as a Generalized Eigenvalue Problem, Neural Information Processing. Theory and Algorithms, Part I, pp. 422-429.
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 <- rtvvar(n, alpha = 0.1, beta = 1) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) X <- as.ts(tcrossprod(Z, A)) # An mts object res <- ASSA(X, K = 6) screeplot(res, type = "lines") # Two non-zero eigenvalues # Plotting the components as an mts object plot(res) # The first two are nonstationary
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 <- rtvvar(n, alpha = 0.1, beta = 1) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) X <- as.ts(tcrossprod(Z, A)) # An mts object res <- ASSA(X, K = 6) screeplot(res, type = "lines") # Two non-zero eigenvalues # Plotting the components as an mts object plot(res) # The first two are nonstationary
Simulating time-varying variance based on TV-AR1 model
rtvAR1(n, sigma = 0.93)
rtvAR1(n, sigma = 0.93)
n |
Length of the time series |
sigma |
Parameter |
Time varying autoregressive processes of order 1 (TV-AR1) is
with ,
is iid
and
.
The simulated series as a ts
object.
Sara Taskinen, Markus Matilainen
Patilea V. and Raïssi H. (2014) Testing Second-Order Dynamics for Autoregressive Processes in Presence of Time-Varying Variance, Journal of the American Statistical Association, 109 (507), 1099-1111.
n <- 5000 X <- rtvAR1(n, sigma = 0.93) plot(X)
n <- 5000 X <- rtvAR1(n, sigma = 0.93) plot(X)
Simulating time-varying variance based on TV-VAR model
rtvvar(n, alpha, beta = 1, simple = FALSE)
rtvvar(n, alpha, beta = 1, simple = FALSE)
n |
Length of the time series |
alpha |
Parameter |
beta |
Parameter |
simple |
A logical vector indicating whether |
Time varying variance (TV-VAR) process with parameters
and
is of the form
where, if simple = FALSE
,
where are iid
,
and
,
and if simple = TRUE
,
The simulated series as a ts
object.
Sara Taskinen, Markus Matilainen
Patilea V. and Raïssi H. (2014) Testing Second-Order Dynamics for Autoregressive Processes in Presence of Time-Varying Variance, Journal of the American Statistical Association, 109 (507), 1099-1111.
n <- 5000 X <- rtvvar(n, alpha = 0.2, beta = 0.5, simple = FALSE) plot(X)
n <- 5000 X <- rtvvar(n, alpha = 0.2, beta = 0.5, simple = FALSE) plot(X)
Class 'ssabss' (blind source separation in stationary subspace analysis) with methods plot, screeplot (prints a screeplot of an object of class 'ssabss') and ggscreeplot (prints a screeplot of an object of class 'ssabss' using package ggplot2
).
The class 'ssabss' also inherits methods from the class 'bss' in package JADE
: for extracting the components (bss.components
), for plotting the components (plot.bss
), for printing (print.bss
), and for extracting the coefficients (coef.bss
).
## S3 method for class 'ssabss' plot(x, ...) ## S3 method for class 'ssabss' screeplot(x, type = c("lines", "barplot"), xlab = "Number of components", ylab = NULL, main = paste("Screeplot for", x$method), pointsize = 4, breaks = 1:length(x$D), color = "red", ...) ## S3 method for class 'ssabss' ggscreeplot(x, type = c("lines", "barplot"), xlab = "Number of components", ylab = NULL, main = paste("Screeplot for", x$method), pointsize = 4, breaks = 1:length(x$D), color = "red", ...)
## S3 method for class 'ssabss' plot(x, ...) ## S3 method for class 'ssabss' screeplot(x, type = c("lines", "barplot"), xlab = "Number of components", ylab = NULL, main = paste("Screeplot for", x$method), pointsize = 4, breaks = 1:length(x$D), color = "red", ...) ## S3 method for class 'ssabss' ggscreeplot(x, type = c("lines", "barplot"), xlab = "Number of components", ylab = NULL, main = paste("Screeplot for", x$method), pointsize = 4, breaks = 1:length(x$D), color = "red", ...)
x |
An object of class 'ssabss'. |
type |
Type of screeplot. Choices are "lines" (default) and "barplot". |
xlab |
Label for x-axis. Default is "Number of components". |
ylab |
Label for y-axis. Default is "Sum of pseudo eigenvalues" if method is |
main |
Title of the plot. Default is "Screeplot for ...", where ... denotes for the name of the method used. |
pointsize |
Size of the points in the plot (for |
breaks |
Breaks and labels for the x-axis. Default is from 1 to the number of series by 1. |
color |
Color of the line (if |
... |
Further arguments to be passed to or from methods. |
A screeplot can be used to determine the number of interesting components. For SSAcomb
it plots the sum of pseudo eigenvalues and for other methods it plots the eigenvalues.
Markus Matilainen
ASSA
, SSAsir
, SSAsave
, SSAcor
, SSAcomb
, JADE
, ggplot2
SSAcomb method for identification for non-stationarity in mean, variance and covariance structure.
SSAcomb(X, ...) ## Default S3 method: SSAcomb(X, K, n.cuts = NULL, tau = 1, eps = 1e-6, maxiter = 2000, ...) ## S3 method for class 'ts' SSAcomb(X, ...)
SSAcomb(X, ...) ## Default S3 method: SSAcomb(X, K, n.cuts = NULL, tau = 1, eps = 1e-6, maxiter = 2000, ...) ## S3 method for class 'ts' SSAcomb(X, ...)
X |
A numeric matrix or a multivariate time series object of class |
K |
Number of intervals the time series is split into. |
n.cuts |
A K+1 vector of values that correspond to the breaks which are used for splitting the data. Default is intervals of equal length. |
tau |
The lag as a scalar or a vector. Default is 1. |
eps |
Convergence tolerance. |
maxiter |
The maximum number of iterations. |
... |
Further arguments to be passed to or from methods. |
Assume that a -variate
with
observations is whitened, i.e.
, for
where
is the sample covariance matrix of
.
The values of are then split into
disjoint intervals
. For all lags
, algorithm first calculates the
matrices from SSAsir (matrix
), SSAsave (matrix
) and SSAcor (matrices
).
The algorithm finds an orthogonal matrix by maximizing
where . The final unmixing matrix is then
.
Then the pseudo eigenvalues are obtained and the value of
tells if the
th component is nonstationary with respect to
.
A list of class 'ssabss', inheriting from class 'bss', containing the following components:
W |
The estimated unmixing matrix. |
S |
The estimated sources as time series object standardized to have mean 0 and unit variances. |
R |
Used M-matrices as an array. |
K |
Number of intervals the time series is split into. |
D |
The sums of pseudo eigenvalues. |
DTable |
The peudo eigenvalues of size ntau + 2 to see which type of nonstationarity there exists in each component. |
MU |
The mean vector of |
n.cut |
Used K+1 vector of values that correspond to the breaks which are used for splitting the data. |
k |
The used lag. |
method |
Name of the method ("SSAcomb"), to be used in e.g. screeplot. |
Markus Matilainen, Klaus Nordhausen
Flumian L., Matilainen M., Nordhausen K. and Taskinen S. (2021) Stationary subspace analysis based on second-order statistics. Submitted. Available on arXiv: https://arxiv.org/abs/2103.06148
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
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
SSAcor method for identifying non-stationarity in the covariance structure.
SSAcor(X, ...) ## Default S3 method: SSAcor(X, K, n.cuts = NULL, tau = 1, eps = 1e-6, maxiter = 2000, ...) ## S3 method for class 'ts' SSAcor(X, ...)
SSAcor(X, ...) ## Default S3 method: SSAcor(X, K, n.cuts = NULL, tau = 1, eps = 1e-6, maxiter = 2000, ...) ## S3 method for class 'ts' SSAcor(X, ...)
X |
A numeric matrix or a multivariate time series object of class |
K |
Number of intervals the time series is split into. |
n.cuts |
A K+1 vector of values that correspond to the breaks which are used for splitting the data. Default is intervals of equal length. |
tau |
The lag as a scalar or a vector. Default is 1. |
eps |
Convergence tolerance. |
maxiter |
The maximum number of iterations. |
... |
Further arguments to be passed to or from methods. |
Assume that a -variate
with
observations is whitened, i.e.
, for
where
is the sample covariance matrix of
.
The values of are then split into
disjoint intervals
. For all lags
, algorithm first calculates matrices
where ,
is the number of breakpoints,
is the global sample covariance for lag
, and
is the sample covariance of values of
which belong to a disjoint interval
.
The algorithm finds an orthogonal matrix by maximizing
where .
The final unmixing matrix is then .
Then the pseudo eigenvalues
are obtained and the value of
tells if the
th component is nonstationary with respect to
. The first
rows of
project the observed time series to the subspace of components with non-stationary covariance, and the last
rows to the subspace of components with stationary covariance.
A list of class 'ssabss', inheriting from class 'bss', containing the following components:
W |
The estimated unmixing matrix. |
S |
The estimated sources as time series object standardized to have mean 0 and unit variances. |
M |
Used separation matrix. |
K |
Number of intervals the time series is split into. |
D |
The sums of pseudo eigenvalues. |
DTable |
The peudo eigenvalues of size ntau*p to see which type of nonstationarity there exists in each component. |
MU |
The mean vector of |
n.cut |
Used K+1 vector of values that correspond to the breaks which are used for splitting the data. |
k |
The used lag. |
method |
Name of the method ("SSAcor"), to be used in e.g. screeplot. |
Markus Matilainen, Klaus Nordhausen
Flumian L., Matilainen M., Nordhausen K. and Taskinen S. (2021) Stationary subspace analysis based on second-order statistics. Submitted. Available on arXiv: https://arxiv.org/abs/2103.06148
n <- 5000 A <- rorth(4) z1 <- rtvAR1(n) z2a <- arima.sim(floor(n/3), model = list(ar = c(0.5), innov = c(rnorm(floor(n/3), 0, 1)))) z2b <- arima.sim(floor(n/3), model = list(ar = c(0.2), innov = c(rnorm(floor(n/3), 0, 1.28)))) z2c <- arima.sim(n - 2*floor(n/3), model = list(ar = c(0.8), innov = c(rnorm(n - 2*floor(n/3), 0, 0.48)))) z2 <- c(z2a, z2b, z2c) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24), ar = c(0.14, 0.45))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) library(zoo) X <- as.zoo(tcrossprod(Z, A)) # A zoo object res <- SSAcor(X, K = 6, tau = 1) ggscreeplot(res, type = "barplot", color = "gray") # Two non-zero eigenvalues # Plotting the components as a zoo object plot(res) # The first two are nonstationary in autocovariance
n <- 5000 A <- rorth(4) z1 <- rtvAR1(n) z2a <- arima.sim(floor(n/3), model = list(ar = c(0.5), innov = c(rnorm(floor(n/3), 0, 1)))) z2b <- arima.sim(floor(n/3), model = list(ar = c(0.2), innov = c(rnorm(floor(n/3), 0, 1.28)))) z2c <- arima.sim(n - 2*floor(n/3), model = list(ar = c(0.8), innov = c(rnorm(n - 2*floor(n/3), 0, 0.48)))) z2 <- c(z2a, z2b, z2c) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24), ar = c(0.14, 0.45))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) library(zoo) X <- as.zoo(tcrossprod(Z, A)) # A zoo object res <- SSAcor(X, K = 6, tau = 1) ggscreeplot(res, type = "barplot", color = "gray") # Two non-zero eigenvalues # Plotting the components as a zoo object plot(res) # The first two are nonstationary in autocovariance
SSAsave method for identifying non-stationarity in variance
SSAsave(X, ...) ## Default S3 method: SSAsave(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' SSAsave(X, ...)
SSAsave(X, ...) ## Default S3 method: SSAsave(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' SSAsave(X, ...)
X |
A numeric matrix or a multivariate time series object of class |
K |
Number of intervals the time series is split into. |
n.cuts |
A K+1 vector of values that correspond to the breaks which are used for splitting the data. Default is intervals of equal length. |
... |
Further arguments to be passed to or from methods. |
Assume that a -variate
with
observations is whitened, i.e.
, for
where
is the sample covariance matrix of
.
The values of are then split into
disjoint intervals
. Algorithm first calculates matrix
where ,
is the number of breakpoints,
is an identity matrix, and
is the sample variance of values of
which belong to a disjoint interval
.
The algorithm finds an orthogonal matrix via eigendecomposition
The final unmixing matrix is then . The first
rows of
are the eigenvectors corresponding to the non-zero eigenvalues and the rest correspond to the zero eigenvalues. In the same way, the first
rows of
project the observed time series to the subspace of components with non-stationary variance, and the last
rows to the subspace of components with stationary variance.
A list of class 'ssabss', inheriting from class 'bss', containing the following components:
W |
The estimated unmixing matrix. |
S |
The estimated sources as time series object standardized to have mean 0 and unit variances. |
M |
Used separation matrix. |
K |
Number of intervals the time series is split into. |
D |
Eigenvalues of M. |
MU |
The mean vector of |
n.cut |
Used K+1 vector of values that correspond to the breaks which are used for splitting the data. |
method |
Name of the method ("SSAsave"), to be used in e.g. screeplot. |
Markus Matilainen, Klaus Nordhausen
Flumian L., Matilainen M., Nordhausen K. and Taskinen S. (2021) Stationary subspace analysis based on second-order statistics. Submitted. Available on arXiv: https://arxiv.org/abs/2103.06148
n <- 5000 A <- rorth(4) z1 <- rtvvar(n, alpha = 0.2, beta = 0.5) z2 <- rtvvar(n, alpha = 0.1, beta = 1) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) X <- as.ts(tcrossprod(Z, A)) # An mts object res <- SSAsave(X, K = 6) res$D # Two non-zero eigenvalues screeplot(res, type = "lines") # This can also be seen in screeplot ggscreeplot(res, type = "lines") # ggplot version of screeplot # Plotting the components as an mts object plot(res) # The first two are nonstationary in variance
n <- 5000 A <- rorth(4) z1 <- rtvvar(n, alpha = 0.2, beta = 0.5) z2 <- rtvvar(n, alpha = 0.1, beta = 1) z3 <- arima.sim(n, model = list(ma = c(0.72, 0.24))) z4 <- arima.sim(n, model = list(ar = c(0.34, 0.27, 0.18))) Z <- cbind(z1, z2, z3, z4) X <- as.ts(tcrossprod(Z, A)) # An mts object res <- SSAsave(X, K = 6) res$D # Two non-zero eigenvalues screeplot(res, type = "lines") # This can also be seen in screeplot ggscreeplot(res, type = "lines") # ggplot version of screeplot # Plotting the components as an mts object plot(res) # The first two are nonstationary in variance
SSAsir method for identifying non-stationarity in mean.
SSAsir(X, ...) ## Default S3 method: SSAsir(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' SSAsir(X, ...)
SSAsir(X, ...) ## Default S3 method: SSAsir(X, K, n.cuts = NULL, ...) ## S3 method for class 'ts' SSAsir(X, ...)
X |
A numeric matrix or a multivariate time series object of class |
K |
Number of intervals the time series is split into. |
n.cuts |
A K+1 vector of values that correspond to the breaks which are used for splitting the data. Default is intervals of equal length. |
... |
Further arguments to be passed to or from methods. |
Assume that a -variate
with
observations is whitened, i.e.
, for
where
is the sample covariance matrix of
.
The values of are then split into
disjoint intervals
. Algorithm first calculates matrix
where ,
is the number of breakpoints, and
is the average of values of
which belong to a disjoint interval
.
The algorithm finds an orthogonal matrix via eigendecomposition
The final unmixing matrix is then . The first
rows of
are the eigenvectors corresponding to the non-zero eigenvalues and the rest correspond to the zero eigenvalues. In the same way, the first
rows of
project the observed time series to the subspace of components with non-stationary mean, and the last
rows to the subspace of components with stationary mean.
A list of class 'ssabss', inheriting from class 'bss', containing the following components:
W |
The estimated unmixing matrix. |
S |
The estimated sources as time series object standardized to have mean 0 and unit variances. |
M |
Used separation matrix. |
K |
Number of intervals the time series is split into. |
D |
Eigenvalues of M. |
MU |
The mean vector of |
n.cut |
Used K+1 vector of values that correspond to the breaks which are used for splitting the data. |
method |
Name of the method ("SSAsir"), to be used in e.g. screeplot. |
Markus Matilainen, Klaus Nordhausen
Flumian L., Matilainen M., Nordhausen K. and Taskinen S. (2021) Stationary subspace analysis based on second-order statistics. Submitted. Available on arXiv: https://arxiv.org/abs/2103.06148
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
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