1
$\begingroup$

I'd like to compare the results of an LSTM model to an ARIMA model.

How can I create an ARIMA model in python that trains on the first 70% of data (~2700 observations), and then produces forecasts at 10-day intervals for the test data (~1200 observations) where the model sees all the previous data (expanding window) but does not get refit every 10 days? Thanks!

Right now my code refits the model every 10 days:

for t in range(0, len(test), 10):
  model = ARIMA(history, order=(5,1,0))
  model_fit = model.fit(disp=0)
  output = model_fit.forecast(steps=10)
  yhat = output[0]
  print(yhat)

  predictions.append(yhat.values())
  obs = test[t]
  history.append(obs)
$\endgroup$

closed as off-topic by Richard Hardy, Michael Chernick, Siong Thye Goh, Peter Flom May 1 at 10:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Richard Hardy, Michael Chernick, Siong Thye Goh, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ How to do something in Python (or any other language or piece of software) is off topic here. But the statistical aspect of the problem is a valid question. What you could do is estimate the model on the training set, then either (1) save the coefficients and manually construct forecasts by supplying ever newer data or (2) use the estimated model as a filter with some existing Python function. I do not know of such a function, but perhaps filter could be a good keyword in seaching. $\endgroup$ – Richard Hardy Apr 30 at 19:58