Select specific AR lags in statsmodels MarkovAutoregression

57 Views Asked by At

I would like to estimate a Markov Switching model using only the 24th and 25th lag with the MarkovAutoregression function from statsmodels. Setting order=24 seems to include every intermediate lag.

Is there a way to only include only some specific lags (i.e. excluding intermediate lags)?

The python code that I have tried which seems to include every intermediate lag (which fails on my computer due to MemoryError: Unable to allocate 244. GiB for an array with shape (2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 976) and data type float64):

import statsmodels.api as sm
import numpy as np

mod1 = sm.tsa.MarkovAutoregression(
endog = df["PRICE"],
k_regimes=2,
order=24,
trend='c',
switching_ar=True,
switching_variance=True,
switching_trend=[True]
)

np.random.seed(2023)
res1 = mod1.fit(em_iter=400, search_reps=50, maxiter=400)
0

There are 0 best solutions below