Tutorials › Exam SRM - Statistics for Risk Modeling › Diagnosing Nonstationarity in Forecasting Series

Exam SRM · Time-Series Forecasting Cases · Tutorial 882 of 926

Diagnosing Nonstationarity in Forecasting Series

Use complementary time-series diagnostics to identify evidence of nonstationarity without treating any single pattern as conclusive.

Advanced 11 min read

What You'll Learn

  • Define weak stationarity and identify changes in a series’ level or variability
  • Use rolling means and rolling variances to reveal local changes over time
  • Calculate sample autocorrelations using a consistent denominator
  • Recognize how trends and seasonal repetition appear in time plots and ACFs
  • Combine diagnostics while accounting for short samples and misleading summaries
  • Avoid confusing recurring seasonal behavior with a stable series

Why Diagnose a Series Before Forecasting?

A forecasting series is ordered in time, so its sequence of values matters—not just its overall mean or variance. A series can have an unchanging overall average while its level rises, falls, or repeats a seasonal pattern. A histogram or a single summary calculated across the full sample can hide those changes. Before selecting a forecasting model, examine how the observations behave across time.

This tutorial develops three complementary diagnostics: the time plot, rolling summaries, and the sample autocorrelation function (ACF). They help identify evidence of changing levels, trends, seasonal repetition, or changing variability. They do not, by themselves, prove a particular data-generating mechanism or determine the forecasting model.

Definition: A time series \(y_1,\ldots,y_n\) is weakly stationary if its mean is constant over time, its variance is finite and constant over time, and its autocovariance between \(y_t\) and \(y_{t-k}\) depends only on the lag \(k\), not on the time \(t\). A series that violates one or more of these conditions is nonstationary in the corresponding respect.

In practice, a plot that shows a sustained rise suggests a changing level, while repeated peaks at a fixed interval suggest seasonal behavior. A changing spread can suggest nonconstant variance. These are clues, not formal proof: a short series, outliers, or random variation can make a stationary series look irregular or a nonstationary series look deceptively stable.

Three Complementary Diagnostics

A time plot displays each observation against its time index, preserving the order needed to see long-run movement and recurring patterns. Label the time axis and use equal spacing when observations are equally spaced. For irregularly spaced observations, the horizontal spacing should reflect the actual elapsed time; otherwise, apparent patterns can be misleading.

A rolling mean summarizes consecutive observations within a window of fixed length \(m\). One convention for the rolling mean ending at time \(t\) is:

$$ \bar{y}_{t,m}=\frac{1}{m}\sum_{j=0}^{m-1} y_{t-j}. $$

This convention uses observations \(y_{t-m+1},\ldots,y_t\) and is defined when \(m\leq t\leq n\). A rolling mean that moves steadily upward is evidence of changing local levels, although the window smooths the data and can lag behind an actual change. A different window length may reveal or obscure a pattern.

A rolling variance measures local spread. For a window of \(m\) observations ending at time \(t\), first calculate that window’s mean \(\bar{y}_{t,m}\), then calculate:

$$ s^2_{t,m}=\frac{1}{m-1}\sum_{j=0}^{m-1}\left(y_{t-j}-\bar{y}_{t,m}\right)^2,\qquad m>1. $$

The variance can rise or fall even when the local mean is stable. Rolling summaries depend on the chosen window, so they should be interpreted alongside the original time plot rather than as replacements for it.

The sample ACF summarizes linear association between observations separated by a given lag. Use the following convention throughout this tutorial:

$$ \widehat{\rho}_k= \frac{\displaystyle\sum_{t=k+1}^{n}(y_t-\bar{y})(y_{t-k}-\bar{y})} {\displaystyle\sum_{t=1}^{n}(y_t-\bar{y})^2}, \qquad \bar{y}=\frac{1}{n}\sum_{t=1}^{n}y_t. $$

The numerator has \(n-k\) paired products, but the denominator contains the squared deviations of all \(n\) observations. A slowly decaying sequence of positive sample autocorrelations can accompany a sustained trend or other persistent movement. A recurring peak at a seasonal lag can support a seasonal interpretation. Neither pattern uniquely identifies the cause: nonstationarity can itself produce large sample autocorrelations.

