detrend: Detrend a Time Series

View source: R/detrend.R

detrendR Documentation

Detrend a Time Series

Description

Returns a time series with the trend removed. The trend can be estimated using polynomial regression or using a lowess fit.

Usage

detrend(series, order = 1, lowess = FALSE, lowspan = 2/3)

Arguments

series

The time series to be detrended.

order

Order of the polynomial used to estimate the trend with a linear default (order=1) unless lowess is TRUE.

lowess

If TRUE, lowess is used to find the trend. The default is FALSE.

lowspan

The smoother span used for lowess.

Value

The detrended series is returned.

Author(s)

D.S. Stoffer

References

You can find demonstrations of astsa capabilities at FUN WITH ASTSA.

The most recent version of the package can be found at https://github.com/nickpoison/astsa/.

In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.

The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.

See Also

trend

Examples

tsplot( cbind(salmon, detrend(salmon)), gg=TRUE, main='Norwegian Salmon USD/KG' ) 

astsa documentation built on May 29, 2024, 10:29 a.m.