# Smoothing analysis

## Overview

The Smoothing analysis offers a number of filters that can be used to smooth the series.

## Settings

#### Method

###### Moving average

The moving average is calculated at each point as the average over a specified window length. If there are any missing values within the window, the average will use fewer values.

$y\left[\text{t}\right]=\frac{{\sum}_{\text{i}=0}^{\text{w}-1}x\left[t-i\right]}{{\sum}_{\text{i}=0}^{\text{w}-1}\text{IsValid}(x\left[t-i\right])}$
where *w* is the window length and IsValid is a function that is 1 for valid values and 0 for missing values.

###### Moving average, centered

The centered moving average is calculated symmetrically around each point, except towards the ends, where it becomes more and more asymmetric.

The calculation is made differently depending on if 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 for odd *w*, but with a weight of ½ for the outer observations of the window and
$h=\frac{w}{2}$

###### Moving average, exponential

Calculates an exponential moving average.

The exponential factor, *α*, is calculated from the specified number of observations, *f*, like this:

The smoothed series is calculated using a recursive formula:

$y\left[0\right]=x\left[0\right]$ $y\left[t\right]=\text{\alpha}y\left[t-1\right]+\left(1-\text{\alpha}\right)x\left[t\right]$###### HP filter

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 Ravn and Uhlig (2002).

When the frequency adjusted rule is used, the *λ* is calculated from *f* as:

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.

###### HP filter, one-sided

The one-sided Hodrick-Prescott filter is calculated by using only the historical data available at each point in time. The last value will thus be the same for the full and one-sided filter.

###### CF filter, stationary

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 difference stationary and there is no drift. If there is a trend in the series, you might want to use the Detrend analysis to remove it before applying the filter.

###### BK filter

Baxter-King symmetric band-pass filter as described by Baxter and King (1995).

Specify the minimum and maximum period of oscillation. Also specify the lead/lag length of the filter. This many observations will be lost at each end of the filtered series.

###### Length

The window and period length can be expressed as a number of observations or as 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.

###### Std. dev.

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 and a band of 1 standard deviation on each side, ~68.3% of the values are within the band, ~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,
${f=\text{\Phi}}^{-1}\frac{\frac{100-c}{2}+c}{100}$
and Φ is the cumulative normal distribution function.

###### Coef.

The confidence coefficient used for the standard deviation confidence band.