2
$\begingroup$

How many lags should be used for ACF or PACF displaying if we have $S$ seasonality?

For example,

for 500 observations I have 25 lags
for 200 observations I have 22 lags

It is independent from frequency of seasonality (for $S = 7, 14, 50, 60, ...$ number of lags on the picture is the same). Is it enough for model estimation based on ACF/PACF for high frequencies?

We do not need to show lags for few periods; for example, for $S=50$ at least 170 lags (it contains 3 periods)? Sorry, but available materials show different approaches.

$\endgroup$
4
$\begingroup$

There's no fixed rule. It is a function of the noise in the time-series. I would show at least until no data-point crosses a confidence interval or $\frac{n}{10}$, whichever comes first.

Shown below are realizations of seasonal trend at lag of 7, with white noise $\sim\mathbb N(0,0.1)$ and $\sim\mathbb N(0,0.3)$. The confidence intervals were calculated by $\frac{\text{PPF}(0.99)}{\sqrt{n}}$ assuming the noise is distributed normally.

Small Noise Large Noise EDIT: Here's another plot of lag, with more of the ACF and PACF shown: Small Noise, more plot Here's another plot with a higher period. Small Noise, more plot, higher period

The code used for the figures:

import numpy as np
from scipy import stats
from matplotlib import pyplot as plt
from statsmodels import api as sm


def main():
    prototype = np.random.random(60)
    for _ in xrange(560 / 60):
        prototype = np.concatenate((prototype, np.random.normal(0, 0.1, 60) + prototype[:60]))
    prototype = prototype[60:]
    n = prototype.shape[0]
    pa = sm.tsa.pacf(prototype, 100)
    acf = sm.tsa.acf(prototype, nlags=100)
    plt.figure()
    plt.subplot(4, 1, 1)
    plt.plot(prototype)
    plt.title("Time Series with a Lag of 60, White Noise of .1")
    plt.subplot(4, 1, 2)
    plt.plot(prototype.reshape(-1, 60).T)
    plt.title("Overlapping Windows")
    plt.subplot(4, 1, 3)
    plt.plot(acf)
    z = stats.norm.ppf(0.99)
    c = '#660099'
    plt.axhline(y=z / np.sqrt(n), linestyle='--', color=c)
    plt.axhline(y=-z / np.sqrt(n), linestyle='--', color=c)
    plt.title("ACF")
    plt.subplot(4, 1, 4)
    plt.plot(pa)
    plt.axhline(y=z / np.sqrt(n), linestyle='--', color=c)
    plt.axhline(y=-z / np.sqrt(n), linestyle='--', color=c)
    plt.title("PACF")
    plt.show()


if __name__ == '__main__':
    main()
$\endgroup$
15
  • $\begingroup$ thank you for examples. I understand using of max for axis x =50 for period=7 because of short periodicity. Could you show example with period=60 (or more) in 500-observations time series? It would be very useful. It means at least 200 lags?? $\endgroup$ – KateRin Jan 6 '14 at 22:54
  • $\begingroup$ 25 lags for example 2 would be enough? I have looked on Overlapping Windows plot. It can identify the number of lags? $\endgroup$ – KateRin Jan 6 '14 at 23:00
  • $\begingroup$ I added two more plots and the code used to make the last one. The overlapping windows isn't used to identify the season order. That's just every season period overlaid on itself. If you care about inference, then you show a delicately made model with evidence like the PACF plot. If you care about predictive accuracy, then you just append steps that successively detrend the series. Fitting a seasonal model to the overlapping windows is relevant here. For one such model see: stats.stackexchange.com/questions/71208/… $\endgroup$ – Jessica Collins Jan 7 '14 at 0:25
  • $\begingroup$ Also: Analyzing fake time series sometimes produces weird results because of the random number generator in whatever language you're using. These are based on the Mersenne twister, which occasionally produces very odd results. $\endgroup$ – Jessica Collins Jan 7 '14 at 0:28
  • $\begingroup$ Thank you! It is a little more clear. I have to analyse hyperlinked model. Really, the overlapping windows can be very useful. But first we have to know what periods are in the series. Could you make your script on my data? I have big problem, because I cannot get white noise on residuals. I belived that period in my data is 80, but it is bad. Maybe multiseasons is needed? Could you look on my time serie: stats.stackexchange.com/questions/80710/… ? $\endgroup$ – KateRin Jan 7 '14 at 7:24

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.