Overview
The Smoothing analysis is used for minimizing the fluctuations of a time series. You can choose from several smoothing methods which are described below.
Settings
Method
None
This method is used to include a series without any calculation applied.
Moving average
The value at each point is calculated as the average of the series over a specified window length. If there are any missing values within the window, the average will use fewer values.
where w is the window length and IsValid is a function that is 1 for valid values and 0 for missing values.
Moving average, cenetred
The centered moving average is calculated symmetrically around each point, except towards the ends, where it becomes increasingly asymmetric. The calculation is different depending on whether the window length is odd or even. When the window length, w, is an odd number, the calculation is similar to a lagged ordinary moving average:
When the window length, w, is an even number, the calculation is a second order moving average. It is calculated in the same way as when w is odd, but with a weight of ½ for the outer observations of the window and .
Moving average, exponential
This calculates an exponential moving average. The exponential factor, α, is calculated from the specified number of observations, f, as follows:
The smoothed series is calculated using a recursive formula:
HP filter
This method uses the Hodrick-Prescott symmetric filter as described by Hodrick and Prescott (1997). The factor, λ, can be specified either directly or by using the frequency adjusted power rule described by Ravn and Uhlig (2002). When the frequency adjusted rule is used, the λ is calculated from f as follows:
where p is the number of observations per year for the frequency at hand.
A factor of 4 is recommended by Ravn and Uhlig. A factor of 2 will give you the original Hodrick and Prescott values.
We calculate the HP filter according to Hodrick–Prescott filter - Wikipedia, which is the same method as can be found in MATLAB and EViews.
The rule of thumb is to use for quarterly data; for monthly data; and for yearly data.
HP filter, one-sided
The one-sided Hodrick-Prescott filter is calculated by using only the historical data available at each point in time. Thus, the last value is the same as for the full HP filter.
The rule of thumb is to use for quarterly data; for monthly data; and for yearly data.
CF filter, stationary
This uses the Christiano-Fitzgerald full sample asymmetric band-pass filter as described by Christiano and Fitzgerald (1999). Use this version of the CF filter when the series is stationary and there is no drift. If there is a trend in the series, you may want to remove it using the detrend analysis to before applying this filter.
BK filter
This method uses the Baxter-King symmetric band-pass filter as described by Baxter and King (1995). The specified length determines the lead/lag length of the filter and is equal to number of observations lost at each end of the filtered series. You should specify the minimum and maximum periods of oscillation.
Length
The window and period length can be expressed as many observations or as many units of the specified time unit (Year, Quarter, Month etc.), which is then converted to a number of observations based on the frequency of the data.
Standard deviation
When selected, the application will calculate a pair of series that forms a confidence band around the mean so that the specified percentage of the values are within the band if the data is normally distributed. The corrected sample standard deviation, s, is calculated as the deviation from the smoothed line.
The empirical rule, states that for normally distributed data ~68.3% of the values are within the a band of 1 standard deviation on each side, ~95.4% are within 2 standard deviations and ~99.7% are within 3 standard deviations.
Formally, the band is μ±f∙s, where μ is the smoothed series, c is the confidence coefficient,
Coefficient
The confidence coefficient used for the standard deviation confidence band.
Examples
The Smoothing analysis is used here to remove the cyclical component of the BIS Residential Price Index. To do so, we calculated the HP Filter of the BIS index, and included the original series as output.
Here, we calculated 3 months moving average on the Retail Trade series, to smooth it and make it easier to read.
Questions
How do I calculate a moving average / rolling mean?
There are two main possibilities to calculate rolling mean:
- In Smoothing analysis:
Add 'Moving average' as a calculation and set the length.
- With formula:
You can use the formula:
Mean(series, window)
Example:
Mean(spx, Monthslength(3))
This will calculate a three month rolling mean for the S&P 500.
For more information about Formula language see Formula analysis.