Tech Notes

My notes on Statistics, Big Data, Cloud Computing, Cyber Security

Moving Average and Smoothing

A moving average (rolling average or running average) is a calculation to analyse data points by creating a series of averages of different subsets of the full data set

Given a series of numbers and a fixed subset size, the first element of the moving average is obtained by taking the average of the initial fixed subset of the number series. Then the subset is modified by “shifting forward”; that is, excluding the first number of the series and including the next number following the original subset in the series. This creates a new subset of numbers, which is averaged. This process is repeated over the entire data series. The plot line connecting all the (fixed) averages is the moving average.

A moving average is commonly used with time series data to smooth out short-term fluctuations and highlight longer-term trends or cycles

Tukey weights

Since this is dependent on the mean, it is very sensitive to outliers. To counter this, sometimes it could also be that the two values that are very close to each other should contribute a lot of weight to the moving average, and values that are farther apart should contribute less weight. So instead of just averaging each of the values equally, we could include providing them weights during averaging. This weight function will assign the greatest weight to the observation being smoothed in the centre of the window, and increasingly smaller weights to values that are further away from the centre.

Loess (Lowess)

Another smoothing function, LOESS combines much of the simplicity of linear least squares regression with the flexibility of nonlinear regression. It does this by fitting simple models to localized subsets of the data to build up a function that describes the deterministic part of the variation in the data, point by point


A spline is a sufficiently smooth polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the places where the polynomial pieces connect

Disclaimer : These are my study notes – online – instead of on paper so that others can benefit. In the process I’ve have used some pictures / content from other original authors. All sources / original content publishers are listed below and they deserve credit for their work. No copyright violation intended.

References for these notes :

The study material for the MOOC “Data Analysis” at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: