Description Usage Arguments Details Value Warning Author(s) References See Also Examples
Performs the two stages of Singular System Analysis (SSA). Decomposition and reconstruction.
1 2 |
x |
A vector representing the time series. |
L |
Embedding dimension also referred to as window length. |
toeplitz |
Whether to use the Toeplitz modification of SSA for stationary time series or not. |
getFreq |
Whether dominat frequencies of the eigenvectors shall be determined. |
dSSA |
Output of decompSSA. |
groups |
A list of vectors. Each vector is representing a selection of eigenvalues and eigenvectors which shall be used to compute reconstructed components. |
decompSSA
performs the SSA decomposition whereas reconSSA
performs SSA reconstruction.
Singular Spectrum Analysis (SSA) embeds
lagged copies of a time series x into a augmented (trajectory)
matrix X. The orthonormal basis of X is via singular
value decomposition (SVD). Having obtained this decomposition, a
selection of eigenvectors (or left singular vectors) can be used to
filter the time series. SSA has one free parameter, the window length
L
which determines how the time series is embedded. A general
advice is to choose L
close to half of the series length.
SVD of an matrix X can be split up into several steps. One of them beeing the eigenvalue decomposition of XX^T. The product XX^T has simmilarities whith the covariance matrix of X. Moreover if X is set to have zero mean and XX^T is normalised, it is in fact a covariance matrix. In case of SSA XX^T containes the inner product of time lagged copies of the time series. The Toeplitz modification of SSA puts stationarity assumptions into the computation of XX^T. In such a case the secondary diagonals of XX^T only depend on the time lag. This can be enforced by giving these entries the values of the autocorrelation function at the corresponding lag.
It is possible to assign each eigenvector a dominat frequency. This
is found by applying fft
taking the frequency of the largest
Fourier component.
Beside the results of the output of decompSSA
and the original
time series x
, reconSSA
has a third input called
groups. This is implemented a list of vectors where each vector should
contain integers representing the index of the eigenvectors to be
used for reconstruction of a sub signal of the initial time
series. The index corresponds to the index of the decreasing ordered
eigenvalues (rank
).
For reasons computational efficiency the sum of several components (represented by the single list entries) can be obtained in one step. This procedure is recommended if the interest lies on the shape of the entire reconstructed signal. However, if the focus of the analysis is to examine the shape of single reconstructed components one has to obtain each each reconstructed compontent seperately.
The output of decompSSA
is an object of class decompSSA
with following items:
lambda |
The eigenvalues, ordered by decreasing value. |
U |
The eigenvectors (columns), ordered by decreasing eigenvalues. |
freq |
Dominant frequency of the eigenvectors, ordered by decreasing eigenvalues. |
rank |
Rank of the eigenvalues, ordered by decreasing eigenvalues. |
N |
Length of the input series |
L |
The embedding dimension |
toeplitz |
Logical, indicates if Toeplitz modification has been used. |
seriesName |
Name of input series. |
call |
Call of the generating function. |
The output of reconSSA
is a matrix with length(groups)
columns
and length(x)
rows. Each column represents the sum of
the reconstructed components defined by the list entries of groups
.
May cause extreme memory demands. reconSSA
is computational expensive.
Lukas Gudmundsson
Elsner, J. B. & Tsonis, A. A. Singular Spectrum Analysis: A New Tool in Time Series Analysis Springer, 1996
Ghil, M.; Allen, M.; Dettinger, M.; Ide, K.; Kondrashov, D.; Mann, M.; Robertson, A.; Saunders, A.; Tian, Y.; Varadi, F. & others Advanced spectral methods for climatic time series. Rev. Geophys, 2002, 40, 1003
Golyandina, N.; Nekrutkin, V. & Zhiglkilavskifi, A. Analysis of Time Series Structure: SSA and Related Techniques. CRC Press, 2001
plot.decompSSA
, decompSSAM
,
kgSSAM
, sdTest
, MCSSA
,
svd
, eigen
, toeplitz
,
fft
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | x <- sin(seq(0,10*pi,len=200))
x <- x + rnorm(x)/2
x.dc <- decompSSA(x,L=40)
plot(x.dc,by="rank",log="") # the first two elements contain the signal
pairs(x.dc$U[,1:4]) # the first two elements contain the signal
# Obtaining reconstructed components(RC)
x.rc1 <- reconSSA(x.dc,x,list(1:2)) # the signal
x.rc2 <- reconSSA(x.dc,x,list(1:40)) # full reconstruction of the series
plot(x,type="l")
lines(x.rc1,col="red",lwd=2)
points(x.rc2,col="blue")
# Obtaining several RC at once
# first colum: signal
# second column: noise
x.rc3 <- reconSSA(x.dc,x,list(c(1,2),3:40))
dim(x.rc3)
matplot(x.rc3,type="l")
# The sum of RC can be obtained in one step.
# This avoids costly computations that would occure if all
# RC would be obtained seperately.
x.rc4 <- reconSSA(x.dc,x,as.list(1:40)) # separate RCs for all eigenvectors
sum(rowSums(x.rc4)-x.rc2) # identical up to numerical accuracy
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.