1
$\begingroup$

I'm trying to use the ARIMA predict function to predict on any test sample--this could include both in sample and out of sample data points, however the frequency will be fixed and equal to the frequency of the date_time index of the train sample.

When I predict/forecast on out of sample dates that is consecutive to the train dataset (e.g. set the 'start' parameter to the day following the last day of the train dataset), then the code runs and produces a prediction that is equal to the forecast function. The code below works!

model = ARIMA(y_train, order=(3,1,4))
model_fit = model.fit(disp=0)
predictions = model_fit.predict(start=y_test.index.min(), end=y_test.index.max(), typ='levels')

However, when I try to do in sample predictions by setting the 'start' parameter to the first date in the train sample, and setting the 'end' parameter to the last date in the train sample (see code below), I get the following error.

predictions = model_fit.predict(start=y_train.index.min(), end=y_train.index.max(), typ='levels')

error

The Timestamp in the error is the start date in my train sample. I am simply trying to get in sample predictions (similar to getting the fitted values, except I want to do it using the predict function), however I'm not sure why the Timestamp would cause an error, since it worked previously with the test sample.

$\endgroup$

1 Answer 1

2
$\begingroup$

I figured it out--turns out that you can't predict on the first date of the train dataset because the start index of the original series had been differenced away. You can add one frequency to the current 'start' parameter instead.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.