filter¶
function for filtering
-
quantecon.filter.hamilton_filter(data, h, *args)[source]¶ This function applies “Hamilton filter” to the data
http://econweb.ucsd.edu/~jhamilto/hp.pdf
Parameters: - data : array or dataframe
- h : integer
Time horizon that we are likely to predict incorrectly. Original paper recommends 2 for annual data, 8 for quarterly data, 24 for monthly data.
- *args : integer
If supplied, it is p in the paper. Number of lags in regression. Must be greater than h. If not supplied, random walk process is assumed.
- Note: 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.
Returns: - cycle : array of cyclical component
- trend : trend component