Tutorials › Generalized Linear Mixed Models (GLMM) › Seasonal and Periodic Temporal Covariance

Spatial and Temporal Correlation · Tutorial 593 of 698

Seasonal and Periodic Temporal Covariance

Specify periodic latent temporal covariance models, calculate their lag correlations, and assess when recurring dependence is a reasonable alternative to monotone time decay.

Advanced 10 min read

What You'll Learn

  • Define exact periodic and damped periodic temporal covariance functions.
  • Calculate latent correlations at seasonal, half-seasonal, and irregular lags.
  • Check covariance validity and understand the consequences of exact recurrence.
  • Distinguish periodic dependence from monotone exponential decay.
  • Recognize assumptions, diagnostics, and limitations of seasonal covariance models.

Why Model Seasonal Dependence?

Temporal dependence need not fade steadily as observations get farther apart. Measurements taken in the same season in successive years may be more alike than measurements separated by only a few months. A covariance model that decreases monotonically with lag, such as the exponential covariance associated with a continuous-time Ornstein–Uhlenbeck process, cannot express this recurring pattern by itself.

In a GLMM, a temporal covariance function can describe dependence in a latent Gaussian effect included in the linear predictor. It describes how the latent effect varies over time; it does not, by itself, specify a seasonal pattern in the expected response. A deterministic seasonal pattern in the mean and recurring covariance in a latent effect are distinct modeling choices.

Definition: A zero-mean temporal process \(u(t)\) is stationary in covariance if its variance is constant and its covariance between two times depends only on their lag \(h=t-s\). Its covariance function is \(C(h)=\operatorname{Cov}\{u(t),u(t+h)\}\), and, when \(C(0)>0\), its correlation function is \(\rho(h)=C(h)/C(0)\). A covariance function is valid if it produces a positive semidefinite covariance matrix for every finite set of observation times.

For a latent Gaussian effect in a GLMM, one common specification is

$$ \eta_i = \mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}+u(t_i), \qquad \mathbf{u}\sim N(\mathbf{0},\boldsymbol{\Sigma}), \qquad \Sigma_{ij}=C(t_i-t_j). $$

Here \(\eta_i\) is the linear predictor for observation \(i\), and \(\boldsymbol{\Sigma}\) must be a valid covariance matrix. The temporal effect is assumed to have mean zero, and the stationary covariance specification assumes the same dependence at any pair of times separated by the same lag. If observations are clustered in different subjects or locations, the intended scope of this temporal covariance must also be stated; this tutorial considers one temporal process, not a full space-time structure.

Exact Periodicity and Damped Recurrence

Let \(P>0\) denote a period, measured in the same time units as \(h\). Exact periodicity means that the covariance repeats without weakening as the lag increases by a whole period: \(C(h+P)=C(h)\). A simple valid covariance is

$$ C_{\mathrm{cos}}(h)=\sigma_u^2\cos\left(\frac{2\pi h}{P}\right), \qquad \rho_{\mathrm{cos}}(h)=\cos\left(\frac{2\pi h}{P}\right), $$

where \(\sigma_u^2>0\) is the latent-effect variance. This covariance is valid because, for any times \(t_i,t_j\), its correlation entry can be written as \(\cos(\omega(t_i-t_j))=\cos(\omega t_i)\cos(\omega t_j)+\sin(\omega t_i)\sin(\omega t_j)\), where \(\omega=2\pi/P\). Thus its covariance matrix is the sum of two positive semidefinite outer-product matrices, multiplied by \(\sigma_u^2\). It is nevertheless a restrictive model: the matrix has rank at most two, and observations exactly one period apart have correlation one. It represents a perfectly repeating latent trajectory, not a seasonal pattern that gradually loses strength.

A damped cosine allows recurrence to weaken over time:

$$ C_{\mathrm{dc}}(h)=\sigma_u^2\exp(-\phi|h|) \cos\left(\frac{2\pi h}{P}\right), \qquad \rho_{\mathrm{dc}}(h)=\exp(-\phi|h|) \cos\left(\frac{2\pi h}{P}\right), \qquad \phi>0. $$

The cosine produces the repeating peaks and troughs; the exponential envelope reduces their magnitude as \(|h|\) grows. The parameter \(\phi\) has inverse-time units. At a full-period lag \(P\), the correlation is \(\exp(-\phi P)\), not one. At a half-period lag \(P/2\), it is \(-\exp(-\phi P/2)\).

