Post feed
 Comments feed

Thursday, October 29, 2009

He's right, but I lose my will

I don't want to read about real business cycle theory today, I want to learn Sage.

No, really. Any material on RBC theory includes a mention of the Hodrick-Prescott filter, and every time I see that I'm seized by a wild desire to implement it myself, because it looks so invitingly simple:

\[ \min_{y_{t}^{g}} \; \sum_{t=1}^{\infty} \left[ \left( y_t - y_{t}^{g} \right)^2 + \lambda \left[ \left( y_{t+1}^{g}-y_{t}^{g} \right) - \left( y_{t}^{g} - y_{t-1}^{g} \right) \right]^2 \right] \]

Where $y_t$ is the data point of series $y$ at time $t$, and $y_{t}^{g}$ is the data point of the trend series $y^g$ at time $t$ (the output of the filter). The above optimisation penalises for volatility in the estimated trend as well as deviations from the actual data. $\lambda$ is just a weighting parameter.

Anyway, I'm just burning to code this up in GAUSS (I'd have to do the calculus by hand, but GAUSS would love the minimisation part). However, soon my academic career will be over and I will no longer be able to rely on university licenses for analytical engines. For hobby projects, it's best if I start relying on something open, like Sage; the HP filter seems like a good experimental project for learning with when I switch to my new open engine. But I want to do it now.

No comments:

Post a Comment

You can use $\LaTeX$ here if you like. Enclose it in "$" or "\[" as if you were using your favourite editor.

Note: Only a member of this blog may post a comment.