MerQuR+Statistics Glossary

Statistics Glossary → Time Series

Time Seriesanalysis

A descriptive and testing examination of a single time series before modelling: whether it is stationary, how strongly it depends on its own past and whether it contains seasonality.

Concept

Values measured at regular intervals over time (monthly sales, daily temperature) are not independent of one another: today's value usually resembles yesterday's and the same period last year. A forecasting model built without knowing this dependence structure is misleading. This analysis reveals the 'character' of the series before any model: does it have a trend, a seasonal cycle, and are shocks permanent or temporary?

The autocorrelation function (ACF) shows the correlation of the series with its value k periods earlier; the partial autocorrelation (PACF) shows the correlation that remains once the intermediate lags are accounted for. The Ljung-Box test checks whether the first K autocorrelations are jointly zero. Unit-root tests (ADF, Phillips-Perron) test the null hypothesis that the series is non-stationary, whereas KPSS tests the opposite null that it is stationary; the two kinds of test are read together.

A stationary series has a mean and variance that do not change over time; in a non-stationary series this fails, and differencing (the change from one period to the next) is often needed. The tests have low power in short series, and their results are sensitive to the number of lags and to whether a constant or trend is included. Decisions should therefore rest on the plots and the tests as a whole, not on a single p value.

When to use it

  • Before fitting a model such as ARIMA, exponential smoothing or VAR, to establish stationarity, the need for differencing and the seasonal structure.
  • To check whether autocorrelation remains in a model's residuals (Ljung-Box, ACF).
  • To see the series split into trend, seasonal and remainder components, use STL decomposition; for a non-parametric trend test, use the Mann-Kendall test.

An everyday example

Suppose a city hospital has recorded the number of patients arriving at its emergency department every month for six years (72 months). The plot shows a peak every winter and a trough every summer. A high ACF at lag 12 shows that a month's arrivals resemble those of the same month a year earlier, and the Ljung-Box test says this resemblance cannot be put down to chance. The unit-root and KPSS tests show whether the series' mean stays constant over the years, that is, whether it must be differenced before a forecasting model is fitted.

Parameters in MerQur

Number of ACF/PACF lags (1 to 200; default 20)

Concept: Sets how many periods back the ACF and PACF are computed. The Ljung-Box test also checks whether the autocorrelations up to these lags are jointly zero.

Everyday example: With 24 lags for the monthly emergency arrivals, the plot looks two years back and the yearly repetition appears at both lag 12 and lag 24. With only 6 lags, the yearly cycle would never show in the correlogram.

What it does: The largest lag K shown in the correlogram and the Ljung-Box table.

Effect on the result: The number of rows of ACF, PACF, Bartlett SE and Ljung-Box Q(k); does not change the stationarity tests.

On the validation data: AirPassengers: for K = 10, 20, 40, 100 the table has 10, 20, 40, 100 rows; the values are independent of K (ACF[12] = 0.7604). With K = 100 (n = 144), PACF is computed only up to 71 lags (n/2 - 1).

→ Autocorrelation (ACF) and partial autocorrelation (PACF) functions

Confidence Level (%90 / %95 / %99 / Other (custom))

Concept: Sets the threshold (α = 1 − confidence level) for rejecting the null hypothesis in the tests. The smaller the threshold, the stronger the evidence needed to reach a decision about stationarity or trend.

Everyday example: If the ADF test gives p = 0.03, the series is judged stationary at 95% confidence, but at 99% confidence the decision becomes 'stationarity not shown'. The level should be chosen before looking at the data.

What it does: α = 1 - level; the ADF/KPSS stationarity decision and the linear-trend decision are made with this α. The ACF/PACF significance bound remains ±1.96/√n regardless of the confidence level.

Effect on the result: Only the decision text.

On the validation data: In AirPassengers (ADF p = 0.992, KPSS p < 0.01) the decision did not change at %90, %95, %97.5 and %99; the bound is fixed at 0.1633.

→ Confidence level and confidence interval

ADF specification: constant / constant + trend / none

