hodrick prescott filter (hp-filter) in...

7
Hodrick Prescott Filter (HP-Filter) in Excel May 31, 2016 Backgroud The Hodrick Prescott Filter (HP-Filter), introduced by Hodrick and Prescott (1980), is a detrending method that is widely used in empirical macro analysis. The original series ( Y t ) is made up of a trend component (T t ) and a cyclical component ( C t ): Y t = T t + C t (1) The HP-Filter isolates the trend component by minimization the following loss function: MIN T { T t =1 ( Y t - T t ) 2 + λ T -1 t =2 [(T t +1 - T t ) - (T t - T t -1 )] 2 } (2) where λ is smoothing parameter. Normally, we use λ = 100, 1600, and 14400 for yearly, quarterly, and monthly data, respectively. Install HP-Filter Excel Add-in HP-Filter can be easily done in excel. To do so, we need to install the HP-Filter excel add-in. The package can be downloaded from the following link: http://www.web-reg.de/hp_addin.html After download and unzip, install it from the "HPFilter.xla" file. 1

Upload: others

Post on 13-Apr-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Hodrick Prescott Filter (HP-Filter) in Excel

May 31, 2016

Backgroud

The Hodrick Prescott Filter (HP-Filter), introduced by Hodrick and Prescott (1980), is a detrendingmethod that is widely used in empirical macro analysis. The original series (Yt) is made up of atrend component (Tt) and a cyclical component (Ct):

Yt = Tt +Ct (1)

The HP-Filter isolates the trend component by minimization the following loss function:

MINT{T

∑t=1

(Yt −Tt)2 +λ

T−1

∑t=2

[(Tt+1 −Tt)− (Tt −Tt−1)]2} (2)

where λ is smoothing parameter. Normally, we use λ = 100, 1600, and 14400 for yearly,quarterly, and monthly data, respectively.

Install HP-Filter Excel Add-in

HP-Filter can be easily done in excel. To do so, we need to install the HP-Filter excel add-in. Thepackage can be downloaded from the following link:

http://www.web-reg.de/hp_addin.html

After download and unzip, install it from the "HPFilter.xla" file.

1

Page 2: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

HP-Filter in Excel

Step 1: Prepare the original data. In our example, we have unemployment rate (LUR) and loga-rithm of real GDP multiplied by 100 (lnY*100) of Alabama from 1976 to 2011. They need to beordered by year.

2

Page 3: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Step 2: Select the trend component area that is corresponding with the original data range. In ourexample, we select the area E2:E37.

3

Page 4: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Step 3: Keep the area selected, and type the command:=HP(C2:C37,100)where HP is the main command, C2:C37 is the range of the original data, 100 is the smoothing

parameter. Do not hit "Enter".

4

Page 5: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Step 4: HP is an array formula, so instead of hitting "Enter", we use "Shift+Ctrl+Enter", and thisshould give us the trend component of unemployment rate.

5

Page 6: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Step 5: We can follow the similar steps and get the trend component of real output.

6

Page 7: Hodrick Prescott Filter (HP-Filter) in Excelunassumingeconomist.com/wp-content/uploads/2015/05/HP_Filter_Cheatsheet.pdfHP-Filter in Excel Step 1: Prepare the original data. In our

Step 6: We can get the cyclical component by subtracting the trend component from the originaldata:

7