rescale: Rescaling Derivative Estimates

Description Usage Arguments Details Value Author(s) Examples

View source: R/rescale.R


The estimation functions of the smoots package estimate the nonparametric trend function or its derivatives on the rescaled time interval [0, 1]. With this function the derivative estimates can be rescaled in accordance with a given vector with time points.


rescale(y, x = seq_along(y), v = 1)



a numeric vector or matrix with the derivative estimates obtained for time points on the interval [0, 1]; pass the list element ye of the output of the functions dsmooth or gsmooth (if the argument v > 0) to this argument.


a numeric vector of length length(y) with the actual (equidistant) time points ordered from past to present; the default is seq_along(y).


the order of derivative that is implemented for y; the default is 1.


The derivative estimation process is based on the additive time series 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 [0, 1], m(x_t) is a smooth and deterministic trend function and ε_t are stationary errors with E(eps_[t]) = 0 (see also Beran and Feng, 2002). Since the estimates of the main smoothing functions in smoots are obtained with regard to the rescaled time points x_t, the derivative estimates returned by these functions are valid for x_t only. Thus, by passing the returned estimates to the argument y, a vector with the actual time points to the argument x and the order of derivative of y to the argument v, a rescaled estimate series is calculated and returned. The function can also be combined with the numeric output of confBounds.

Note that the trend estimates, even though they are also obtained for the rescaled time points x_t, are still valid for the actual time points.


A numeric vector with the rescaled derivative estimates is returned.



data <- smoots::gdpUS
Xt <- log(data$GDP)
time <- seq(from = 1947.25, to = 2019.5, by = 0.25)
d_est <- smoots::dsmooth(Xt)
ye_rescale <- smoots::rescale(d_est$ye, x = time, v = 1)
plot(time, ye_rescale, type = "l", main = "", ylab = "", xlab = "Year")

smoots documentation built on Oct. 10, 2021, 1:09 a.m.