Menu ▾ ▴

#343 hpfilt(): default λ for annual and monthly data, Ravn and Uhlig's 6.25·pd⁴ rather than 100·pd² (follow-up to gretl-devel, October 2016).

v1.0_(example)
closed-fixed
nobody
None
5
22 hours ago
5 days ago
No

gretl 2026d, Windows 11 Pro 64-bit.

When λ is not given, hpfilt() uses "100 times the square of the periodicity" (Function Reference): 100 for annual data, 1600 for quarterly and 14,400 for monthly.

On 14 October 2016 Ignacio Díaz-Emparanza proposed on gretl-devel, in the thread "Hodrick-Prescott parameter" (the message), to use λ = 6.25·S⁴ instead, S the periodicity, which gives 6.25 for annual, 1600 for quarterly and 129,600 for monthly data. The message cites Maravall & del Río (2001), Ravn & Uhlig (2002) and de Jong & Sakarya (2016). In that thread:

  • Jack Lucchetti argued that the better choice should be the default, the only cost being backward compatibility;
  • Allin Cottrell weighed backward compatibility against agreement with other software, and inclined to make the change and to add references to the critiques of the filter to the documentation (the message);
  • the one-sided filter that Sven Schreiber asked for in the same thread came in 2018a.

The default is unchanged in 2026d, and the Function Reference names neither the rule nor the paper. Earlier, ticket [bugs:#30] (2008) raised the GUI's cap on λ, then 28,800, so that Ravn and Uhlig's 129,600 could be entered for monthly data.

Other programs now use or document the rule:

  • Stata 19: tsfilter hp uses the Ravn–Uhlig rule by default whenever the time unit is set: 6.25 for yearly, 100 for half-yearly and 129,600 for monthly data (Time-Series Reference Manual, tsfilter hp, pp. 693 and 699).
  • statsmodels 0.15: hpfilter(x, lamb=1600) keeps 1600, but its docstring cites Ravn & Uhlig's 6.25 for annual and 129,600 for monthly data.

A check on gretl's own data. The attached hpfilt-default-lambda.inp uses only fedstl.bin. As in Ravn & Uhlig's Figure 1, it compares each HP trend with the quarterly λ = 1600 trend averaged over each year or quarter:

A. annual real GDP (gdpc1), 1947-2000            default (100)    lambda = 6.25
   RMS gap to the quarterly trend, per cent      1.1323           0.0309
   sd of the cycle, per cent                     2.225            1.501      quarterly cycle averaged by year: 1.527

B. monthly industrial production (indpro), 1950-2019    default (14400)    lambda = 129600
   RMS gap to the quarterly trend, per cent      1.3160           0.0055
   sd of the cycle averaged by quarter           2.492            3.308      quarterly cycle: 3.305

So on these series the defaults make the annual cycle 46 % more volatile, and the monthly one 25 % less volatile, than the quarterly benchmark. With 6.25 and 129,600 the annual and monthly results agree with the quarterly ones, and on a grid of 0.01 the annual λ closest to the quarterly trend is 6.63.

The suggestion:

  • make the default λ = 6.25·pd⁴, that is 1600·(pd/4)⁴, as discussed in 2016, with an entry in the log of backward-incompatible changes;
  • in the Function Reference, name the rule and cite Ravn, M. O. and Uhlig, H. (2002), "On adjusting the Hodrick–Prescott filter for the frequency of observations", Review of Economics and Statistics 84(2): 371–376. The paper's first page prints 371–380, but the paper ends on p. 376.

If backward compatibility rules out the first, the second alone would help users who rely on the default.

1 Attachments

Related

Bugs: #30

Discussion

  • Allin Cottrell

    Allin Cottrell - 22 hours ago

    We decided to switch to the formula for lambda recommended by Ravn-Uhlig (2002). This is now done and documented.

     
  • Allin Cottrell

    Allin Cottrell - 22 hours ago
    • status: open --> closed-fixed
     

Log in to post a comment.