Tutorials › Exam SRM - Statistics for Risk Modeling › Visual Clues To Nonstationarity

Exam SRM · Time-Series Foundations · Tutorial 407 of 926

Visual Clues To Nonstationarity

Use plots and rolling summaries to identify possible changes in a time series, and distinguish diagnostic evidence from a formal conclusion.

Beginner 10 min read

What You'll Learn

  • Identify changing level, spread, and dependence in a time plot.
  • Calculate and interpret rolling means and rolling sample variances.
  • Compare local lag-one correlations across portions of a series.
  • Understand how window length affects a rolling summary.
  • Explain why visual patterns flag possible nonstationarity but do not prove it.

Why Look for Changes Over Time?

A time series is a sequence of observations recorded in time order. Before fitting a model, it is useful to ask whether the series appears to behave similarly throughout the observation period. A plot can reveal a changing level, changing spread, or changing pattern of dependence that a single overall summary might conceal.

These visual checks are diagnostic, not conclusive. A finite sample from a stationary process can show an apparent trend or an unusual cluster by chance. Conversely, a subtle change may not be obvious in a short or noisy series. The aim is to identify patterns that warrant investigation, not to declare a model property from appearance alone.

Definition: A series is weakly stationary if its mean is constant over time, its variance is finite and constant over time, and the covariance between observations depends only on their time separation (the lag), not on the particular dates. A visual clue to nonstationarity is a pattern that appears inconsistent with one or more of these conditions.

What a Time Plot Can Reveal

A time plot places the observation \(X_t\) against its time index \(t\), preserving the order in which observations occurred. The overall vertical position, the amount of fluctuation around that position, and the way consecutive values move together are all informative.

  • Changing level: the series appears to move from one typical vertical position to another, or to drift upward or downward.
  • Changing spread: fluctuations appear small in one part of the series and substantially larger in another.
  • Changing dependence: consecutive observations appear to follow different patterns in different periods, such as alternating more strongly in one segment and moving in runs in another.

A time plot is often more informative than a histogram of all observations. A histogram discards time order: the same collection of values can arise from a series with a stable pattern or one whose level or spread changes over time. Preserve the order when diagnosing a time series.

Rolling Summaries

Rolling summaries quantify local behavior. Choose a window of \(m\) consecutive observations. For a trailing window ending at time \(t\), the rolling mean is the average of the observations from \(t-m+1\) through \(t\). The rolling sample variance measures their spread around that window's mean.

$$ \bar X_{t,m}=\frac{1}{m}\sum_{j=0}^{m-1}X_{t-j}, \qquad s^2_{t,m}=\frac{1}{m-1}\sum_{j=0}^{m-1}(X_{t-j}-\bar X_{t,m})^2. $$

The rolling mean can flag a changing local level; the rolling sample variance can flag changing local spread. These are descriptive summaries of the observed windows. They are not estimates that automatically establish a change in the underlying process.

Window choice matters. A short window responds quickly to a change but also varies more from one window to the next. A long window smooths random fluctuation, but may blend different regimes and make a real change harder to see. Adjacent rolling windows overlap, so their plotted values are not independent observations. Always inspect the original time plot alongside the summaries.

Worked Example: Detecting a Level Change

A hypothetical insurer records a weekly service count for eight weeks: \(10,12,8,10,20,22,18,20\). Use two four-week windows to assess the apparent level and spread. State what the evidence suggests and what it does not prove.

Method. Calculate each window's mean and sample variance, using \(m-1=3\) in the variance denominator.

Weeks 1–4. The mean is \((10+12+8+10)/4=40/4=10\). The deviations from 10 are \(0,2,-2,0\), whose squared values sum to \(0+4+4+0=8\). Thus the sample variance is \(8/3=2.6667\).

Weeks 5–8. The mean is \((20+22+18+20)/4=80/4=20\). The deviations from 20 are \(0,2,-2,0\), again giving a squared-deviation sum of 8 and sample variance \(8/3=2.6667\).

The two windows have a ten-unit difference in mean and identical sample variances. The time plot would show a marked upward level shift, with similar within-window spread. This is a visual clue that the constant-mean condition may not describe the full series well; it is not proof that the generating process changed.

Common mistake avoided. Pooling all eight observations gives an overall mean of \(120/8=15\). The squared deviations from 15 sum to \(216\), so the pooled sample variance is \(216/7=30.8571\). Treating this large overall variance as evidence of unusually high fluctuation misses the structure: each four-week segment has variance only \(2.6667\), while their means differ. Inspect local summaries as well as pooled ones.

Worked Example: Detecting a Change in Spread

A hypothetical monthly claim count, after centering around a reference level of 10, has the following two four-month segments: \(9,10,11,10\) and \(4,10,16,10\). Compare their means and sample variances.

First segment. Its mean is \((9+10+11+10)/4=40/4=10\). Deviations are \(-1,0,1,0\), so squared deviations sum to \(1+0+1+0=2\). Its sample variance is \(2/3=0.6667\).

Second segment. Its mean is \((4+10+16+10)/4=40/4=10\). Deviations are \(-6,0,6,0\), so squared deviations sum to \(36+0+36+0=72\). Its sample variance is \(72/3=24\).

Both local means are 10, but the second segment has much greater spread: its sample variance is 36 times the first segment's. A time plot would show wider fluctuations in the later segment. This is evidence of changing spread, even though the local levels agree.

Check. The sample standard deviations are \(\sqrt{2/3}\approx0.8165\) and \(\sqrt{24}\approx4.8990\). Squaring these values recovers the variances, confirming the comparison. Rounding is to four decimal places.

