| growlen | R Documentation |
growlen exapands the length of a time series or a numeric vector
by running an auto arima regression for forecasting and backcasting.
Extending the sample by inserting forecast can be a simple
remedy for the end point problem.
growlen(x, h, direction = one_side)
x |
A time series or a numeric vector. |
h |
An integer. Number of periods for expanding the data. |
direction |
Where to grow the data. Allowed values are
|
A time series or a numeric vector. The length of the returned
value is the original length plus h.
GDPC1_grow <- growlen(GDPC1, h = 4)
growlen(GDPC1, h = 8, direction = both)
# EbayesThresh
GDPC1_grow_wavelet <- signal(GDPC1_grow, boundary = "reflection", n.levels = 5, vscale = "level")
gap_wavelet <- 100 * (GDPC1_grow - GDPC1_grow_wavelet) / GDPC1_grow_wavelet
# Comparing gap_wavelet (end point adjust) with the original GDPC1_GDPPOT
ts.plot(ts.intersect(GDPC1_GDPPOT, gap_wavelet), col = c(1, 2)); abline(h = 0)
legend(1980, 9, legend = c("GDPC1_GDPPOT", "gap_wavelet"), col = c(1, 2), lty = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.