A way to do autoregressive forecast using ARIMA

25 Views Asked by At

I have an ARMAX model trained on a train dataset as follows:

train_size = len(y) - 50
train_y, test_y = y['ObservedValue'][:train_size], y['ObservedValue'][train_size:]
train_x, test_x = x['ObservedValue'][:train_size], x['ObservedValue'][train_size:]

# Fit ARMAX model on the training set
model = SARIMAX(train_y, exog=train_x, order=order)
results = model.fit()

My case is as follows: For the last 50 observations of my dataset i suppose I have the exogenous variable foe each time step by I am able to get the y variable for time step t with one lag delay.
What I mean is my testing should be something like:

  • I am at time-step t
  • I want to predict y(t+1)
  • I have the exogenous variable at t, e(t)
  • The value of y(t) will be available at t+1 (one lag delay) so right now i have y(t-1).

From the information above I can and should use y(t-1) to predict y(t+1).
However, stats model arima only provides:

results.get_prediction(start = .., end = .., exog = test_x)

Which I suppose uses previous predictions from test set to predict forthcoming values.
How can i Integrate y(t-1) in this approach?

0

There are 0 best solutions below