ts_trend: Trend Extraction by Moving Averages

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

View source: R/ts_trend.R

Description

Extracts and plots the trend for a time series.

Usage

1
2
3
4
5
6
7
8
ts_trend(
  x,
  order = 5,
  plot = T,
  detrend = T,
  detrendPlot = F,
  type = "additive"
)

Arguments

x

A time series

order

Order of moving average smoother. Defaults to 5.

plot

Whether to plot the trend or not. Defaults to TRUE.

detrend

Whether to remove the calculated trend from the time series or not. TRUE needed to use with ts_season(). Defaults to TRUE.

detrendPlot

Whether to plot the detrended series. Defaults to FALSE.

type

Type of de decomposition, either "additive" or "multiplicative". Defaults to "additive".

Details

The moving average smoother averages the nearest order periods of each observation.

Value

If either plot or detrendPlot a list containing the series and the plots, otherwise a list containing the trend and the order of the moving average.

Author(s)

David Alberto Mateos Montes de Oca

See Also

ma()

Examples

1
2

alberto-mateos-mo/tsextras documentation built on Feb. 3, 2020, 12:03 a.m.