Remove global deterministic trend information from the series.
dt_lin
removes the linear trend.
dt_quad
removes the quadratic trend.
dt_poly
removes the nth-degree polynomial trend.
dtrend_lin(x, bp = NULL, na.rm = getOption("transx.na.rm")) dtrend_quad(x, bp = NULL, na.rm = getOption("transx.na.rm")) dtrend_poly(x, degree, bp = NULL, na.rm = getOption("transx.na.rm"))
x |
Univariate vector, numeric or ts object with only one dimension. |
---|---|
bp |
Break points to define piecewise segments of the data. |
na.rm |
A value indicating whether NA values should be stripped before the computation proceeds. |
degree |
Value indicating the degree of polynomial |
Returns a vector with the same class and attributes as the input vector.
# Introduce a breaking point at point = 10 xbp <- 3*sin(t) + t xbp[10:20] <- x[10:20] + 15 plotx(cbind(raw = xbp, lin = dtrend_lin(xbp), lin_bp = dtrend_lin(xbp, bp = 10)))