- quantecon.filter.hamilton_filter(data, h, p=None)[source]¶
This function applies “Hamilton filter” to the data
- dataarray or dataframe
Time horizon that we are likely to predict incorrectly. Original paper recommends 2 for annual data, 8 for quarterly data, 24 for monthly data.
- pinteger (optional)
If supplied, it is p in the paper. Number of lags in regression. If not supplied, random walk process is assumed.
- cyclearray of cyclical component
- trendtrend component
For seasonal data, it’s desirable for p and h to be integer multiples of the number of obsevations in a year. E.g. for quarterly data, h = 8 and p = 4 are recommended.