# iossa: Iterative O-SSA nested decomposition In Rssa: A Collection of Methods for Singular Spectrum Analysis

## Description

Perform Iterative O-SSA (IOSSA) algorithm.

## Usage

 ```1 2 3 4 5 6``` ```## S3 method for class 'ssa' iossa(x, nested.groups, ..., tol = 1e-5, kappa = 2, maxiter = 100, norm = function(x) sqrt(mean(x^2)), trace = FALSE, kappa.balance = 0.5) ```

## Arguments

 `x` SSA object holding SSA decomposition `nested.groups` list or named list of numbers of eigentriples from full decomposition, describes initial grouping for IOSSA iterations `tol` tolerance for IOSSA iterations `kappa` ‘kappa’ parameter for sigma-correction (see ‘Details’ and ‘References’) procedure. If 'NULL', sigma-correction will not be performed `maxiter` upper bound for the number of iterations `norm` function, calculates a norm of a vector; this norm is applied to the difference between the reconstructed series at sequential iterations and is used for convergence detection `trace` logical, indicates whether the convergence process should be traced `kappa.balance` sharing proportion of sigma-correction multiplier between column and row inner products `...` additional arguments passed to `decompose` routines

## Details

Iterative Oblique SSA (IOSSA) is an iterative (EM-like) method for improving separability in SSA. In particular, it serves for separation of mixed components, which are not orthogonal, e.g., of sinusoids with close frequencies or for trend separation for short series. IOSSA performs a new decomposition of a part of the ssa-object, which is given by a set of eigentriples. Note that eigentriples that do not belong to the chosen set are not changed.

Oblique SSA can make many series orthogonal by the choice of inner product. Iterative O-SSA find the separating inner products by iterations that are hopefully converges to a stationary point. See References for more details.

Sigma-correction procedure does the renormalization of new inner products. This prevents the mixing of the components during the next iteration. Such approach makes the whole procedure more stable and can solve the problem of lack of strong separability (see References).

## Value

Object of ‘ossa’ class. In addition to usual ‘ssa’ class fields, it also contains the following fields:

iossa.result

object of ‘iossa.result’ class, a list which contains algorithm parameters, condition numbers, separability measures, the number of iterations and convergence status (see `iossa.result`)

iossa.groups

list of groups within the nested decomposition; numbers of components correspond to their numbers in the full decomposition

iossa.groups.all

list, describes cumulative grouping after after sequential Iterative O-SSA decompositions in the case of non-intersecting `nested.groups`. Otherwise, `iossa.groups.all` coincides with `iossa.groups`

ossa.set

vector of the indices of elementary components used in Iterative O-SSA (that is, used in `nested.groups`)

## References

Golyandina N. and Shlemov A. (2015): Variations of Singular Spectrum Analysis for separability improvement: non-orthogonal decompositions of time series, Statistics and Its Interface. Vol.8, No 3, P.277-294. http://arxiv.org/abs/1308.4022

