detrend {TSPred} | R Documentation |
The detrend()
function performs a detrending transformation and
removes a trend from the provided time series. detrend.rev()
reverses
the transformation.
detrend(x, trend)
x |
A numeric vector or univariate time series of class |
trend |
A numeric vector or univariate time series containing the trend to be removed. Generally, the fitted values of a model object. |
A vector of the same length as x
containing the residuals of
x
after trend removal.
Rebecca Pontes Salles
R. H. Shumway, D. S. Stoffer, Time Series Analysis and Its Applications: With R Examples, Springer, New York, NY, 4 edition, 2017.
data(CATS,CATS.cont)
fpoly <- fittestPolyR(CATS[,1],h=20)
trend <- fitted(fpoly$model)
residuals <- detrend(CATS[,1],trend)
x <- detrend.rev(residuals,trend)