The detrend() function performs a detrending transformation and
removes a trend from the provided time series. detrend.rev() reverses
the transformation.
Usage
detrend(x, trend)
Arguments
x
A numeric vector or univariate time series of class ts.
trend
A numeric vector or univariate time series containing the trend
to be removed. Generally, the fitted values of a model object.
Value
A vector of the same length as x containing the residuals of
x after trend removal.
References
R. H. Shumway, D. S. Stoffer, Time Series Analysis and Its
Applications: With R Examples, Springer, New York, NY, 4 edition, 2017.