Thanks so much for the reading - it took me a few days to get through it and think about. A few things about VAR models make them particularly challenging to adapt to my problem:
- I want the number of lags to be a parameter of the model - I don’t know a priori what this should be. It’s hard to imagine how a function like the one in cell 38 from the notebook you mentioned could handle a varying
n_lags, since the shape of the matrix involved in the convolution depends on this:
def build_VAR(df, n_lags, intercept = True, model_full_cov = True, model_initial_states=True):
# ⮤ this int needs to be passed to the VAR model to be instantiated
- Similarly, I also need a model parameter for which lags to include in the convolution kernel. For example, I’m not just considering a model where (using the AR(1) notation used in your notebook)
y_{t} = \phi_0 + \phi_1Y_{t-1} + \phi_2Y_{t-2},
I also want to allow for
y_{t} = \phi_0 + \phi_4Y_{t-4} + \phi_5Y_{t-5} + \phi_6Y_{t-6}
etc. So what I really need is a way to define a model which lag terms are included is a parameter of the model. These two reasons are what steered me away from using VAR models in the beginning, but maybe there’s a way to get them to work for my system that I just haven’t understood here.
I’ll try fixing my set_subtensor use, and I’ll need to be more careful about edge effects where my data is missing. I’ll post an update if I can make progress on this. Thanks again for the advice!