ssa (pyleoclim.utils.decompoition.ssa)

pyleoclim.utils.decomposition.ssa(y, M=None, nMC=0, f=0.5, trunc=None, var_thresh=80)[source]

Singular spectrum analysis

Nonparametric eigendecomposition of timeseries into orthogonal oscillations. This implementation uses the method of [1], with applications presented in [2]. Optionally (nMC>0), the significance of eigenvalues is assessed by Monte-Carlo simulations of an AR(1) model fit to X, using [3]. The method expects regular spacing, but is tolerant to missing values, up to a fraction 0<f<1 (see [4]).

Parameters
  • y (array of length N) – time series (evenly-spaced, possibly with up to f*N NaNs)

  • M (int) – window size (default: 10% of N)

  • nMC (int) – Number of iterations in the Monte-Carlo simulation (default nMC=0, bypasses Monte Carlo SSA) Currently only supported for evenly-spaced, gap-free data.

  • f (float) – maximum allowable fraction of missing values. (Default is 0.5)

  • trunc (str) –

    if present, truncates the expansion to a level K < M owing to one of 3 criteria:
    1. ’kaiser’: variant of the Kaiser-Guttman rule, retaining eigenvalues larger than the median

    2. ’mcssa’: Monte-Carlo SSA (use modes above the 95% quantile from an AR(1) process)

    3. ’var’: first K modes that explain at least var_thresh % of the variance.

    Default is None, which bypasses truncation (K = M)

  • var_thresh (float) – variance threshold for reconstruction (only impactful if trunc is set to ‘var’)

Returns

res

  • eigvals : (M, ) array of eigenvalues

  • eigvecs : (M, M) Matrix of temporal eigenvectors (T-EOFs)

  • PC : (N - M + 1, M) array of principal components (T-PCs)

  • RCmat : (N, M) array of reconstructed components

  • RCseries : (N,) reconstructed series, with mean and variance restored

  • pctvar: (M, ) array of the fraction of variance (%) associated with each mode

  • eigvals_q : (M, 2) array contaitning the 5% and 95% quantiles of the Monte-Carlo eigenvalue spectrum [ if nMC >0 ]

Return type

dict containing:

References

[1]_ Vautard, R., and M. Ghil (1989), Singular spectrum analysis in nonlinear dynamics, with applications to paleoclimatic time series, Physica D, 35, 395–424.

[2]_ Ghil, M., R. M. Allen, M. D. Dettinger, K. Ide, D. Kondrashov, M. E. Mann, A. Robertson, A. Saunders, Y. Tian, F. Varadi, and P. Yiou (2002), Advanced spectral methods for climatic time series, Rev. Geophys., 40(1), 1003–1052, doi:10.1029/2000RG000092.

[3]_ Allen, M. R., and L. A. Smith (1996), Monte Carlo SSA: Detecting irregular oscillations in the presence of coloured noise, J. Clim., 9, 3373–3404.

[4]_ Schoellhamer, D. H. (2001), Singular spectrum analysis for time series with missing data, Geophysical Research Letters, 28(16), 3187–3190, doi:10.1029/2000GL012698.

See also

pyleoclim.utils.decomposition.mssa

Multi-channel SSA