Skip to content
Advertisement

Initialising Model in Python’s statsmodels

I am having difficulties understanding how to initialise an empty as well as as a known initial config model in statsmodels, here imported as

from statsmodels.tsa.regime_switching.markov_autoregression import MarkovAutoregression
    # HMM fitting to determine the Parameters of the 2 state SWitching-AR(2,1)
    init_prob = np.array( [[0.8, 0.2], [0.2, 0.8]] )
    MarkovAutoregression.initialize_known(probabilities=init_prob , tol=1e-08)

    SWARCH_model = MarkovAutoregression( bcox(ARCH['residuals']) , k_regimes=2, order=0, switching_ar=True, switching_variance=True, switching_exog=False)
    SWARCH = SWARCH_model.fit() 

I get the following error:

MarkovAutoregression.initialize_known(probabilities=init_prob , tol=1e-08)
TypeError: initialize_known() missing 1 required positional argument: 'self'

I have has similar experiences with the method:

MarkovAutoregression.initialize()

On the User Guide, it does not give any inputs to this method so I do not know the syntax needed to initialise an empty model.

Guide:

  1. https://www.statsmodels.org/stable/generated/statsmodels.tsa.regime_switching.markov_autoregression.MarkovAutoregression.initialize_known.html#statsmodels.tsa.regime_switching.markov_autoregression.MarkovAutoregression.initialize_known

  2. https://www.statsmodels.org/stable/generated/statsmodels.tsa.regime_switching.markov_autoregression.MarkovAutoregression.initialize.html#statsmodels.tsa.regime_switching.markov_autoregression.MarkovAutoregression.initialize

Advertisement

Answer

initialize_known is not a class method. You can call it like: SWARCH_model.initialize_known(…)

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement