Learn R Programming

smoots (version 1.1.4)

rescale: Rescaling Derivative Estimates

Description

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.

Usage

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

Value

A numeric vector with the rescaled derivative estimates is returned.

Arguments

y

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.

x

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

v

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

Author

  • Dominik Schulz (Research Assistant) (Department of Economics, Paderborn University),
    Package Creator and Maintainer

Details

The derivative estimation process is based on the additive time series model $$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 \([0, 1]\), \(m(x_t)\) is a smooth and deterministic trend function and \(\epsilon_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.

Examples

Run this code
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")

Run the code above in your browser using DataLab