Tutorials › Generalized Linear Mixed Models (GLMM) › Combining Long-Term Trends and Short-Term Temporal Dependence

Spatial and Temporal Correlation · Tutorial 594 of 698

Combining Long-Term Trends and Short-Term Temporal Dependence

Build a temporal GLMM that separates gradual change over time from short-lived correlated departures, and interpret what each component contributes.

Advanced 9 min read

What You'll Learn

  • Write a GLMM linear predictor with a smooth time trend and a stationary short-range latent effect.
  • Distinguish a fixed smooth trend from a random smooth trend and state the implications for covariance.
  • Derive the combined latent covariance when independent random components are used.
  • Interpret trend and short-term process contributions on the linear-predictor and response scales.
  • Recognize confounding, boundary, and model-mismatch problems that can undermine this decomposition.

Why Separate Trend from Short-Range Dependence?

A temporal GLMM may need to represent two patterns at once: gradual change over a long period and correlated departures that fade over a shorter period. A smooth trend can capture a sustained rise, fall, or curved trajectory. A stationary short-range process can capture local clustering around that trajectory without treating every departure as a new long-term change.

The distinction is useful because the components answer different questions. The trend describes the systematic temporal pattern in the linear predictor; the short-range process describes transient latent deviations from that pattern. Neither component should automatically be interpreted as a causal effect of time.

Definition: For observation \(i\) at time \(t_i\), a combined temporal GLMM has linear predictor $$ \eta_i=\mathbf{x}_i^\top\boldsymbol{\beta}+g(t_i)+u(t_i), $$ where \(\mathbf{x}_i^\top\boldsymbol{\beta}\) is the fixed-effects contribution, \(g(t)\) is a smooth long-term trend, and \(u(t)\) is a mean-zero stationary short-range latent process. Conditional on the latent effects, the response distribution belongs to the specified GLM family and has mean \(\mu_i=h^{-1}(\eta_i)\), where \(h\) is the link function.

One standard specification treats \(g(t)\) as a fixed smooth function represented by a finite basis, \(g(t)=\mathbf{B}(t)^\top\boldsymbol{\gamma}\), and treats \(u(t)\) as a Gaussian random process. The chosen basis and its dimension or smoothing rule determine how much temporal curvature the trend can represent. Alternatively, a smooth trend can itself be modeled as a random effect. That alternative requires specifying its covariance and separating it from the covariance of \(u(t)\); the two random components are not automatically distinguishable.

Assumptions and Covariance Structure

For the basic decomposition, assume the response observations are conditionally independent given the fixed effects and latent temporal effects, with the chosen response family and link correctly specified. Assume also that the short-range process has mean zero, is stationary over the modeled time domain, and has a covariance that decreases with temporal separation. For interpretation as distinct additive contributions, the trend specification must be sufficiently smooth to represent gradual change, and the short-range covariance must represent local departures rather than another long-term curve.

For equally spaced times, one possible stationary short-range process is a Gaussian AR(1) process. For irregularly spaced times, a continuous-time Ornstein–Uhlenbeck process gives a covariance that depends on elapsed time. In either case, its variance and correlation scale must be estimated or specified, and the observation times must be recorded at a meaningful scale. These assumptions concern the latent process; they do not assert that the observed binary or count responses themselves have Gaussian covariance.

If the trend \(g(t)\) is a fixed function, then conditional on its coefficients the random temporal covariance comes from \(u(t)\). If instead the trend is random, denote it by \(G(t)\), and suppose \(G\) and \(u\) are independent. The covariance of their sum is then the sum of their covariances:

$$ \operatorname{Cov}\{G(t_i)+u(t_i),G(t_j)+u(t_j)\} =K_G(t_i,t_j)+K_u(t_i,t_j). $$

This follows by expanding the covariance into four terms. The two cross-covariances are zero by independence, leaving only the covariance within each component. If the components are dependent, cross-covariances do not vanish, and the displayed sum is not the full covariance.

Worked Example: Reading the Two Contributions in a Binary GLMM