Looking for Changing Dependence

A series can have similar local means and spreads while the relationship between neighboring observations changes. In one period, values may tend to alternate; in another, they may tend to remain on the same side of the mean for several observations. A time plot can suggest these patterns, but a local lag-one correlation gives a numerical comparison.

For a short segment, form two paired lists: the earlier observations and the observations one time step later. Their sample correlation describes the linear association between neighbors in that segment. Comparing such correlations across segments can flag changing dependence. With very few pairs, however, each correlation is highly sensitive to individual values.

Worked Example: Comparing Local Dependence

Consider two hypothetical six-observation segments with values centered at zero. The first is \(1,-1,1,-1,1,-1\); the second is \(1,1,1,-1,-1,-1\). Each segment has mean zero and sample variance \(6/5=1.2\). Compare their lag-one sample correlations.

First segment. The earlier-value list is \((1,-1,1,-1,1)\), and the next-value list is \((-1,1,-1,1,-1)\). Each list has mean zero. The sum of paired products is \(-1-1-1-1-1=-5\), and each list's sum of squared deviations is 5. Therefore the sample correlation is \(-5/\sqrt{5\cdot5}=-1\). The observations alternate perfectly.

Second segment. The paired lists are \((1,1,1,-1,-1)\) and \((1,1,-1,-1,-1)\). Their means are \(0.2\) and \(-0.2\). The centered lists are \((0.8,0.8,0.8,-1.2,-1.2)\) and \((1.2,1.2,-0.8,-0.8,-0.8)\). The sum of cross-products is \(0.96+0.96-0.64+0.96+0.96=3.2\). Each centered sum of squares is \(4.8\), so the correlation is \(3.2/\sqrt{4.8\cdot4.8}=3.2/4.8=0.6667\).

The segments have the same mean and sample variance, but their local lag-one correlations differ sharply: \(-1\) versus approximately \(0.6667\). This is a dependence clue. It is not a reliable formal conclusion from only five pairs per segment, and the series should not be called nonstationary solely on this calculation.

Why These Diagnostics Are Relevant

The connection to weak stationarity follows directly from its defining conditions. If the process is weakly stationary, then \(E[X_t]=\mu\) for every \(t\), and \(\operatorname{Var}(X_t)=\gamma(0)\) for every \(t\). Also, for any two times \(t\) and \(t+h\), their covariance is \(\gamma(h)\), which depends on the lag \(h\), not on the location of the pair in the series.

A rolling mean summarizes local observations to look for evidence against a constant mean; a rolling variance summarizes local spread to look for evidence against constant variance. Comparing local dependence patterns asks whether relationships at a fixed lag look similar at different times. These summaries are useful because they correspond to specific conditions, rather than to a vague impression that a graph “looks odd.”

The implication is one-way for diagnosis, not proof: a visible discrepancy can motivate closer analysis, but finite-sample variation can produce discrepancies even when the process is stationary. Likewise, visual similarity across a limited sample does not guarantee stationarity. Formal assessment requires assumptions and methods beyond visual inspection.

Practical Checks and Common Traps

  • Do not discard time order. An overall mean, variance, or histogram can conceal a level or spread change between segments.
  • Do not confuse one unusual observation with a persistent change. Check whether the apparent pattern continues across multiple observations and whether an outlier is driving a rolling summary.
  • Do not treat a chosen window as definitive. Check whether the interpretation changes materially with a reasonable alternative window length.
  • Do not infer stationarity from a flat-looking plot. A short sample may not reveal a change, and dependence is not always visually obvious.
  • Do not call visual evidence a proof. Describe the feature observed—such as increasing spread or a level shift—and state that it suggests a possible violation of a stationarity condition.
Key takeaway: Use the time plot to preserve sequence, rolling means to inspect local level, rolling sample variances to inspect local spread, and local lag correlations to inspect dependence. Treat each as a diagnostic clue, not as a formal proof of nonstationarity.

Check Your Understanding

For each hypothetical series, identify the diagnostic calculation or plot feature and interpret it cautiously.

  1. A weekly portfolio count has two windows, each with four values: \(6,8,10,8\) and \(14,16,18,16\). Find each window mean and say what feature is suggested. (Answer: Means \(8\) and \(16\); a possible level change with equal within-window pattern.)
  2. Two four-week windows of a hypothetical call volume are \(19,20,21,20\) and \(14,20,26,20\). Calculate their sample variances and identify the clue. (Answer: \(2/3\) and \(24\); the later window suggests increased spread.)
  3. A time plot has observations that alternate above and below a stable center early on, then stay above the center for several observations and below it for several more. Which stationarity feature should be investigated? (Answer: Possible change in serial dependence; compare local behavior at a fixed lag, while treating the plot as a clue.)
  4. A series has a steady-looking rolling mean with a window of 20 observations, but a time plot suggests a sharp shift lasting six observations. Explain why the summaries may disagree. (Answer: The 20-observation window can blend the shifted observations with the surrounding values and smooth away a short-lived change; inspect shorter windows and the original plot.)
  5. In a local comparison, the earlier-value list is \((1,-1,1,-1)\) and the next-value list is \((-1,1,-1,1)\). Both have mean zero. Find their sample correlation and state one limitation of the conclusion. (Answer: \(-4/\sqrt{4\cdot4}=-1\); with only four pairs, the result is highly sensitive to individual observations and does not prove changing dependence.)
Clinical Biostats