Concept: The ADF test checks whether the series has a unit root (that is, whether shocks are permanent). Including a constant or a constant plus trend in the regression determines whether the alternative is 'stationary around a fixed mean' or 'stationary around a linear trend'.

Everyday example: If emergency arrivals rise steadily year after year as the city grows, the constant-plus-trend specification is chosen. If arrivals simply fluctuate around a fixed mean, a constant is enough; the wrong specification can change the test's decision.

What it does: The deterministic terms in the unit-root regression (Dickey and Fuller 1979; Said and Dickey 1984).

Effect on the result: The τ statistic, the MacKinnon p value and the critical values.

On the validation data: AirPassengers: constant τ = 0.8154 (p = 0.992); constant + trend τ = -2.1008 (p = 0.546); none τ = 2.3906 (p = 0.997).

→ Deterministic terms (constant, trend)

ADF specification: lag criterion (AIC / BIC / t-stat / fixed lag) and maximum lag

Concept: Sets how many lagged differences are added to the ADF regression to remove autocorrelation from the error term. Too few lags mislead the test and too many reduce its power; AIC or BIC strikes this balance automatically.

Everyday example: If a month's arrivals are strongly related to those twelve months earlier, up to 12 lags may be needed for the ADF test to be valid. So many lags, however, reduce the test's power to reject a unit root in a short 72-month series.

What it does: Selects the number of lagged differences added to remove residual autocorrelation (AIC, BIC, general-to-specific t-stat; Ng and Perron 1995). If the maximum lag is 0, ⌈12(n/100)^¼⌉ is taken.

Effect on the result: The selected lag and τ.

On the validation data: AirPassengers: AIC, BIC and t-stat select the same lag (13); "fixed lag" uses the maximum lag (14) (τ = 0.894). With a maximum lag of 4, τ = -0.9865 (p = 0.758).

→ Lag length selection

KPSS specification: level stationarity / trend stationarity and lags: auto / lags: short / lags: long

Concept: In the KPSS test the null hypothesis is the reverse of ADF's: the series is stationary (around a level or a trend). The lag choice sets how many periods of dependence are taken into account when estimating the series' long-run variance.

Everyday example: If ADF rejects a unit root and KPSS does not reject stationarity, the two tests agree: the arrivals series is stationary. If both reject, or neither does, the result is inconclusive and one looks at the plot and further tests.

What it does: The KPSS test whose null hypothesis is stationarity (Kwiatkowski et al. 1992). The lag is the long-run variance window: auto is Hobijn et al. (2004), short ⌊4(n/100)^¼⌋, long ⌊12(n/100)^¼⌋.

Effect on the result: The KPSS statistic and the p value.

On the validation data: AirPassengers: level + auto 1.6513 (8 lags, p < 0.01); trend + auto 0.0961 (p > 0.10); short 2.7395 (4 lags). goog short: 10.7223.

→ KPSS stationarity test

Frequency / aggregation / missing (frequency: auto, daily, weekly, monthly, quarterly, yearly; mean, sum, last value; drop missing, linear interpolation, previous value (LOCF))

Concept: Time series methods assume equally spaced observations. Irregular records are moved onto a common time grid; how values falling in the same period are combined (sum, mean, last value) depends on the nature of the variable, and the way missing periods are filled affects the autocorrelation.

Everyday example: When daily emergency arrivals are turned into a monthly series, they are summed, because the question is 'how many patients came in the month'; daily temperature, by contrast, is averaged. If one month's record is lost, linear interpolation produces a sensible value from the neighbouring months.

What it does: Resamples the series onto a regular grid; combines those falling into the same period by mean, sum or last value; drops missing periods, or fills them linearly or with the previous value.

Effect on the result: The series length and all results. If the series is shorter than two full periods (n < 2m), seasonal strength is not computed.

On the validation data: hyndsight daily to weekly: n = 53; ADF τ mean 0.044, sum -3.123. presidents (6 missing): drop n = 114 (ACF[1] 0.7636), linear n = 119 (0.7813), previous value n = 119 (0.7736).

Cross-correlation (CCF) series