Suppose a hypothetical monitoring program records a binary event at successive times. Use a logit link and the model \(\eta_i=\beta_0+g(t_i)+u(t_i)\). At one time, let the fitted intercept be \(-1.20\), the smooth trend contribution be \(0.50\), and the estimated short-term latent deviation be \(0.30\). The model assumes the binary response has a Bernoulli distribution conditional on the latent effect, and the local process is modeled as a mean-zero stationary Gaussian process.

The linear predictor is $$ \eta_i=-1.20+0.50+0.30=-0.40. $$

The conditional event probability is the inverse-logit: $$ \mu_i=\frac{\exp(-0.40)}{1+\exp(-0.40)} =\frac{0.6703}{1+0.6703}\approx 0.4013. $$

The trend contributes \(0.50\) log-odds units relative to the intercept, while the short-term latent deviation contributes \(0.30\) log-odds units at this particular time. Holding the other terms fixed, the trend multiplies the odds by \(\exp(0.50)\approx1.649\), and the local deviation multiplies them by \(\exp(0.30)\approx1.350\). These are conditional model interpretations, not separate causal effects. The probability \(0.4013\) is conditional on the specified linear predictor; it is not generally the population-averaged probability over the distribution of \(u(t)\).

Short-Range Covariance Around a Trend

For irregular times, consider a stationary Ornstein–Uhlenbeck latent process with variance \(\sigma_u^2\) and correlation range parameter \(\phi>0\):

$$ \operatorname{Cov}\{u(t_i),u(t_j)\} =\sigma_u^2\exp\left(-\frac{|t_i-t_j|}{\phi}\right). $$

The process has the same marginal variance at each time, and correlation declines exponentially with elapsed time. The parameter \(\phi\) is in the same time units as \(t\); a larger \(\phi\) means correlation persists over longer gaps. This covariance describes the departures \(u(t)\), not the smooth trend itself. With a fixed trend, adding \(g(t)\) shifts the latent mean but does not change this conditional covariance.

Worked Example: Covariance at Irregular Times

Suppose a hypothetical count-monitoring model uses an OU latent process with \(\sigma_u^2=0.36\) and \(\phi=2\) days. Two observations are 3 days apart. Assume the OU process is stationary and the time gaps are measured in days, as required by the covariance specification.

Their latent covariance is $$ 0.36\exp(-3/2)=0.36(0.2231)\approx0.0803. $$

The marginal standard deviation of the latent effect is \(\sqrt{0.36}=0.60\). Because both times have the same variance, their latent correlation is $$ \frac{0.0803}{\sqrt{0.36}\sqrt{0.36}} =\frac{0.0803}{0.36} \approx0.2231. $$

Thus the latent departures at times three days apart have covariance about \(0.0803\) and correlation about \(0.2231\). These are not the covariance and correlation of the observed counts: the nonlinear response model and conditional sampling variation also affect response-scale dependence.

Building and Interpreting the Model

A practical formulation begins by specifying the time scale and the mean structure. Choose a smooth basis \(\mathbf{B}(t)\) that can represent the intended gradual pattern, then specify the stationary short-range covariance according to the sampling schedule. For regular observations an AR(1) structure may be convenient; for unequal gaps an elapsed-time covariance such as the OU form avoids treating a one-day gap and a one-month gap as equivalent.

The following sequence makes the decomposition explicit:

1
Specify the conditional response model.
Choose the response family and link, and state that responses are conditionally independent given the fixed effects and latent effects.
2
Represent gradual change.
Choose \(g(t)=\mathbf{B}(t)^\top\boldsymbol{\gamma}\) or an explicitly defined random smooth trend. Clarify whether the trend coefficients are fixed or random.
3
Specify local dependence.
Choose a stationary covariance for \(u(t)\), and define its variance and time-scale parameter in the units of the observation times.
4
Check whether the components can be separated.
Assess whether the time coverage and covariance assumptions distinguish a gradual trend from persistent latent departures; do not rely on the model formula alone to guarantee identification.

Worked Example: Trend and Local Deviation in a Count Model

