beyond_inifinity
beyond_inifinity

Reputation: 453

Any way to forecast time series data using ARIMA model in python?

I tried to forecast target_price_index using ARIMA model which is a good choice for forecasting time series. My data is monthly time series, I want to forecast target_price_index from data. I've worked with scikit-learn for prediction tasks, but not much knows about using ARIMA model on time series. To do so, I tried as follow:

my attempt

Here is the reproducible time-series data that I used example data and reproducible time series data on gist

from statsmodels.tsa.arima_model import ARIMA
from matplotlib import pyplot
import pandas as pd

df = pd.read_csv("finaldf.csv", sep="\t")
model = ARIMA(df['target_price_index'], order=(5,1,0))
model_fit = model.fit(disp=0)
print(model_fit.summary())
# plot residual errors
residuals = DataFrame(model_fit.resid)
residuals.plot()
pyplot.show()
residuals.plot(kind='kde')
pyplot.show()
print(residuals.describe())

but the output of the above attempt is not really satisfying because I can't see any benefits of forecasting on my time series data. Can anyone point me out is there any efficient pipeline or analytical approach to get meaningful prediction results? Any suggestion? Any possible thoughts on this? Thanks!

I also tried this post in SO still not working for forecasting my time series data correctly. Does anyone have possible thoughts? Thanks!

Upvotes: 0

Views: 337

Answers (1)

Nancy Kecso
Nancy Kecso

Reputation: 9

I found a couple of problems with the code:

  1. The csv file uses tabs as a separator:

    df = pd.read_csv("finaldf.csv",sep='\t')
    
  2. When you instantiate the ARIMA model, the first parameter should be your target:

    model = ARIMA(df.target_prc_index,order=(5,1,0))
    

Upvotes: 0

Related Questions