Hodrick-Prescott filter (see Hodrick and Prescott (1997)) is a popular tool in macroeconomics for fitting smooth trend to time series. In SAS, we can use PROC UCM to realize the HP filter. The dataset considered in this example consists of quarterly real GDP for the United States from 1947-2016 (b, seasonally adjusted annual rate). The data can be download from this link https://fred.stlouisfed.org/series/GDPC1
I use SAS MACROS to define a function for HP filter. "input" is the data file you use, "date" is the variable for time, "int" is the time interval which could be hour, day, month, qtr, year, "var" is the variable for hp filter, "par" is a multiple which depends on the frequency of the series (1/14400 for monthly data, 1/1600 = 0.000625 for quarterly data, range from 1/400 = 0.0025 to 1/7 = 0.15 for annual data), "out" is the name of data file to record the output. The following two graphs are the detrended series and trend series.
%macro hp(input= ,date= ,int= ,var= ,par= ,out= );
proc ucm data=&input;
id &date interval=∫
model &var;
irregular plot=smooth;
level var=0 noest plot=smooth;
slope var=&par noest;
estimate PROFILE;
forecast plot=(decomp) outfor=&out;
run;
%mend;
%hp(input=gdp,date=year,int=qtr,var=gdp,par=0.000625,out=result);
I use SAS MACROS to define a function for HP filter. "input" is the data file you use, "date" is the variable for time, "int" is the time interval which could be hour, day, month, qtr, year, "var" is the variable for hp filter, "par" is a multiple which depends on the frequency of the series (1/14400 for monthly data, 1/1600 = 0.000625 for quarterly data, range from 1/400 = 0.0025 to 1/7 = 0.15 for annual data), "out" is the name of data file to record the output. The following two graphs are the detrended series and trend series.
Thanks for sharing and explaining me in detail about the latest technology. Hope waiting for more posts like this.
ReplyDeleteSAS Training in Chennai
SAS Course in Chennai
Your post about technology was very helpful to me. Very clear step-by-step instructions. I appreciate your hard work and thanks for sharing. Thanks a lot for explaining practically. Fantastic Post! Get more information SAS Training in Chennai|SAS Course in Chennai|Spring Training in Chennai
ReplyDeleteGreat Post. Keep sharing such kind of worthy information
ReplyDeleteSAS Training Institutes in Chennai
SAS Institute in Chennai