Learn R Programming

tsbox (version 0.4.1)

ts_trend: Loess Trend Estimation

Description

Trend estimation that uses stats::loess().

Usage

ts_trend(x, ...)

Value

a ts-boxable object of the same class as x, i.e., an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

Arguments

x

ts-boxable time series, an object of class ts, xts, zoo, zooreg, data.frame, data.table, tbl, tbl_ts, tbl_time, tis, irts or timeSeries.

...

arguments, passed to stats::loess():

  • degree degree of Loess smoothing

  • span smoothing parameter, if NULL, an automated search performed (see Details)

References

Cleveland, William S., Eric Grosse, and William M. Shyu. "Local regression models." Statistical models in S. Routledge, 2017. 309-376.

Examples

Run this code
# \donttest{
ts_plot(
  `Raw series` = fdeaths,
  `Loess trend` = ts_trend(fdeaths),
  title = "Deaths from Lung Diseases",
  subtitle = "per month"
)
# }

Run the code above in your browser using DataLab