Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/extend.series.R
Extends a univariate or multivariate time series beyond its original length.
1 | extend.series(X, method="reflection", length="double", n, j)
|
X |
A univariate or multivariate time series. Numeric vectors, matrices and data frames are accepted. |
method |
A character string indicating which extension method to
use. Possible values are |
length |
A character string indicating how to determine the
length of the extended series. Possible values are
|
n |
An integer value specifying the length of the extended
series. This argument is only relevant when |
j |
An integer value specifying the power of two of which the
length of the extended series should be a multiple. This argument is
only relevant for |
The original time series, X
, is extended to a new length
as determined by length
: if length = "arbitrary"
, a value
for the argument n
must be specified in order to extend the
series to length n
; if length = "powerof2"
the series
will be extended to the nearst multiple of 2^j, where j
must be specified as an argument to the function; if length =
"double"
the series will be extended to twice its original length.
Once the length of the extended series is determined, the actual
extension is performed using one of five methods: if method =
"periodic"
a periodic extension is made by concatenating the series
with itself (without changing the order of the values); if
method = "reflection"
an extension is made by concatenating
the series with a reflection (reverse ordering) of itself; if
method = "zero"
the series is padded with zeros; if
method = "mean"
the series is padded with its mean; if
method = "reflection.inverse"
an extension is made by
concatenating the series with a reflection (reverse ordering) of
itself that is further reflected of the horizontal axis y = x_N
where x_N is the last value of the observed series.
In the case that the series is extended beyond twice it's original
length, the "periodic"
and "reflection"
methods are
repetetively applied so that every subseries of length N (the
length of the original series) is either a periodic or reflected
extension of any other N adjacent values. Similarly, the
"reflection.inverse"
method is repetetively applied so that
every 2N values are a periodic extension of any adjacent
2N values.
The extended time series, in its original class.
Eric Aldrich. ealdrich@gmail.com.
Percival, D. B. and A. T. Walden (2000) Wavelet Methods for Time Series Analysis, Cambridge University Press.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # obtain the two series listed in Percival and Walden (2000), page 42
X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3)
X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3)
# combine them and extend using reflection method
newX <- cbind(X1,X2)
newX.ext1 <- extend.series(newX, length="arbitrary", n=64)
plot.ts(newX.ext1)
# apply another extension method
newX.ext2 <- extend.series(newX, method="reflection.inverse",
length="powerof2", j=6)
plot.ts(newX.ext2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.