Forecasting number of passengers for airlines using ARIMA model in python. You can view the project demo on YouTube.
Project was Time Series Analysis, used ARIMA method to build the model. Major steps involved were as follow :
- STEP: 1 - Data Cleaning and Analysis
- STEP: 2 - Checking Stationarity (ADF Test)
- STEP: 3 - Transformation
- STEP: 4 - Differencing
- STEP: 5 - Time Series Components
- STEP: 6 - Finding ACF and PACF
- STEP: 7 - ARIMA Modeling
- STEP: 8 - Forecast
The entire demo of the project can be found on YouTube.
- Python
- Advanced Excel
- ARIMA
- Augmented Dickey-Fuller Test
- ACF and PACF
- Statsmodels
# Code for Augemneted Dickey-Fuller Test and Rolling Mean to check stationarity
def stationarity(timeseries):
rolmean=timeseries.rolling(window=12).mean()
rolstd=timeseries.rolling(window=12).std()
plt.figure(figsize=(20,10))
actual=plt.plot(timeseries, color='red', label='Actual')
mean_6=plt.plot(rolmean, color='green', label='Rolling Mean')
std_6=plt.plot(rolstd, color='black', label='Rolling Std')
plt.legend(loc='best')
plt.title('Rolling Mean & Standard Deviation')
plt.show(block=False)
print('Dickey-Fuller Test: ')
dftest=adfuller(timeseries['Passengers'], autolag='AIC')
dfoutput=pd.Series(dftest[0:4], index=['Test Statistic','p-value','Lags Used','No. of Obs'])
for key,value in dftest[4].items():
dfoutput['Critical Value (%s)'%key] = value
print(dfoutput)
Project is: finished.
If you loved what you read here and feel like we can collaborate to produce some exciting stuff, or if you just want to shoot a question, please feel free to connect with me on email or LinkedIn
- Edureka