ARIMA model in Python

timeseries

#1

Hi, I would like some guidance with using ARIMA models (statsmodel library) in Python

I have a time series which is not stationary but can be considered stationary after taking the log10 transformation and 1st order differencing.

My question is, which series should I pass to ARIMA() when building the model?

ARIMA(ts)
ARIMA(ts_log)
ARIMA(ts_log_diff)

Thank you!

I’m referring to this post - https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/


#2

Hey
Let’s understand how ARIMA works. So consider you have non stationary time series dataset ts. Your next step is to make it stationary. So you take log and first difference and finds it to be stationary. So ‘d’ parameter which signifies differencing will be 1.
So if you choose ARIMA(ts) with d=1, log transformation will not be considered and if you use ARIMA(ts) with d=0, you are implementing ARIMA on non stationary dataset(original ts).
Similarly if you choose ARIMA(ts_log) with d=1, you are implementing on differenced version of log(ts) which is what we need but if you use ARIMA(ts_log) with d=0, you are implementing it on logged ts which is non stationary.
If you use ARIMA(ts_log_diff) with d=1, we are implementing ARIMA on doubly differenced dataset because d=1 will automatically difference the series, but the series is already differenced. So if you want to use ARIMA(ts_log_diff), keep d=0.

So make sure you are understanding the logic and maths behind it. Also when you get the predictions, you have to scale them back to original dataset.

Cheers