Perform SSA gapfilling via forecast

Share:

Description

Perform SSA gapfilling of the series.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## S3 method for class '1d.ssa'
gapfill(x, groups, base = c("original", "reconstructed"),
        method = c("sequential", "simultaneous"),
        alpha = function(len) seq.int(0, 1, length.out = len), ...,
        drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'mssa'
gapfill(x, groups, base = c("original", "reconstructed"),
        alpha = function(len) seq.int(0, 1, length.out = len), ...,
        drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'cssa'
gapfill(x, groups, base = c("original", "reconstructed"),
        method = c("sequential", "simultaneous"),
        alpha = function(len) seq.int(0, 1, length.out = len), ...,
        drop = TRUE, drop.attributes = FALSE, cache = TRUE)
## S3 method for class 'toeplitz.ssa'
gapfill(x, groups, base = c("original", "reconstructed"),
        method = c("sequential", "simultaneous"),
        alpha = function(len) seq.int(0, 1, length.out = len), ...,
        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

base

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

method

method used for gapfilling, "sequential" means to filling by a recurrent forecast from complete parts; "simultaneous" tries to build a projections onto the signal subspace. See 'References' for more info.

alpha

weight used for combining forecasts from left and right when method = "sequential"; 0.5 means that the forecasts are averaged, 0 (1) means that only forecast from the left (right correspondingly) is used, arbitrary function could be specified; by default linear weights are used.

...

additional arguments passed to reconstruct routines

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

The function fills in the missed entries in the series. Both methods described in (Golyandina, Osipov, 2007) are implemented:

  • method = "sequential" performs forecast from complete chunks onto incomplete. For internal gaps forecast is performed from both sides of the gap and average is taken in order to reduce the forecast error. For gaps in the beginning or end of the series the method coincides with ordinary recurrent forecast;

  • method = "simultaneous" performs gap filling via projections onto signal subspace. The method may fail if insufficient complete observations are provided.

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'.

References

N. Golyandina, E. Osipov (2007): The "Caterpillar"-SSA method for analysis of time series with missing values. Journal of Statistical Planning and Inference, Vol. 137, No. 8, Pp 2642–2653 http://www.gistatgroup.com/cat/mvssa1en.pdf

See Also

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

Examples

1
2
3
4
5
6
7
8
9
# 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
g <- gapfill(s, groups = list(1:6))
# Compare the result
plot(g)
lines(co2, col = "red")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.