| ts_fil_ma | R Documentation |
Smooth out fluctuations and reduce noise by averaging over a fixed-size rolling window.
ts_fil_ma(ma = 3)
ma |
moving average size |
Larger windows produce smoother series but may lag turning points.
A ts_fil_ma object.
# time series with noise
library(daltoolbox)
data(tsd)
tsd$y[9] <- 2*tsd$y[9]
# filter
filter <- ts_fil_ma(3)
filter <- fit(filter, tsd$y)
y <- transform(filter, tsd$y)
# plot
plot_ts_pred(y=tsd$y, yadj=y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.