|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
|
function [s,desvabs] = hpfilter(y,w,plotter)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Wilmer Henao wi-henao@uniandes.edu.co
% Department of Mathematics
% Universidad de los Andes
% Colombia
%
% Hodrick-Prescott filter extracts the trend of a time series, the output
% is not a formula but a new filtered time series. This trend can be
% adjusted with parameter w; values for w lie usually in the interval
% [100,20000], and it is up to you to use the one you like, As w approaches infty,
% H-P will approach a line. If the series doesn't have a trend p.e.White Noise,
% doing H-P is meaningles
%
% [s] = hpfilter(y,w)
% w = Smoothing parameter (Economists advice: "Use w = 1600 for quarterly data")
% y = Original series
% s = Filtered series
% This program can work with several series at a time, as long as the
% number of series you are working with doesn't exceed the number of
% elements in the series + it uses sparse matrices which improves speed
% and performance in the longest series
%
% [s] = hpfilter(y,w,'makeplot')
% 'makeplot' in the input, plots the graphics of the original series
% against the filtered series, if more than one series is being
% considered the program will plot |