detrend {TSPred}R Documentation

Detrending Transformation

Description

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.

Author(s)

Rebecca Pontes Salles

References

R. H. Shumway, D. S. Stoffer, Time Series Analysis and Its Applications: With R Examples, Springer, New York, NY, 4 edition, 2017.

See Also

DIF,BCT, MAS, LT, PCT

Examples


data(CATS,CATS.cont)
fpoly <- fittestPolyR(CATS[,1],h=20)
trend <- fitted(fpoly$model)

residuals <- detrend(CATS[,1],trend)
x <- detrend.rev(residuals,trend)


[Package TSPred version 5.1 Index]