0

I have a Vector Autoregression (VAR) model in StatsModels with three time series variables used to forecast future values. I would like to add an extra predictor to the model, without forecasting it as part of the model output, and using its current value rather than lagged values.

The context is that this variable is a leading indicator for the time series variables, so the desired outcome would be to model x, y, z as a function of their past values and the current value of this leading indicator.

Would this addition be possible using a StatsModels VAR or need I look elsewhere?

The code below shows the relevant code used to set the current basic model up.

# nobs is the number of periods into the future to forecast
nobs = 1

# load the data
data = pd.read_csv('Data/data-merged.csv', index_col=0)
# x, y, z are each a time series
data = data[['x', 'y', 'z']]
train, test = train_test_split(data, train_size=0.8, shuffle=False)

###
# code here runs tests on the data and finds the best_order
###

# fit VAR model
var = VAR(endog=train.values)
var_result = var.fit(maxlags=best_order)

###
# code here tests the model results on the test data
###
4

0 回答 0