igapfill: Perform SSA gapfilling via iterative reconstruction

View source: R/igapfill.R

igapfillR Documentation

Perform SSA gapfilling via iterative reconstruction

Description

Perform iterative gapfilling of the series.

Usage

## S3 method for class '1d.ssa'
igapfill(x, groups, fill = NULL, tol = 1e-6, maxiter = 0,
          norm = function(x) sqrt(max(x^2)),
          base = c("original", "reconstructed"), ..., trace = FALSE,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'cssa'
igapfill(x, groups, fill = NULL, tol = 1e-6, maxiter = 0,
          norm = function(x) sqrt(max(x^2)),
          base = c("original", "reconstructed"), ..., trace = FALSE,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'toeplitz.ssa'
igapfill(x, groups, fill = NULL, tol = 1e-6, maxiter = 0,
          norm = function(x) sqrt(max(x^2)),
          base = c("original", "reconstructed"), ..., trace = FALSE,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'nd.ssa'
igapfill(x, groups, fill = NULL, tol = 1e-6, maxiter = 0,
          norm = function(x) sqrt(max(x^2)),
          base = c("original", "reconstructed"), ..., trace = FALSE,
          drop = TRUE, drop.attributes = FALSE, cache = TRUE)

Arguments

x

Shaped SSA object holding the decomposition

groups

list, the grouping of eigentriples to be used in the forecast

fill

initial values for missed entries, recycled if necessary; if missed, then average of the series will be used

tol

tolerance for reconstruction iterations

maxiter

upper bound for the number of iterations

norm

distance function used for covergence criterion

base

series used as a 'seed' for gapfilling: original or reconstructed according to the value of groups argument

...

additional arguments passed to reconstruct routines

trace

logical, indicates whether the convergence process should be traced

drop

logical, if 'TRUE' then the result is coerced to series itself, when possible (length of 'groups' is one)

drop.attributes

logical, if 'TRUE' then the attributes of the input series are not copied to the reconstructed ones.

cache

logical, if 'TRUE' then intermediate results will be cached in the SSA object.

Details

Iterative gapfilling starts from filling missed entries with initial values, then the missed values are imputed from the successive reconstructions. This process continues until convergence up to a stationary point (e.g. filling / reconstruction does not change missed values at all).

Details of the used algorithm see in Golyandina et al (2018), Algorithms 3.7.

Value

List of objects with gaps filled in. Elements of the list have the same names as elements of groups. If group is unnamed, corresponding component gets name ‘Fn’, where ‘n’ is its index in groups list.

Or, the forecasted object itself, if length of groups is one and 'drop = TRUE'.

Note

The method is very sensitive to the initial value of missed entries ('fill' argument). If the series are not stationary (e.g. contains some trend) than the method may be prohibitely slow, or even fail to converge or produce bogus results.

References

Golyandina N., Korobeynikov A., Zhigljavsky A. (2018): Singular Spectrum Analysis with R. Use R!. Springer, Berlin, Heidelberg.

Kondrashov, D. & Ghil, M. (2006) Spatio-temporal filling of missing points in geophysical data sets. Nonlinear Processes In Geophysics, Vol. 13(2), pp. 151-159.

See Also

Rssa for an overview of the package, as well as, gapfill, clplot, summarize.gaps,

Examples

# Produce series with gaps
F <- co2; F[100:200] <- NA
# Perform shaped SSA
s <- ssa(F, L = 72)
# Fill in gaps using the trend and 2 periodicty components
# Due to trend, provide a linear filler to speedup the process
fill <- F; fill[100:200] <- F[99] + (1:101)/101*(F[201] - F[99])
g <- igapfill(s, groups = list(1:6), fill = fill, maxit = 50)
# Compare the result
plot(g)
lines(co2, col = "red")

Rssa documentation built on Sept. 11, 2024, 7:20 p.m.