Why the ACF Uses Lagged Products

For a weakly stationary series, the theoretical autocovariance at lag \(k\) is \(\gamma_k=\operatorname{Cov}(y_t,y_{t-k})\), which does not depend on \(t\). Its autocorrelation is \(\rho_k=\gamma_k/\gamma_0\), where \(\gamma_0\) is the variance. The sample ACF estimates this standardized relationship by replacing the mean with the sample mean and aggregating the observed lagged products.

1
Center the series.
Subtract \(\bar{y}\) from each observation so the products describe departures from the sample’s overall level.
2
Pair observations at lag \(k\).
For each \(t=k+1,\ldots,n\), multiply the centered value at time \(t\) by the centered value \(k\) periods earlier.
3
Scale by overall variation.
Divide the sum of lagged products by the total sum of squared centered observations, giving the stated sample ACF convention.

The logic is that covariance is an average product of centered deviations, and autocorrelation standardizes covariance by variance. In the sample formula, the common averaging factor \(1/n\) cancels between the estimated covariance and variance, yielding the ratio shown above. This ratio is a diagnostic summary; it does not make a stationarity assumption true.

Worked Diagnostics

Worked Example: Detecting a Level Change

A hypothetical insurer records a monthly service index over eight months: \(4,4,4,4,10,10,10,10\). Calculate the overall mean, the four-observation rolling means, and the sample ACF at lag 1. What pattern should be flagged?

Method and mean. Add all eight values: \(4+4+4+4+10+10+10+10=56\). Thus \(\bar{y}=56/8=7\). The centered series is \(-3,-3,-3,-3,3,3,3,3\).

Rolling means. The five consecutive windows of length four have means \((4+4+4+4)/4=4\), \((4+4+4+10)/4=5.5\), \((4+4+10+10)/4=7\), \((4+10+10+10)/4=8.5\), and \((10+10+10+10)/4=10\). The rolling mean rises across the transition.

Lag-1 ACF. The denominator is \(8(3^2)=72\). The seven lag-1 products consist of three products \(9\) within the first block, one boundary product \((-3)(3)=-9\), and three products \(9\) within the second block. The numerator is \(3(9)-9+3(9)=45\). Therefore \(\widehat{\rho}_1=45/72=0.625\).

Interpretation and check. The plot and rolling means indicate a level change from 4 to 10; the positive lag-1 ACF is consistent with adjacent observations being similar. The overall mean of 7 conceals that change. The calculation avoids treating one overall average as evidence of a stable level. The denominator check is \(4(9)+4(9)=72\), as required by all eight centered observations.

Worked Example: Recognizing a Trend

A hypothetical quarterly exposure index is \(2,4,6,8,10,12,14,16\). Calculate the four-observation rolling means and the sample lag-1 ACF. What does the sequence suggest?

Method and centering. The sum is 72, so \(\bar{y}=72/8=9\). The centered observations are \(-7,-5,-3,-1,1,3,5,7\).

Rolling means. The five windows of length four have means \(5,7,9,11,13\), respectively. For instance, the first is \((2+4+6+8)/4=5\), and the last is \((10+12+14+16)/4=13\). The sequence of rolling means increases by 2 each window.

Lag-1 ACF. The denominator is \(49+25+9+1+1+9+25+49=168\). The seven lag-1 products are \(35,15,3,-1,3,15,35\), which sum to 105. Therefore \(\widehat{\rho}_1=105/168=0.625\).

Interpretation and check. The time plot and increasing rolling means indicate an upward trend in the observed level. A positive lag-1 ACF is compatible with the gradual movement, but it is not proof of a particular model. The check \(105/168=5/8=0.625\) confirms the ratio. The common mistake avoided here is treating a positive ACF alone as a diagnosis; the time-ordered increase supplies essential context.

Worked Example: Detecting Seasonal Repetition

A hypothetical quarterly claims index over three years is \(40,50,60,50\) repeated three times. Calculate the overall mean, four-quarter rolling means, and sample ACFs at lags 1 and 4. What pattern is suggested?

Method and centering. Each four-quarter block sums to \(40+50+60+50=200\). Across three blocks, the total is 600, so the mean is \(600/12=50\). The centered values are \(-10,0,10,0\), repeated three times.

