ts_fil_ma {tspredit} | R Documentation |
Used to smooth out fluctuations and reduce noise in a time series.
ts_fil_ma(ma = 3)
ma |
moving average size |
a ts_fil_ma
object.
# time series with noise
library(daltoolbox)
data(sin_data)
sin_data$y[9] <- 2*sin_data$y[9]
# filter
filter <- ts_fil_ma(3)
filter <- fit(filter, sin_data$y)
y <- transform(filter, sin_data$y)
# plot
plot_ts_pred(y=sin_data$y, yadj=y)