Hpfilter in statsmodels

Hi,

I’m trying to use hpfilter() from statsmodels without any luck. Since Anvil has version 0.9.0 of statsmodels I’m using the “old” model structure, doing

import statsmodels as sm
cycle, trend = sm.tsa.filters.hp_filter.hpfilter(myArray)

and getting AttributeError: module ‘statsmodels’ has no attribute ‘tsa’ error.

The import statsmodels.api doesn’t work, it reports incompatibility with scipy.

Is statsmodels usable at all?

Thanks, Tomaz

There is a known issue about statsmodels being incompatible with newer versions of scipy. Some info here.

Here’s the code for the Hodrick-Prescott filter from statsmodels itself which seems pretty approachable in that there is not that much of it.

Love open source!

Thanks. I saw the issue and it was already resolved. I run locally the latest statsmodels 0.12.0 with scipy 1.5.2 with no problems. Maybe the statsmodels just needs to be upgraded in Anvil, or there is some other inconsistency with packages.

1 Like