1

I am working with a non stationary time series. To make the time series stationary: I removed the rolling mean from the series. Now, when I am predicting how can I incorporate the mean as I don't have seem to have rolling mean for future

from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.statespace.sarimax import SARIMAX

df['station'] = df.data - df.data.rolling(12).mean()

train_st = df.ix[:-24, "station"]
test_st = df.ix[-24:, "station"]

sarima_model = SARIMAX(train_st, order=(0, 1, 2), seasonal_order=(0, 1, 2, 12), enforce_invertibility=False, enforce_stationarity=False)
sarima_fit = sarima_model.fit()

sarima_pred = sarima_fit.get_prediction("1974-01", "1975-12")

Basically I need to add rolling mean to sarima_pred. I dont have any attempt and I am clueless. I have rolling mean for test dataset, but not for future forecast.

James Z
  • 12,209
  • 10
  • 24
  • 44
Alok
  • 13
  • 2

0 Answers0