Consider a hypothetical Poisson GLMM for event counts per observation period, with a log link and \(\eta_i=\beta_0+g(t_i)+u(t_i)\). Suppose at a particular time the fitted intercept is \(\log(4)\), the smooth trend contribution is \(-0.20\), and the local latent deviation is \(0.10\). The conditional count mean is \(\exp(\eta_i)\). Assume the Poisson conditional distribution is appropriate and \(u(t)\) follows a mean-zero stationary short-range process.

The linear predictor and conditional mean are $$ \eta_i=\log(4)-0.20+0.10=\log(4)-0.10\approx1.2863, $$ $$ \mu_i=\exp\{\log(4)-0.10\}=4\exp(-0.10)\approx3.619. $$

At this time, the trend reduces the conditional mean relative to the intercept-only reference by a multiplicative factor \(\exp(-0.20)\approx0.8187\), while the local deviation multiplies it by \(\exp(0.10)\approx1.105\). Combined, the mean is about 3.619 counts per observation period rather than 4. These contributions are additive on the log-mean scale and multiplicative on the mean scale. The local deviation is a latent model term, not an observed count residual.

When the Decomposition Fails

A central difficulty is that a sufficiently persistent short-range process can resemble a smooth trend, while an overly flexible trend can absorb local dependence. When both components can explain the same temporal pattern, their estimated magnitudes may be unstable, highly correlated, or strongly influenced by modeling choices. Sparse coverage over time, a short observation window, or long gaps can make the distinction especially difficult. A model can be mathematically specified yet poorly informed by the data.

Look for signs that the proposed decomposition is inadequate: a fitted trend that changes sharply to track individual observations; a short-range process whose estimated correlation persists across most of the study period; uncertainty in variance or range estimates that is large or reaches a boundary; or remaining temporal structure in residual checks. Such signs prompt reassessment of time coverage, trend flexibility, and covariance assumptions. They do not by themselves establish which component is wrong.

The principal alternatives clarify the modeling choice. A trend-only model allows systematic change but assumes no additional temporal correlation after conditioning on that trend. A stationary-process-only model allows temporal dependence but has no separate smooth mean pattern. A combined model accommodates both, at the cost of more parameters and potential confounding. A random-walk trend can represent evolving departures, but it is not stationary in its usual form and should not be treated as interchangeable with a stationary short-range process. Seasonal or periodic covariance addresses recurring temporal patterns, a different structure from a nonperiodic smooth trend plus local dependence.

A common mistake is to interpret the trend as the persistent part of \(u(t)\) simply because both vary with time, then report the fitted \(u(t)\) as a second trend. The correction is to define each component before fitting: state the trend basis or random-trend covariance, state the stationary covariance for \(u(t)\), and interpret their contributions on the linear-predictor scale. If the estimated structures overlap substantially, report that separation is weak rather than assigning confident substantive meaning to each component.

Key takeaway: A combined temporal GLMM adds a smooth trend and a stationary short-range latent deviation on the linear-predictor scale. The decomposition is informative only when its assumptions are appropriate and the data can distinguish gradual change from local dependence.

Check Your Understanding

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

  1. In a GLMM with a fixed smooth trend and a mean-zero stationary latent process, which component contributes random temporal covariance after conditioning on the trend coefficients?
  2. An OU process has variance \(0.25\), range parameter \(\phi=4\) hours, and two times 4 hours apart. What is their latent correlation?
  3. For a logit model, the trend contribution increases by \(0.4\) while other terms are held fixed. By what factor do the odds change?
  4. Why can a very persistent short-range process make the smooth trend difficult to interpret?

Solutions. (1) The stationary latent process contributes the conditional random temporal covariance; the fixed trend shifts the linear predictor but is not itself random. (2) The correlation is \(\exp(-4/4)=\exp(-1)\approx0.3679\). The variance sets the marginal scale but cancels when computing correlation. (3) The odds are multiplied by \(\exp(0.4)\approx1.492\), an increase of about 49.2%, conditional on the other terms. (4) A persistent process can reproduce gradual changes over the observed period, so the data may not clearly distinguish its departures from the trend; estimates can then be unstable and depend on the trend and covariance specifications.

Clinical Biostats