Why Let Temporal Trends Vary Across Locations?
A common temporal effect assumes that, after accounting for measured predictors, every location follows the same time trend. That can be too restrictive: the outcome may increase faster in some locations than others. A location-specific random slope allows this variation, while a spatial covariance structure expresses the idea that nearby locations may have more similar slopes than distant ones.
The key calculation is on the model’s latent linear-predictor scale. If a location’s slope contributes its value times the centered observation time, then covariance between two such contributions is the covariance between their slopes multiplied by both time values. The time values therefore affect both the size and, when they have opposite signs, the sign of the covariance.
Model and Assumptions
Suppose observations are indexed by location \(i=1,\ldots,m\), and let \(q_t\) be the time value for an observation at time \(t\), measured relative to a chosen reference time. For example, if time is measured in years and the reference is year 2020, then an observation in 2022 has \(q_t=2\). A GLMM can include the linear predictor
Here \(\eta_{it}\) is the conditional linear predictor, \(\mathbf{x}_{it}\) is the fixed-effects design vector, and \(\boldsymbol{\beta}\) is the vector of fixed-effect coefficients. The random coefficient \(b_i\) is location \(i\)’s deviation from the population time slope. Thus, if the fixed part includes a time term \(\beta_t q_t\), the total slope at location \(i\) is \(\beta_t+b_i\). The parameter \(\tau^2\) is the marginal variance of a location’s random slope, and \(\mathbf{R}_{S}\) is a spatial correlation matrix.
The covariance matrix must be symmetric and positive semidefinite, with diagonal entries equal to one if it is a correlation matrix. The spatial structure must also be appropriate for the locations and design. For instance, an exponential correlation model based on distances \(d_{ij}\) is
In this model, \(d_{ij}\) and the range parameter \(\rho\) use the same distance units. Correlation is one at distance zero and decreases as distance increases. Other valid spatial structures may be built from locations or adjacency, as in the earlier material on spatial covariance structures.
For a GLMM, the conditional response distribution and link function are specified in the usual way; for example, \(g\{E(Y_{it}\mid\mathbf{b})\}=\eta_{it}\). The model also assumes the stated distribution for \(\mathbf{b}\). If conditional independence of responses is assumed given the random effects, that assumption applies to the full set of random effects in the model. The calculations below describe the covariance contributed by this slope component; additional random effects can contribute further covariance.
How Slope Covariance Becomes Space-Time Covariance
Define the random temporal contribution at location \(i\) and time \(t\) as \(U_{it}=q_t b_i\). Since the random slopes have mean zero, \(E(U_{it})=0\). For another location \(j\) and time \(s\), covariance follows directly from the definition of covariance and the fact that \(q_t\) and \(q_s\) are fixed values:
This is the central result. The spatial structure describes covariance of the slopes; multiplication by the two time values converts that into covariance of the temporal contributions. In particular, at the reference time \(q_t=0\), this random-slope contribution is zero. At the same location and time, its variance is \(q_t^2\tau^2\). At two locations observed at the same nonzero time, the correlation between their random temporal contributions is \(R_{S,ij}\). At different times with nonzero time values, their correlation is \(R_{S,ij}\) multiplied by the sign of \(q_tq_s\).
The same calculation can be expressed in matrix form. If \(\mathbf{q}\) is the vector of time values and each location has one slope, the matrix of random contributions across locations and times has entries \(q_t b_i\). Its covariance between any two entries is exactly the scalar expression above. This structure is generally not the same as assigning an unrestricted covariance to every location-time pair: it is constrained to arise from a spatially correlated vector of slopes and the chosen time values.
Worked Example: Covariance at Two Locations and Times
Consider hypothetical locations with distance \(1.5\) km, and suppose the random-slope standard deviation is \(0.20\) log-odds per year. Use the exponential spatial correlation model with \(\rho=3\) km. Find the covariance between the random temporal contributions at \(q_t=2\) years and \(q_s=4\) years.
First calculate the spatial correlation:
The slope variance is \(\tau^2=(0.20)^2=0.0400\) in squared log-odds per year. Therefore,
The units are squared log-odds because the time values in years cancel the per-year units of each slope. The covariance is positive because both time values are positive and the spatial correlation is positive.
Worked Example: A Three-Location Covariance Matrix
Suppose three hypothetical locations lie on a straight line at positions 0, 1, and 2 km. Let \(\rho=2\) km and \(\tau=0.30\) log-odds per year. Calculate the covariance matrix of their slopes and the covariance matrix of their random temporal contributions at \(q=2\) years.
The adjacent locations are 1 km apart, so their correlation is \(r=\exp(-1/2)\approx0.6065\). The first and third locations are 2 km apart, giving correlation \(\exp(-1)=0.3679\). Thus,
Multiplying by the slope variance \(\tau^2=0.0900\) gives
At \(q=2\), the random contribution vector is \(2\mathbf{b}\), so its covariance matrix is \(2^2\operatorname{Cov}(\mathbf{b})\):
For example, the covariance between locations 1 and 3 is \(4(0.0900)(0.3679)=0.1324\). Its corresponding correlation remains \(0.3679\), since multiplying every slope by the same positive time value scales variances and covariances consistently.
Worked Example: Opposite-Signed Times
Suppose two locations are 4 km apart, \(\rho=4\) km, and the random-slope standard deviation is \(0.30\) log-odds per year. Calculate the covariance between contributions at \(q_t=-1\) year and \(q_s=2\) years.
The spatial correlation is \(\exp(-4/4)=\exp(-1)\approx0.3679\), and the slope variance is \(0.0900\). Hence,
The negative sign does not mean the two slopes are spatially negatively correlated: their slope correlation is positive, \(0.3679\). Rather, a positive slope deviation contributes with a negative multiplier before the reference time and a positive multiplier after it. The time multipliers create the negative covariance between these particular temporal contributions.
What the Structure Adds—and What It Does Not
A spatially correlated random slope differs from several common alternatives. A common fixed time slope gives all locations the same time trend after adjustment for covariates. Independent random slopes allow location-specific trends but set the covariance between distinct locations to zero. A spatially correlated random slope allows local trends to vary while shrinking their joint distribution toward similar values at spatially close locations. These are distinct assumptions, not interchangeable ways to describe the same model.
| Approach | Assumption about temporal slopes | Implication |
|---|---|---|
| Common fixed slope | No location-level slope variation | Every location has the same modeled time trend |
| Independent random slopes | Location slopes vary independently | Distinct locations have zero slope covariance |
| Spatially correlated random slopes | Slope covariance follows a spatial matrix | Nearby locations can have more similar slopes |
This model also differs from a general space-time interaction structure. Here, the interaction has a particular form: one random coefficient per location is multiplied by time. It creates covariance across time through shared slopes, and its temporal scaling is \(q_tq_s\). A dynamic spatial random effect can instead evolve over time and need not be representable by one persistent slope at each location. The earlier material on separable and nonseparable space-time covariance structures provides broader alternatives when the observed dependence cannot reasonably be summarized by spatially correlated slopes.
Centering time is important for interpretation. The random slope itself does not change when the origin of time changes, but the intercept and slope components can become associated if both are included in the model. With the slope-only contribution shown here, the random contribution is exactly zero at the chosen reference time. Selecting a meaningful reference time makes the resulting model easier to describe; it does not by itself establish that the spatial covariance assumption is appropriate.
Diagnostics, Failure Modes, and Limitations
The model is most useful when there are repeated observations over time at multiple locations and the scientific question supports gradual spatial variation in temporal trends. Its assumptions can be questionable when locations are too sparse to distinguish spatial covariance from other sources of variation, when the spatial pattern is not well represented by the chosen covariance model, or when temporal changes are strongly nonlinear. A single slope at each location cannot capture every short-term fluctuation.
Useful checks focus on whether this specific structure is plausible. Examine whether estimated location-level temporal trends show spatial organization, and whether unexplained temporal patterns remain after accounting for the fitted slopes. Compare the assumed spatial correlation decay with the spacing and coverage of the locations, and check whether conclusions change substantially under reasonable alternative spatial structures. Strong sensitivity, implausible slope estimates, or persistent systematic temporal patterns are warnings that the model may be inadequate. Such checks do not prove that a covariance model is correct; they identify ways it may fail.
- Time-scale error: If time is rescaled from years to months, slope variances and units change. The model’s implied covariance must be calculated using time values and slope units on the same scale.
- Ignoring the time multipliers: Spatial correlation of slopes is not itself the covariance of temporal contributions. The latter includes \(q_tq_s\tau^2\).
- Reading covariance as response correlation: The result derived here concerns random contributions to the linear predictor. It does not directly give a correlation between observed outcomes.
- Assuming positive covariance at all times: Positive spatial correlation does not prevent negative covariance when the two centered time values have opposite signs.
- Over-interpreting proximity: A spatial kernel encodes a covariance assumption. It does not imply that nearby locations cause one another’s temporal trends.
Check Your Understanding
Answer each question, then compare your work with the solutions below.
- Two locations have slope correlation \(0.50\), and \(\tau=0.40\) units per year. What is the covariance between their random temporal contributions at \(q_t=1\) year and \(q_s=3\) years?
- If two locations have positively correlated slopes, can their random temporal contributions have negative covariance? State the condition on the time values.
- With an exponential spatial correlation model, calculate the slope correlation at distance 2 km when \(\rho=4\) km.
- At the reference time, what is the random-slope contribution to the linear predictor, and what is its variance?
Solutions. (1) The slope variance is \(0.40^2=0.16\). The covariance is \((1)(3)(0.16)(0.50)=0.240\) in squared outcome-link units. (2) Yes. Since the slope covariance is positive, the contribution covariance is negative when \(q_tq_s<0\), meaning the centered time values have opposite signs. (3) The correlation is \(\exp(-2/4)=\exp(-0.5)\approx0.6065\). (4) At the reference time \(q_t=0\), the contribution is \(q_tb_i=0\) for every slope value, so its variance is \(q_t^2\tau^2=0\).