trendCast {smoots} | R Documentation |
Forecasting Function for Nonparametric Trend Functions
Description
Forecasting Function for Nonparametric Trend Functions
Usage
trendCast(object, h = 1, np.fcast = c("lin", "const"), plot = FALSE, ...)
Arguments
object |
an object returned by either |
h |
the forecasting horizon; the values |
np.fcast |
the forecasting method; |
plot |
a logical value; if set to |
... |
additional arguments for the standard plot function, e.g.,
|
Details
This function is part of the smoots
package and was implemented under
version 1.1.0. The underlying theory is based on the additive nonparametric
regression function
y_t = m(x_t) + \epsilon_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 and deterministic trend function and \epsilon_t
are
stationary errors with E(\epsilon_t) = 0
.
The purpose of this function is the forecasting of future values based on
a nonparametric regression model. Following the proposition in Fritz
et al. (2020), point predictions can be conducted
separately for the nonparametric trend function m(x_t)
and the
stationary part \epsilon_t
. The sum of both forecasts is then the
forecast of y_t
. With this function, only the forecast with respect to
m(x_t)
is computable.
Now assume that the variance of the error in the local polynomial
forecasts is negligible when calculating the forecasting intervals. We
define the forecast for time point n + k
, k = 1, 2, ..., h
, by
\hat{m}(x_{n + k}) = \hat{m}(x_n) + D k \delta_m,
where \delta_m
is equal to \hat{m}(x_n) -
\hat{m}(x_{n - 1})
and D
is a
dummy variable. If D = 1
, a linear extrapolation is applied. For
D = 0
, \hat{m}(x_n)
is the predicted value.
To make use of this function, an object of class smoots
can be given
as input. However, since the discussed approach is only valid for the
estimated trend function, only objects created by msmooth
,
tsmooth
, knsmooth
and link{gsmooth}
, if
the trend was estimated, will be appropriate input objects.
With the input argument h
, a positive integer can be given to the
function that represents the forecasting horizon, i.e. how many future values
are to be estimated. Via the argument np.fcast
the value of the dummy
variable D can be specified and thus the forecasting method. For
np.fcast = "lin"
, D = 1
is applied, whereas for
np.fcast = "const"
, D
is set to 0
.
By means of the argument plot
that can be either set to the logical
values TRUE
or FALSE
, a simple plot of the original series
alongside the local polynomial estimates as well as the forecasted values can
be either generated or suppressed.
The function always returns a vector of forecasted values ordered from
n + 1
to n + h
. Depending on the setting of the argument
plot
, a generic plot of the results may be generated. Furthermore,
additional arguments of the standard plot function can be passed to this
function as well to adjust the generated plot.
Value
A numeric vector is always returned with the forecasted values. Depending on the setting for the argument plot, a generic plot might be created.
Author(s)
Yuanhua Feng (Department of Economics, Paderborn University),
Author of the Algorithms
Website: https://wiwi.uni-paderborn.de/en/dep4/feng/Dominik Schulz (Research Assistant) (Department of Economics, Paderborn University),
Package Creator and Maintainer
References
Feng, Y., Gries, T. and Fritz, M. (2020). Data-driven local polynomial for the trend and its derivatives in economic time series. Journal of Nonparametric Statistics, 32:2, 510-533.
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. (2020). Forecasting economic growth processes for developing economies. Unpublished.
Examples
log_gdp <- log(smoots::gdpUS$GDP)
est <- msmooth(log_gdp)
forecasts <- trendCast(est, h = 5, plot = TRUE)
forecasts