Concept: Cross-correlation computes the correlation between two series at different lags and gives a hint as to which series leads the other. If both series contain a trend or seasonality, high cross-correlation can appear without any real link between them.

Everyday example: The cross-correlation between monthly mean temperature and emergency arrivals can show whether a cold month raises arrivals in the same month or a month later. But because both carry a strong yearly season, the correlation read without removing the seasonal effect is exaggerated.

What it does: r(k) = cor(x[t+k], y[t]), k = -K..K.

Effect on the result: Only an additional table.

On the validation data: mdeaths-fdeaths r(0) = 0.976, r(1) = 0.736, r(-1) = 0.744.

→ Cross-correlation function (CCF)

Additional output: Phillips-Perron unit-root test, Differencing recommendation (ndiffs / nsdiffs), Autocorrelation-robust trend test (Newey-West), Periodogram (dominant periods)

Concept: Phillips-Perron tests for a unit root like ADF but handles autocorrelation by correcting the statistic rather than adding lags. The differencing suggestion gives how many ordinary and seasonal differences the series needs to become stationary; the Newey-West test checks the significance of a linear slope when autocorrelation is present; and the periodogram reveals the dominant cycle lengths in the series.

Everyday example: If the suggestion for the arrivals series is 'one seasonal difference', each month should be compared with the same month a year earlier. A periodogram whose highest peak is at a 12-month period confirms that the yearly cycle dominates.

What it does: PP Z(τ) and Z(α); the required number of differences (KPSS, α = 0.05) and of seasonal differences (seasonal strength > 0.64); the Newey-West SE of the slope in y = a + b·t; the 5 highest frequencies of the raw periodogram.

Effect on the result: Only additional output.

On the validation data: AirPassengers PP constant Z(τ) = -1.8443 (p = 0.359); ndiffs d = 1, nsdiffs D = 1. Nile slope -2.714 (OLS SE 0.522, HAC SE 0.696). lynx periodogram: periods 9.5, 38, 7.6.

→ Unit root tests (ADF, Phillips-Perron)

Smoothing (MA window / EMA α), centred

Concept: A moving average suppresses short-term fluctuations by averaging the last w observations; a centred moving average introduces no delay (phase shift). An exponential moving average gives more weight to recent observations; the larger α, the more closely it follows the series.

Everyday example: A centred 12-month moving average of emergency arrivals wipes out the seasonal wave, leaving only the overall course over the years. An exponential average with α = 0.3 reflects a rise in recent months more quickly.

What it does: Smooths the series with trailing MA(w), centred MA (2xw for even w) and EMA (s_1 = x_1, α is given). The output includes a table of the last 12 observations and definition notes.

Effect on the result: Only the smoothed series.

On the validation data: AirPassengers: trailing MA(12), centred 2x12 MA and EMA α = 0.3 (e.g. 2x12 MA[7] = 126.7916666667, EMA[144] = 461.7665886331).

→ Moving-average and exponential moving-average smoothing

Spectral window (None (raw periodogram) / Daniell / Daniell (modified) / Bartlett / Tukey-Hanning / Tukey-Hamming / Parzen) and Spectral extras: Cross-spectrum

Concept: The periodogram spreads the series' variance over different frequencies (cycle lengths), but in raw form it is very noisy. A spectral window smooths the density by taking weighted averages of neighbouring frequencies (a trade-off between bias and variance); the cross-spectrum shows at which frequencies two series move together (coherence) and the time shift between them (phase).

Everyday example: In the raw periodogram the arrivals series shows many small random peaks; a Daniell window smooths them and brings out the 12-month and 6-month cycles. The cross-spectrum with temperature may show that the two series are strongly coherent especially at the yearly frequency.

What it does: Window choice for the smoothed periodogram (spectral density), and coherence and phase between two series.

Effect on the result: The density estimate, the equivalent degrees of freedom and the bandwidth.

On the validation data: lh, span 5: the smoothed spectrum is computed in all five windows. Coherence and phase are given for lh and ldeaths.

→ Periodogram and spectral density

Spectral window: None (raw periodogram) and Tukey-Hamming