Justification of validity: The exponential covariance \(\exp(-\phi|h|)\) is positive definite, as is the cosine covariance \(\cos(2\pi h/P)\). For any finite time set, the entry-by-entry product of two positive semidefinite matrices is positive semidefinite (the Schur product theorem). Their product, multiplied by \(\sigma_u^2>0\), therefore gives a valid covariance matrix. When \(\phi>0\), the damped cosine also has a strictly positive spectral density, so observations at distinct times have a nonsingular covariance matrix.

Another useful exact-periodic option is the periodic squared-exponential covariance:

$$ C_{\mathrm{per}}(h)=\sigma_u^2 \exp\left\{-\frac{2\sin^2(\pi h/P)}{\ell^2}\right\}, \qquad \ell>0. $$

The dimensionless parameter \(\ell\) controls how quickly correlation falls as times move apart in phase within a period. This is exactly periodic because \(\sin^2\{\pi(h+P)/P\}=\sin^2(\pi h/P)\). Its validity follows from the Fourier expansion of \(\exp\{\kappa\cos(\theta)\}\), whose cosine-series coefficients are nonnegative for \(\kappa>0\); setting \(\kappa=1/\ell^2\) gives a nonnegative weighted sum of valid cosine covariance functions. Like the pure cosine, this exact-periodic covariance gives correlation one at every whole-period lag.

Worked Example: Correlations Under Exact Periodicity

Suppose a hypothetical latent effect has annual period \(P=12\) months and uses the periodic squared-exponential covariance with \(\ell=2\). Calculate the correlations at lags 3, 6, and 12 months.

At lag \(h=3\), \(\sin(\pi h/P)=\sin(\pi/4)\), whose square is \(1/2\). Therefore

$$ \rho_{\mathrm{per}}(3) =\exp\left\{-\frac{2(1/2)}{2^2}\right\} =\exp(-0.25) =0.7788. $$

At \(h=6\), \(\sin(\pi/2)=1\), so \(\rho_{\mathrm{per}}(6)=\exp\{-2/4\}=\exp(-0.5)=0.6065\). At \(h=12\), \(\sin(\pi)=0\), so \(\rho_{\mathrm{per}}(12)=\exp(0)=1\). The latent effects are moderately correlated at a three-month separation, less correlated at a six-month separation, and perfectly correlated one year apart under this exact-periodic model. That last implication is substantive, not a harmless mathematical detail.

Calculating Damped Seasonal Correlations

For the damped cosine, calculate the lag in the chosen time unit, evaluate the exponential envelope, and then multiply by the cosine. The sign matters: a negative correlation at some lags is a permitted feature of this model, not an invalid covariance. The decay parameter and period should be interpreted jointly, since the correlation at a seasonal recurrence is determined by both.

Worked Example: Correlation at Seasonal and Half-Seasonal Lags

Consider a hypothetical monthly latent effect with \(\sigma_u^2=0.64\), \(\phi=0.08\) per month, and \(P=12\) months. Calculate the latent correlations at 6 and 12 months.

At six months, the cosine is \(\cos(2\pi\cdot6/12)=\cos(\pi)=-1\). Thus

$$ \rho_{\mathrm{dc}}(6) =\exp(-0.08\cdot6)(-1) =\exp(-0.48)(-1) =-0.6188. $$

At twelve months, the cosine is \(\cos(2\pi)=1\), giving

$$ \rho_{\mathrm{dc}}(12) =\exp(-0.08\cdot12)(1) =\exp(-0.96) =0.3829. $$

The covariance values are \(\sigma_u^2\rho(h)\): \(C(6)=0.64(-0.6188)=-0.3960\), and \(C(12)=0.64(0.3829)=0.2451\), in squared units of the latent effect. The latent effects six months apart tend to move in opposite directions, while those one year apart tend to move in the same direction, but the yearly association has weakened. These statements concern the latent effects, not directly the observed responses.

Worked Example: Constructing a Covariance Matrix

For a hypothetical process observed at months \(0,3,6,\) and \(12\), use the damped cosine with variance \(\sigma_u^2=0.5\), \(\phi=0.05\) per month, and \(P=12\) months. Construct the covariance matrix in that time order.

The distinct lags are 3, 6, 9, and 12 months. Their correlations are \(\rho(3)=\exp(-0.15)\cos(\pi/2)=0\), \(\rho(6)=\exp(-0.30)\cos(\pi)=-0.7408\), \(\rho(9)=\exp(-0.45)\cos(3\pi/2)=0\), and \(\rho(12)=\exp(-0.60)\cos(2\pi)=0.5488\). Multiplying each correlation by \(0.5\) gives the covariance at that lag. The diagonal entries are all the variance \(0.5\), so

