I am using shampoo sales dataset which can be obtained from github. I fit the dataset using ARIMA$(5,1,0)$ and plot its residuals. The following are residual plots, acf and pacf.

enter image description here

enter image description here

enter image description here

Question How to interpret the few large spikes at pacf plot?

I notice that the acf plot seems quite nice, that is, the residuals are uncorrelated, which is desirable.

But I cannot make sense of the few large spikes at pacf. It would be good if someone can explain to me the existence of those few large spikes.


The residuals from your model enter image description here are not random as one can "see" a change in the mean possibly at year 2 period 4 effectively identifying the need for deterministic structure of some form . This data set requires a hybrid model containing memory (ARIMA) and deterministic structure. I will present the "logic" in identifying this model. Following this discussion Seeking certain type of ARIMA explanation and this paradigm https://autobox.com/pdfs/ARIMA%20FLOW%20CHART.pdf and schemes to identify deterministic structure here http://docplayer.net/12080848-Outliers-level-shifts-and-variance-changes-in-time-series.html. Your data has been studied here https://www.kaggle.com/dromosys/shampoo-sales and here https://books.google.com/books?id=S4wwDwAAQBAJ&pg=PA367&lpg=PA367&dq=shampoo+data+set&source=bl&ots=bV2ddJq_Hk&sig=ACfU3U3wPaDdTODGvGsYo-mkTxphnM-zxA&hl=en&sa=X&ved=2ahUKEwj18Ni2nMjjAhXvs1kKHcwcCq4Q6AEwCXoECAoQAQ#v=onepage&q=shampoo%20data%20set&f=false and here https://machinelearningmastery.com/persistence-time-series-forecasting-with-python/.

Here is a set of residuals of a useful model suggesting not only memory but determinstic structure enter image description here with an ACF here enter image description here with Actual/Fit and Forecast here enter image description here . Two very obvious visual trends in the data trends in the data periods 1-15 (1/1 - 2/3) and periods 16-36 (2/4 -3/12)are discovered/identified and incorporated into the model.

Model identification is not simply done by fitting a trial set of models but rather in an iterative self-checking way validating the Gaussian assumptions of randomness. The initial data's ACF and PACF is here enter image description here and here enter image description here suggesting some sort of possibly complicated model.

An initial model ( a trial balloon ! ) of (1,0,0) results in enter image description here with a residual ACF & PACF here enter image description here and residual plot (trending) here enter image description here

Following Tsay's suggested approach we identify enter image description here the need for two time trends ( one starting at year 2 period 4 )and one pulse indicator suggesting the need to add three dummy series to our model enter image description here

Final analysis suggests this hybrid model enter image description here with the following statistics enter image description here and ACF/PACF hereenter image description here

You say your residuals are uncorrelated , I say the variance of your residuals is bloated by a mean shift ( year 2 period 4) leading to a downwards estimate of the acf .. This is commonly referred to as the "Alice in Wonderland Effect" How to determine order of sarima? . While the series is non-stationary, differencing is the wrong remedy in this case.

Finally the unusual spikes at the end are a resultant of estimating toooooo many ACF VALUES . You have 36 observations and you fit a model that implied that the first 6 errors are zero (5,1,0) thus you effectively have 30 non-zero residuals. Estimating auto-correlations up to lag 34 is not suggested thus numerical non-sense.

Note that a level shift in a first difference model is functionally a time trend in the undifferenced data. The impact of visual hint (level shift/mean shift in the OP's residuals) in the first paragraph of this response is now clearer.

  • $\begingroup$ Thanks for your detailed explanations. May I ask a stupid question here? In Python's statsmodels, how does ARIMA forecast value? It seems to me that it uses linear filter. But I am not familiar with linear filter. In particular, how are $\epsilon_t$ terms calculated? $\endgroup$ – Idonknow Jul 22 at 12:31
  • $\begingroup$ For your model (5,1,0) .it is a 6 period weighted average .. thus the forecast(fit) for period 7 can be computed based upon observations 1-6 .then an error cane be computed for period 7 .. Now one can forecast/fit the 8th period by getting a weighted average based upon observations 2-7 ...etc . The weights that are used ( 6 of them ) are based upon the 5 autoregressive parameters that get estimated. The term linear fiter is just a word to characterize the conversion of actuals to fit and error via the estimated parameters. $\endgroup$ – IrishStat Jul 22 at 13:26
  • $\begingroup$ May I know where can I find detailed explanations of Python's ARIMA model? I find it a bit like black box as statsmodel's documentation does not give much information. $\endgroup$ – Idonknow Jul 22 at 13:29
  • $\begingroup$ I can not help you with that $\endgroup$ – IrishStat Jul 22 at 13:32
  • $\begingroup$ I see. Thanks for replying. Since I am new to forecasting, could you suggest some theoretical books so that I can brush up my foundation. I have a PhD in Mathematics, particularly functional analysis. I found Brockwell and Davis 2 books, Theory and Method and Introduction to Time Series and Forecasting illuminating. I am looking forward to books of similar mathematical rigours and levels. $\endgroup$ – Idonknow Jul 22 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.