detrend: Detrending Transformation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/detrend.r

Description

The detrend() function performs a detrending transformation and removes a trend from the provided time series. detrend.rev() reverses the transformation.

Usage

1
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

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

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

RebeccaSalles/TSPred documentation built on April 6, 2021, 2:44 a.m.