Description Usage Arguments Details Value Author(s) References Examples
Point forecasts and the respective forecasting intervals for trendstationary time series are calculated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
obj 
an object of class 
p 
an integer value >= 0 that defines the AR order p of the
underlying ARMA(p,q) model within the rest term (see the section
Details for more information); is set to 
q 
an integer value ≥ 0 that defines the MA order
q of the underlying ARMA(p,q) model within 
h 
an integer that represents the forecasting horizon; if n is
the number of observations, point forecasts and forecasting intervals will be
obtained for the time points n + 1 to n + h; is set to

method 
a character object; defines the method used for the calculation
of the forecasting intervals; with 
alpha 
a numeric vector of length 1 with 0 < 
it 
an integer that represents the total number of iterations, i.e.,
the number of simulated series; is set to 
n.start 
an integer that defines the 'burnin' number
of observations for the simulated ARMA series via bootstrap; is set to

msg 
this argument is deprecated; make use of the argument 
pb 
a logical value; for 
cores 
an integer value >0 that states the number of (logical) cores to
use in the bootstrap (or 
np.fcast 
a character object; defines the forecasting method used
for the nonparametric trend; for 
export.error 
a single logical value; if the argument is set to

plot 
a logical value that controls the graphical output; for

... 
additional arguments for the standard plot function, e.g.,

This function is part of the smoots package and was implemented under version 1.1.0. The point forecasts and forecasting intervals are obtained based on the additive nonparametric regression model
y_[t] = m(x_[t]) + ε_[t],
where y_[t] is the observed time series with equidistant design, x_[t] is the rescaled time on the interval [0, 1], m(x_[t]) is a smooth trend function and ε_[t] are stationary errors with E(ε_[t]) = 0 and shortrange dependence (see also Beran and Feng, 2002). Thus, we assume y_[t] to be a trendstationary time series. Furthermore, we assume that the rest term ε_[t] follows an ARMA(p,q) model
ε_[t] = ζ_[t] + β_[1] ε_[t1] + ... + β_[p] ε_[tp] + α_[1] ζ_[t1] + ... + α_[q] ζ_[tq],
where α_[j], j = 1, 2, ..., q, and β_[i], i = 1, 2, ..., p, are real numbers and the random variables ζ_[t] are i.i.d. (identically and independently distributed) with zero mean and constant variance.
The point forecasts and forecasting intervals for the future periods n + 1, n + 2, ..., n + h will be obtained. With respect to the point forecasts of ε_[t], i.e., hat[ε]_[n+k], where k = 1, 2, ..., h,
hat[ε]_[n+k] = sum_[i=1]^[p] {hat[β]_[i] ε_[n+ki]} + sum_[j=1]^[q] {hat[α]_[j] hat[ζ]_[n+kj]}
with ε_[n+ki] = hat[ε]_[n+ki] for n+ki > n and hat[ζ]_[n+kj] = E(ζ_[t]) = 0 for n+kj > n will be applied. In practice, this procedure will not be applied directly to ε_[t] but to y_[t]  hat[m](x_[t]).
The point forecasts of the nonparametric trend are simply obtained following the proposal by Fritz et al. (forthcoming) by
hat[m](x_[n+k]) = hat[m](x_[n]) + D * k(hat[m](x_[n])  hat[m](x_[n1])),
where D is a dummy variable that is either equal to the constant value 1 or 0. Consequently, if D = 0, hat[m](x_[n]), i.e., the last trend estimate, is used as a constant estimate for the future. However, if D = 1, the trend is extrapolated linearly. The point forecast for the whole component model is then given by
hat[y]_[n+k] = hat[m](x_[n+k]) + hat[ε]_[n+k],
i.e., it is equal to the sum of the point forecasts of the individual components.
Equivalently to the point forecasts, the forecasting intervals are the sum of the forecasting intervals of the individual components. To simplify the process, the forecasting error in hat[m](x_[n+k]), which is of order O(2/5), is not considered (see Fritz et al. (forthcoming)), i.e., only the forecasting intervals with respect to the rest term ε_[t] will be calculated.
If the distribution of the innovations is nonnormal or generally not further
specified, bootstrapping the forecasting intervals is recommended. If they
are however normally distributed or if it is at least assumed that they are,
the forecasting errors are also approximately normally distributed with a
quickly obtainable variance. For further details on the bootstrapping
method, we refer the readers to bootCast
, whereas more
information on the calculation under normality can be found at
normCast
.
In order to apply the function, a smoots
object that was generated as
the result of a trend estimation process needs to be passed to the argument
obj
. The arguments p
and q
represent the orders of the
of the ARMA(p,q) model that the error term
ε_[t] is assumed to follow. If both arguments are
set to NULL
, which is the default setting, orders will be selected
according to the Bayesian Information Criterion (BIC) for all possible
combinations of p,q = 0, 1, ..., 5. Furthermore, the forecasting
horizon can be adjusted by means of the argument h
, so that point
forecasts and forecasting intervals will be obtained for all time points
n + 1, n + 2, ..., n + h.
The function also allows for two calculation approaches for the forecasting
intervals. Via the argument method
, intervals
can be obtained under the assumption that the ARMA innovations are normally
distributed (method = "norm"
). Alternatively, bootstrapped intervals
can be obtained for unknown innovation distributions that are clearly
nonGaussian (method = "boot"
).
Another argument is alpha
. By passing a value
to this argument, the (100alpha
)percent confidence level for
the forecasting intervals can be defined. If method = "boot"
is
selected, the additional arguments it
and n.start
can be
adjusted. More specifically, it
regulates the number of iterations of
the bootstrap, whereas n.start
sets the number of 'burnin'
observations in the simulated ARMA processes within the bootstrap that are
omitted.
Since this bootstrap approach for method = "boot"
generally needs a
lot of computation time, especially for
series with high numbers of observations and when fitting models with many
parameters, parallel computation of the bootstrap iterations is enabled.
With cores
, the number of cores can be defined with an integer.
Nonetheless, for cores = NULL
, no cluster is created and therefore
the parallel computation is disabled. Note that the bootstrapped results are
fully reproducible for all cluster sizes. The progress of the bootstrap can
be observed in the R console, where a progress bar and the estimated
remaining time are displayed for pb = TRUE
.
Moreover, the argument np.fcast
allows to set the forecasting method
for the nonparametric trend function. As previously discussed, the two
options are a linear extrapolation of the trend (np.fcast = "lin"
) and
a constant continuation of the last estimated value of the trend
(np.fcast = "const"
).
The function also implements the option to automatically create a plot of
the forecasting results for plot = TRUE
. This includes the feature
to pass additional arguments of the standard plot function to
modelCast
(see also the section 'Examples').
NOTE:
Within this function, the arima
function of the
stats
package with its method "CSSML"
is used throughout
for the estimation of ARMA models. Furthermore, to increase the performance,
C++ code via the Rcpp
and
RcppArmadillo
packages was
implemented. Also, the future
and
future.apply
packages are
considered for parallel computation of bootstrap iterations. The progress
of the bootstrap is shown via the
progressr
package.
The function returns a 3 by h matrix with its columns
representing the future time points and the point forecasts, the lower
bounds of the forecasting intervals and the upper bounds of the
forecasting intervals as the rows. If the argument plot
is set to
TRUE
, a plot of the forecasting results is created.
#'If export.error = TRUE
is selected, a list with the following
elements is returned instead.
the 3 by h forecasting matrix with point forecasts and bounds of the forecasting intervals.
an it
by h matrix, where each column
represents a future time point n + 1, n + 2, ..., n + h; in each column
the respective it
simulated forecasting errors are saved.
Yuanhua Feng (Department of Economics, Paderborn University),
Author of the Algorithms
Website: https://wiwi.unipaderborn.de/en/dep4/feng/
Dominik Schulz (Research Assistant) (Department of Economics, Paderborn
University),
Package Creator and Maintainer
Beran, J. and Feng, Y. (2002). Local polynomial fitting with longmemory, shortmemory and antipersistent errors. Annals of the Institute of Statistical Mathematics, 54(2), 291311.
Feng, Y., Gries, T. and Fritz, M. (2020). Datadriven local polynomial for the trend and its derivatives in economic time series. Journal of Nonparametric Statistics, 32:2, 510533.
Feng, Y., Gries, T., Letmathe, S. and Schulz, D. (2019). The smoots package in R for semiparametric modeling of trend stationary time series. Discussion Paper. Paderborn University. Unpublished.
Feng, Y., Gries, T., Fritz, M., Letmathe, S. and Schulz, D. (2020). Diagnosing the trend and bootstrapping the forecasting intervals using a semiparametric ARMA. Discussion Paper. Paderborn University. Unpublished.
Fritz, M., Forstinger, S., Feng, Y., and Gries, T. (forthcoming). Forecasting economic growth processes for developing economies. Unpublished.
1 2 3 4 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.