`Rssa` for an overview of the package, as well as, `ssa-object`, `fossa`, `owcor`, `iossa.result`.
 ``` 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136``` ```# Separate three non-separable sine series with different amplitudes N <- 150 L <- 70 omega1 <- 0.05 omega2 <- 0.06 omega3 <- 0.07 F <- 4*sin(2*pi*omega1 * (1:N)) + 2*sin(2*pi*omega2 * (1:N)) + sin(2*pi*omega3 * (1:N)) s <- ssa(F, L) ios <- iossa(s, nested.groups = list(1:2, 3:4, 5:6), kappa = NULL, maxiter = 100, tol = 1e-3) plot(reconstruct(ios, groups = ios\$iossa.groups)) summary(ios) # Separate two non-separable sines with equal amplitudes N <- 200 L <- 100 omega1 <- 0.07 omega2 <- 0.06 F <- sin(2*pi*omega1 * (1:N)) + sin(2*pi*omega2 * (1:N)) s <- ssa(F, L) # Apply FOSSA and then IOSSA fs <- fossa(s, nested.groups = 1:4) ios <- iossa(fs, nested.groups = list(1:2, 3:4), maxiter = 100) summary(ios) opar <- par(mfrow = c(3, 1)) plot(reconstruct(s, groups = list(1:2, 3:4))) plot(reconstruct(fs, groups = list(1:2, 3:4))) plot(reconstruct(ios, groups = ios\$iossa.groups)) par(opar) wo <- plot(wcor(ios, groups = 1:4)) gwo <- plot(owcor(ios, groups = 1:4)) plot(wo, split = c(1, 1, 2, 1), more = TRUE) plot(gwo, split = c(2, 1, 2, 1), more = FALSE) data(USUnemployment) unempl.male <- USUnemployment[, "MALE"] s <- ssa(unempl.male) ios <- iossa(s, nested.groups = list(c(1:4, 7:11), c(5:6, 12:13))) summary(ios) # Comparison of reconstructions rec <- reconstruct(s, groups = list(c(1:4, 7:11), c(5:6, 12:13))) iorec <- reconstruct(ios, groups <- ios\$iossa.groups) # Trends matplot(data.frame(iorec\$F1, rec\$F1, unempl.male), type='l', col=c("red","blue","black"), lty=c(1,1,2)) # Seasonalities matplot(data.frame(iorec\$F2, rec\$F2), type='l', col=c("red","blue"),lty=c(1,1)) # W-cor matrix before IOSSA and w-cor matrix after it ws <- plot(wcor(s, groups = 1:30), grid = 14) wios <- plot(wcor(ios, groups = 1:30), grid = 14) plot(ws, split = c(1, 1, 2, 1), more = TRUE) plot(wios, split = c(2, 1, 2, 1), more = FALSE) # Eigenvectors before and after Iterative O-SSA plot(s, type = "vectors", idx = 1:13) plot(ios, type = "vectors", idx = 1:13) # 2D plots of periodic eigenvectors before and after Iterative O-SSA plot(s, type = "paired", idx = c(5, 12)) plot(ios, type = "paired", idx = c(10, 12), plot.contrib = FALSE) data(AustralianWine) Fortified <- AustralianWine[, "Fortified"] s <- ssa(window(Fortified, start = 1982 + 5/12, end = 1986 + 5/12), L = 18) ios <- iossa(s, nested.groups = list(trend = 1, 2:7), kappa = NULL, maxIter = 1) fs <- fossa(s, nested.groups = 1:7, gamma = 1000) rec.ssa <- reconstruct(s, groups = list(trend = 1, 2:7)) rec.iossa <- reconstruct(ios, groups = ios\$iossa.groups); rec.fossa <- reconstruct(fs, groups = list(trend = 7, 1:6)) Fort <- cbind(`Basic SSA trend` = rec.ssa\$trend, `Iterative O-SSA trend` = rec.iossa\$trend, `DerivSSA trend` = rec.fossa\$trend, `Full series` = Fortified) library(lattice) xyplot(Fort, superpose = TRUE, col = c("red", "blue", "green4", "black")) # Shaped 2D I. O-SSA separates finite rank fields exactly mx1 <- outer(1:50, 1:50, function(i, j) exp(i/25 - j/20)) mx2 <- outer(1:50, 1:50, function(i, j) sin(2*pi * i/17) * cos(2*pi * j/7)) mask <- matrix(TRUE, 50, 50) mask[23:25, 23:27] <- FALSE mask[1:2, 1] <- FALSE mask[50:49, 1] <- FALSE mask[1:2, 50] <- FALSE mx1[!mask] <- mx2[!mask] <- NA s <- ssa(mx1 + mx2, kind = "2d-ssa", L = c(10, 10)) plot(reconstruct(s, groups = list(1, 2:5))) ios <- iossa(s, nested.groups = list(1, 2:5), kappa = NULL) plot(reconstruct(ios, groups = ios\$iossa.groups)) # I. O-SSA for MSSA N.A <- 150 N.B <- 120 L <- 40 omega1 <- 0.05 omega2 <- 0.055 tt.A <- 1:N.A tt.B <- 1:N.B F1 <- list(A = 2 * sin(2*pi * omega1 * tt.A), B = cos(2*pi * omega1 * tt.B)) F2 <- list(A = 1 * sin(2*pi * omega2 * tt.A), B = cos(2*pi * omega2 * tt.B)) F <- list(A = F1\$A + F2\$A, B = F1\$B + F2\$B) s <- ssa(F, kind = "mssa") plot(reconstruct(s, groups = list(1:2, 3:4)), plot.method = "xyplot") ios <- iossa(s, nested.groups = list(1:2, 3:4), kappa = NULL) plot(reconstruct(ios, groups = ios\$iossa.groups), plot.method = "xyplot") ```