from matplotlib import pyplot as plt import pandas as pd import statsmodelstsaarimaprocess as arima from statsmodelsgraphicstsaplots import plotacf plotpacf from statsmodelstsastattools import adfuller nprandomseed2 Set coefficients arcoefs 1 05 02 macoefs 1 Generate data y arimaarmageneratesamplearcoefs macoefs nsample100 scale05 pltploty pltylabelryt pltxlabelrt Test for Stationarity result adfullery autolagAIC printfADF Statistic result0 printfnlags result1 printfpvalue result1 for key value in result4items printCritial Values printf key value fig ax1 ax2 pltsubplots1 2figsize166 dpi 80 plotacfy axax1 lags50 plotpacfy axax2 lags20 Decorate lighten the borders ax1spinestopsetalpha3 ax2spinestopsetalpha3 ax1spinesbottomsetalpha3 ax2spinesbottomsetalpha3 ax1spinesrightsetalpha3 ax2spinesrightsetalpha3 ax1spinesleftsetalpha3 ax2spinesleftsetalpha3 font size of tick labels ax1tickparamsaxisboth labelsize12 ax2tickparamsaxisboth labelsize12 pltshow