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 ...

Get Data Analysis with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.