Concept: The 'None' option uses the periodogram without any smoothing; it is enough to spot dominant periods but unreliable as a density estimate. Tukey-Hamming is a window whose weights decrease in a cosine shape; unlike Hanning, its weights do not fall all the way to zero at the edges.

Everyday example: If the only question is 'which cycles does the arrivals series contain?', the raw periodogram already shows the 12-month peak. If the spectral density itself is to be reported, smoothing it with a window such as Tukey-Hamming is sounder.

What it does: "None" is the default; no smoothed spectrum is computed, and the periodogram output gives dominant periods from the raw periodogram. Tukey-Hamming is a cosine window (w(x) = 0.54 + 0.46 cos(πx); 0.5 + 0.5 cos(πx) for Hanning); the weights are scaled to sum to 1.

Effect on the result: With "None" no window is applied; in the cross-spectrum the coherence is 1 at every frequency. Tukey-Hamming changes the density, the equivalent df and the bandwidth according to the window width.

On the validation data: The raw periodogram (no taper) gives the dominant periods of the lynx series as 9.5, 38 and 7.6. Tukey-Hamming uses the same weight generator as the other windows.

→ Periodogram and spectral density

Spectral extras: White noise test

Concept: White noise is a purely random series with no autocorrelation and constant variance; its periodogram is roughly flat across all frequencies. Fisher's kappa test looks for a single dominant peak, while Bartlett's test looks at how far the cumulative periodogram departs from a straight line.

Everyday example: After a forecasting model is fitted to the arrivals series, the remaining residuals should be white noise. If the test still finds a clear 12-month peak in the residuals, the model has not fully captured the seasonal structure.

What it does: Tests whether the series is white noise using the periodogram.

Effect on the result: Only an additional test.

On the validation data: lh: the Fisher kappa and Bartlett KS white noise tests are given; Bartlett p = 6.93e-5.

→ White noise

Chow break observation

Concept: The Chow test uses an F test to check whether the linear trend (intercept and slope) is the same before and after a stated point. The break point must be fixed in advance from outside information, not by looking for the largest jump in the data.

Everyday example: If the month a new family health centre opened in the city is known, that month is entered as the break point. The test checks whether the trend in emergency arrivals changed after the opening.

What it does: Tests whether there is a structural break after the specified observation in the linear trend y = a + b·t (classical F, Chow 1960).

Effect on the result: Only an additional test.

On the validation data: For the Nile data, the Chow test is computed at break point 29.

→ Chow structural break test

Example on real data

Data: UK lung disease deaths 1974-1979, R datasets mdeaths/fdeaths

Variables: date date (monthly), value mdeaths (male deaths)

  • Question: Are the monthly male lung disease deaths in the UK in 1974-1979 (mdeaths, n = 72) stationary, and do they contain autocorrelation and seasonality?
  • Autocorrelation: ACF[1] = 0.7571, ACF[12] = 0.7171, ACF[6] = -0.6640; the 12-month wave pattern shows strong annual seasonality. Ljung-Box Q(14) = 312.66, p < .001: the series is not white noise.
  • Unit root: ADF (with constant, 12 lags by AIC) τ = -0.2728, p = 0.929; 5% critical value -2.912. The unit root cannot be rejected.
  • Stationarity: KPSS (level, lag 4) = 0.2276, p > 0.10; level stationarity is not rejected. The two tests conflict: ADF has low power with 12 seasonal lags; MerQur gives the decision "not stationary (differencing may be needed)".
  • Additional finding: STL seasonal strength F_S = 0.824 (above the 0.64 threshold, strong seasonality); the trend is decreasing.
  • APA: Ljung-Box Q(14) = 312.66, p < .001; ADF τ = -0.27, p = .93; KPSS = 0.23, p > .10.

Related concepts

Periodogram and spectral densityKPSS stationarity testAutocorrelation (ACF) and partial autocorrelation (PACF) functionsUnit root tests (ADF, Phillips-Perron)Cross-correlation function (CCF)Moving-average and exponential moving-average smoothingWhite noiseStationarity

The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.