residuals | R Documentation |
Obtain the residuals from SSA reconstruction
## S3 method for class 'ssa'
residuals(object, groups, ..., cache = TRUE)
## S3 method for class 'ssa.reconstruction'
residuals(object, ...)
object |
input object |
groups |
list of numeric vectors, indices of elementary components used for reconstruction, the entries of the list can be named. |
... |
further arguments passed to |
cache |
logical, if 'TRUE' then intermediate results will be cached in the SSA object. |
This function calculates the residuals either from SSA object
corresponding to reconstruction using groups
arguments, or just
extracts the residuals from reconstruction object.
residuals object
Rssa
for an overview of the package, as well as,
reconstruct
.
# Decompose 'co2' series with default parameters
s <- ssa(co2)
# Reconstruct the series, grouping elementary series.
r <- reconstruct(s, groups = list(c(1, 4), c(2,3), c(5, 6)))
print(residuals(r))
# If there are several groups, then the residuals are calculated as
# residuals for the model corresponding to the combined model.
r <- reconstruct(s, groups = list(c(6, 7), c(6,7), c(8, 9)))
r1 <- reconstruct(s, groups = list(6:9))
max(abs(residuals(r) - residuals(r1))) # 0
max(abs(co2 - (r1$F1 + residuals(r1)))) # 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.