Learn R Programming

RtsEva (version 1.1.0)

tsEvaDetrendTimeSeries: Detrend a Time Series

Description

This function detrends a time series by subtracting the trend component from the original series.

Usage

tsEvaDetrendTimeSeries(
  timeStamps,
  series,
  timeWindow,
  percent = NA,
  fast = TRUE
)

Value

An object of class "tsTrend" with the following components:

originSeries

The original time series

detrendSeries

The detrended time series

trendSeries

The trend component of the time series

nRunMn

The number of data points in the moving window used to calculate the trend

Arguments

timeStamps

A vector of time stamps for the time series.

series

The original time series.

timeWindow

The size of the moving window used to calculate the trend.

percent

The percentile value used to calculate the trend for extreme values. Default is NA.

fast

A logical value indicating whether to print additional information. Default is FALSE.

Examples

Run this code
timeAndSeries <- ArdecheStMartin
timeStamps <- ArdecheStMartin[,1]
series  <- ArdecheStMartin[,2]
timeWindow <- 365*30
detrended <- tsEvaDetrendTimeSeries(timeStamps, series, timeWindow)

Run the code above in your browser using DataLab