confBounds | R Documentation |
Asymptotically Unbiased Confidence Bounds
confBounds(
obj,
alpha = 0.95,
p = c(0, 1, 2, 3),
plot = TRUE,
showPar = TRUE,
rescale = TRUE,
...
)
obj |
an object returned by either |
alpha |
the confidence level; a single numeric value between |
p |
the order of polynomial used for the parametric polynomial
regression that is conducted as a benchmark for the trend function;
must satisfy |
plot |
a logical value; for |
showPar |
set to |
rescale |
a single logical value; is set to |
... |
further arguments that can be passed to the |
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, x_t
is the rescaled time
on the interval [0, 1]
, m(x_t)
is a smooth trend function and
\epsilon_t
are stationary errors with E(\epsilon_t) = 0
and
short-range dependence.
The purpose of this function is the estimation of reasonable confidence intervals for the nonparametric trend function and its derivatives. The optimal bandwidth minimizes the Asymptotic Mean Integrated Squared Error (AMISE) criterion, however, local polynomial estimates are (usually) biased. The bias is then (approximately)
\frac{h^{k - v} m^{(k)}(x) \beta_{(\nu, k)}}{k!},
where p
is the order of the local polynomials, k = p + 1
is the
order of the asymptotically equivalent kernel, \nu
is the order of the
of the trend function's derivative, m^(v)
is the \nu
-th order
derivative of the trend function and \beta_{(\nu, k)} = \int_{-1}^{1}
u^k K_{(\nu, k)}(u) du
.
K_{(\nu, k)}(u)
is the k
-th order asymptotically
equivalent kernel function for estimating m^{(\nu)}
.
A renewed estimation with an adjusted bandwidth
h_{ub} = o(n^{-1 / (2k + 1)})
, i.e., a
bandwidth with a smaller order than the optimal bandwidth, is conducted.
h = h_{A}^{(2k + 1) / (2k)}
, where
h_{A}
is the optimal bandwidth, is implemented.
Following this idea, we have that
\sqrt{nh}[m^{(\nu)}(x) - \hat{m}^{(\nu)}(x)]
converges to
N(0,2\pi c_f R(x))
in distribution, where 2\pi c_f
is the sum of autocovariances.
Consequently, the trend (or derivative) estimates are asymptotically unbiased
and normally distributed.
To make use of this function, an object of class smoots
can be given
as input that was created by either msmooth
,
tsmooth
or dsmooth
. Based on the optimal
bandwidth saved within obj
, an adjustment to the bandwidth is made so
that the estimates following the adjusted bandwidth are (relatively)
unbiased.
Based on the input argument alpha
, the level of confidence between
0
and 1
, the respective confidence bounds are calculated for
each observation point.
From the input argument obj
, the order of derivative is automatically
obtained. By means of the argument p
, an order of polynomial is
selected for a parametric regression of the trend function. This is only
meaningful, if the trend (and not its derivatives) is analyzed. Otherwise,
the argument is automatically dropped by the function. Furthermore, if
plot = TRUE
, a plot of the unbiased trend (or derivative) estimates
alongside the confidence bounds is created. If also showPar = TRUE
,
the estimated parametric trend (or parametric constant value for the
derivatives) is added to the confidence bound plot for comparison.
NOTE:
The values that are returned by the function are obtained with respect to
the rescaled time points on the interval [0, 1]
. While the plot can be
adjusted and rescaled by means of a given vector with the actual time points,
the numeric output is not rescaled. For this purpose we refer the user to
the rescale
function of the smoots
package.
This function implements C++ code by means of the
Rcpp
and
RcppArmadillo
packages for
better performance.
A plot is created in the plot window and a list with different components is returned.
a numeric vector of length 1; the level of confidence; input argument.
a numeric vector with one element that represents the adjusted bandwidth for the unbiased trend estimation.
a numeric vector with the estimates following the parametric
regression defined by p
that is conducted as a benchmark for the trend
function; for the trend's derivatives or for p = 0
, a constant value
is the benchmark; the values are obtained with respect to the rescaled time
points on the interval [0, 1]
.
the number of observations.
a data frame with the three (numeric) columns ye.ub,
lower and upper; in ye.ub the unbiased trend
estimates, in lower the lower confidence bound and in upper
the upper confidence bound can be found; the values are obtained with respect
to the rescaled time points on the interval [0, 1]
.
the order of the trend's derivative considered for the test.
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
Beran, J. and Feng, Y. (2002). Local polynomial fitting with long-memory, short-memory and antipersistent errors. Annals of the Institute of Statistical Mathematics, 54(2), 291-311.
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.
log_gdp <- log(smoots::gdpUS$GDP)
est <- msmooth(log_gdp)
confBounds(est)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.