Smoothing
Since the removal of the irregular component and visualizing just the trend in a series is of such interest to practitioners, various methods of smoothing, or remove the roughness and noise of a series to get a better sense on the signal, have been devised.
Perhaps the simplest method of smoothing a series is to use a simple moving average. In this technique a window length is defined. Say our window is set to five observations: for each observation in the time series, then, the first two observations to the left and right (along with the current observation) are averaged; this average then becomes the new value at that point in the series.
Let's perform a simple moving average smoothing on the Gaussian noise series and visualize the results of using different window lengths. We will use the SMA
function from the TTR
package:
> library(TTR)
> sm5 <- SMA(gausnoise, n=5)
> sm10 <- SMA(gausnoise, n=10)
> sm15 <- SMA(gausnoise, n=15)
> head(sm5, n=10)
[1] NA NA...