ts_fil_ema {tspredit} | R Documentation |
Used to smooth out fluctuations, while giving more weight to recent observations. Particularly useful when the data has a trend or seasonality component.
ts_fil_ema(ema = 3)
ema |
exponential moving average size |
a ts_fil_ema
object.
# time series with noise
library(daltoolbox)
data(sin_data)
sin_data$y[9] <- 2*sin_data$y[9]
# filter
filter <- ts_fil_ema(ema = 3)
filter <- fit(filter, sin_data$y)
y <- transform(filter, sin_data$y)
# plot
plot_ts_pred(y=sin_data$y, yadj=y)