$$ \boldsymbol{\Sigma}= \begin{pmatrix} 0.5000 & 0 & -0.3704 & 0.2744\\ 0 & 0.5000 & 0 & 0\\ -0.3704 & 0 & 0.5000 & -0.3704\\ 0.2744 & 0 & -0.3704 & 0.5000 \end{pmatrix}. $$

Each entry uses the absolute time difference for its pair of observations, so the matrix is symmetric. The zero entries at three- and nine-month lags result from the cosine being zero there; they do not imply that all other lags have zero association. The covariance function's validity ensures this matrix is positive semidefinite, even though some of its off-diagonal entries are negative.

Assumptions, Diagnostics, and Alternatives

A periodic covariance is most defensible when the time scale is meaningful, a plausible period can be specified or estimated, and dependence is reasonably stable across the observation window. A stationary periodic covariance assumes the same covariance at the same lag regardless of calendar date. A damped model further assumes a particular oscillatory shape and exponential weakening; an exact-periodic model assumes no weakening at all. These are modeling assumptions, not consequences of observing a seasonal-looking series.

Diagnostics should ask whether the fitted dependence resembles the model's implications. Examine residual or simulation-based checks for recurring patterns at the proposed period and for remaining lag dependence, using methods appropriate to the GLMM and response distribution. A damped cosine predicts alternating positive and negative lobes as lag increases, with their absolute magnitudes bounded by the exponential envelope. A monotone exponential covariance predicts nonnegative correlations that decrease with lag. Clear unexplained oscillation, a persistent seasonal pattern where the model predicts strong damping, or dependence that changes across calendar time indicates possible lack of fit.

Period estimates can be weakly determined when the time series is short, observations are sparse, or only a small number of cycles are observed. Irregularly spaced times can be used by evaluating the covariance at actual time differences, but do not eliminate weak information about the period. In discrete-time data, a period that is not distinguishable at the observation schedule may be difficult to identify from other oscillations. Compare scientifically plausible periods and inspect uncertainty in the covariance parameters rather than treating a single fitted period as certain.

The alternatives answer different questions. A discrete-time AR(1) or continuous-time exponential covariance describes dependence that decays monotonically; it is simpler when recurrence is not supported. The exact periodic squared-exponential covariance allows a flexible, smooth pattern within a cycle but forces perfect recurrence after every whole period. The damped cosine allows weakening recurrence and negative correlations, but imposes a specific oscillatory shape. Model choice should reflect the timing and scientific process, not just which covariance can produce a visually appealing fit.

Common pitfall: Seeing a high correlation at a one-year lag and concluding that dependence is constant from year to year. Under the damped cosine, a one-period lag has correlation \(\exp(-\phi P)\), which is less than one whenever \(\phi>0\); under an exact-periodic model it is exactly one. These are different assumptions with different consequences. Also, a periodic covariance does not substitute for a seasonal mean effect: covariance describes co-variation around the modeled mean, not the mean's recurring changes.

Periodic covariance functions are useful when repeated phases of a cycle plausibly share latent deviations, as with month-of-year or day-of-week patterns. Their limitations are equally important: a single stationary period may not capture changing amplitude, shifting phase, multiple cycles, or an isolated long-term change. Exact periodicity can be especially restrictive because observations one period apart have identical latent effects. A covariance model should therefore be interpreted as a claim about the latent dependence structure, and checked against the design and the observed time scale.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. For a damped cosine with \(P=10\) time units and \(\phi=0.04\) per time unit, calculate the correlation at lag 10. What does it represent?
  2. For the same model, what is the correlation at lag 5? Show the calculation and interpret its sign.
  3. Why is a covariance of the form \(\sigma_u^2\cos(2\pi h/P)\) valid, and what restrictive implication does it have at lag \(P\)?
  4. A fitted monotone exponential covariance has positive correlation that decreases with lag. What feature of the damped cosine would indicate that it may better represent the temporal dependence?

Solutions. (1) \(\rho(10)=\exp(-0.04\cdot10)\cos(2\pi)=\exp(-0.4)=0.6703\). It is the latent-effect correlation between observations ten time units apart, one full period apart. (2) \(\rho(5)=\exp(-0.04\cdot5)\cos(\pi)=-\exp(-0.2)=-0.8187\). The negative sign indicates opposite-direction latent deviations at the half-period lag under this model. (3) The cosine covariance matrix is the sum of the outer products formed from the vectors of cosine and sine values, multiplied by \(\sigma_u^2\), so it is positive semidefinite. At lag \(P\), its correlation is one, forcing exact recurrence. (4) Repeated positive and negative association across lag, with a magnitude that weakens as lags increase, is characteristic of damped oscillation and cannot be captured by a purely monotone positive decay.

Clinical Biostats