hprescott进行H-P滤波
【问题】有时候,对于时间序列需要处理一下,以取出趋势项,去除周期项。
Hodrick–Prescott filter是常用的方法。
【方法】
yt=τt+ct
τ为趋势项,t为周期项
最小化下式,求得τ
λ为两项的权重
Stata里面对于年度、季度和月度数据分别取6.25、1600和129600
* Quarterly
if "`tu'" == "q" {
local smooth 1600
}
* Annual
else if "`tu'" == "y" {
local smooth 6.25
}
* Monthly
else if "`tu'" == "m" {
local smooth 129600
}
【例子】
ssc installhprescott
webuse lutkepohl, clear
hprescott investment, stub(HP)
* Application in a panel:
webuse grunfeld, clear
by company: hprescott invest, stub(hp)
原文:http://blog.sina.com.cn/s/blog_629bb75801012sd5.html
页:
[1]