Four-quarter rolling means. Every consecutive four observations contain one complete cycle, including windows that cross from one year to the next. Each such window sums to 200, so all nine rolling means equal \(200/4=50\). Thus a constant four-quarter rolling mean does not rule out seasonal movement within the year.

Lag 1. The denominator is \(3(10^2+0^2+10^2+0^2)=600\). Every adjacent product is zero: each nonzero centered value is adjacent only to zeros. The numerator is therefore 0, and \(\widehat{\rho}_1=0/600=0\).

Lag 4. There are eight lag-4 products, pairing each observation from the second year onward with the observation four quarters earlier. The first eight centered values are \(-10,0,10,0,-10,0,10,0\). Their squared values sum to \(100+0+100+0+100+0+100+0=400\), so the lag-4 numerator is 400. Therefore \(\widehat{\rho}_4=400/600=2/3\).

Interpretation and check. The repeated within-year peak and the positive lag-4 ACF support a period-four seasonal pattern. The zero lag-1 ACF does not contradict that pattern. The denominator is 600, not a sum over only the eight lagged pairs; using all 12 squared centered values is essential.

Combining Evidence and Avoiding Traps

The most defensible diagnosis combines the three views. A time plot shows the sequence directly; rolling means or variances make gradual changes easier to see; and the ACF summarizes dependence at selected lags. Interpret all of them in context, including the observation frequency and the length of the record.

  • Do not infer a stable level from a stable overall mean. A series with an early low block and a later high block can have a single mean between the two levels.
  • Do not infer no seasonality from a flat rolling average. A window covering one full seasonal cycle can average out the recurring within-cycle variation.
  • Do not truncate the ACF denominator. With the convention used here, the lag-\(k\) numerator has \(n-k\) products, while the denominator always sums over all \(n\) observations.
  • Do not call every high-lag pattern seasonal. A trend or other persistent movement can also produce substantial autocorrelation. Look for a repeated interval in the time plot and corresponding behavior at the relevant lag.
  • Do not treat a diagnostic as proof. Short samples and unusual observations can distort plots, rolling summaries, and sample ACF values. State what the evidence suggests, not more than it establishes.

A suitable exam response names the observed feature, cites the diagnostic evidence, and states the limitation. For example: “The time plot and rising rolling means suggest a changing level; positive autocorrelation is consistent with persistent movement, but these summaries alone do not identify its cause.” This evidence-based interpretation is aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus.

Check Your Understanding

For each series, use the stated diagnostics and distinguish evidence of changing level, trend, or seasonal repetition.

  1. A monthly index is \(4,4,4,4,10,10,10,10\). What are its five four-observation rolling means, and what feature should a time plot reveal? (Answer: Rolling means \(4,5.5,7,8.5,10\); a shift from a lower level to a higher level.)
  2. A series is \(3,5,7,9,11\). Calculate its mean and sample lag-1 ACF using the stated convention, then describe the pattern. (Answer: Mean \(7\); denominator \(40\), numerator \(16\), so \(\widehat{\rho}_1=0.4\); the time plot shows an increasing trend.)
  3. A quarterly series is \(5,7,5,7,5,7,5,7\). What repeating pattern is visible, and calculate the sample ACFs at lags 1 and 2. (Answer: Period-2 repetition; \(\widehat{\rho}_1=-7/8=-0.875\) and \(\widehat{\rho}_2=6/8=0.75\).)
  4. A quarterly index is \(20,25,30,25\), repeated three times. Find the four-quarter rolling mean and sample ACF at lag 4. (Answer: Every four-quarter rolling mean is \(25\); the denominator is \(150\), the lag-4 numerator is \(100\), and \(\widehat{\rho}_4=2/3\), supporting a period-four pattern.)
  5. A monthly index is observed for four years. In each year, the 12 monthly values consist of the three repetitions of that year’s four-month pattern: \(b,b+10,b+20,b+10\), where \(b=60,65,70,75\) in years 1 through 4. What are the four annual means, and what two features should be noted? (Answer: Annual means \(70,75,80,85\); the rising means indicate a changing level, while the repeated third-month peak indicates seasonal behavior.)
Clinical Biostats