Introduction

Background

Spatial-temporal data analysis has become increasingly important in many fields including epidemiology, environmental science, economics, and public health. When analyzing data collected over both space and time, it is crucial to properly model the interactions between these two dimensions. INLA (Integrated Nested Laplace Approximations) provides a flexible framework for fitting such complex models using the f() function.

The choice of interaction structure can significantly impact model performance and interpretation. Knorr-Held (2000) proposed four types of space-time interactions, which have become standard in spatio-temporal modeling with INLA. These interaction types allow researchers to capture different patterns of how spatial and temporal effects combine.

Why Model Space-Time Interactions?

In many real-world applications, the relationship between space and time is not simply additive. For example: - Public Health: Disease outbreaks may spread through neighboring areas over time - Environmental Science: Air pollution may show different spatial patterns across seasons
- Economics: Regional economic growth may follow different temporal trajectories

Ignoring these interactions can lead to: - Biased estimates - Overly simplistic models - Poor predictive performance

The Common Foundation

Before diving into the interaction types, it’s important to understand the shared components that all four models include.

All four models share the same main effects:

# Main Effects (same for ALL types)
f(ID.area, model="bym", graph=Georgia.adj)  # Spatial main effect (structured)
f(ID.year, model="rw2")                      # Temporal main effect (structured)  
f(ID.year1, model="iid")                     # Temporal main effect (unstructured)

These capture: - Spatial structure: BYM model with adjacency matrix (accounts for spatial autocorrelation) - Temporal structure: RW2 for smooth trends (second-order random walk) - Temporal unstructured: IID for random year effects (independent year-specific deviations)

The main effects represent the average spatial and temporal patterns. The interaction term captures how these patterns deviate from the average across space-time combinations. Only the interaction term changes across the four types!

Understanding the Components

Before we dive into the interaction types, let’s clarify some key terminology:

  • BYM (Besag-York-Mollié): A spatial model that combines an intrinsic conditional autoregressive (ICAR) component with an unstructured random effect
  • RW2 (Second-order Random Walk): A temporal model that assumes smooth trends over time, allowing for non-linear evolution
  • IID (Independent and Identically Distributed): Assumes no structure or correlation between units
  • Besag: The ICAR component of the BYM model, which captures spatial dependence

The .int Variables

In the interaction formulas, you’ll notice variables like ID.area.int and ID.year.int. These are copies of the original ID variables (e.g., ID.area and ID.year) but are used specifically for the interaction term. This allows the interaction to have a different model structure than the main effects.


Type I: Unstructured × Unstructured

The Model Formula

f(ID.area.year, model="iid")

What it means:

  • Single variable: ID.area.year (unique combination of area and year)
  • Model: iid (Independent and Identically Distributed)
  • Structure: No spatial structure × No temporal structure

Mathematical Representation

The interaction term can be expressed as:

\[\gamma_{it} = \phi_{it}\]

where \(\phi_{it} \sim N(0, \sigma^2)\) independently for all \(i\) and \(t\).

Interpretation:

Each area-year combination gets its own completely independent random effect. There is no borrowing of information across either space or time.

Matrix Representation:

          Year 1  Year 2  Year 3  Year 4
Area 1:   [ a1     a2      a3      a4  ]  ← All independent
Area 2:   [ b1     b2      b3      b4  ]  ← All independent
Area 3:   [ c1     c2      c3      c4  ]  ← All independent
                ↑ All independent!

When to use:

  • You expect no spatial or temporal patterns in the interaction
  • Area-specific deviations are completely random and unrelated
  • Simplest and most parsimonious interaction structure
  • You have limited data and need to avoid overfitting

Advantages:

  • Simple and computationally efficient
  • Requires minimal degrees of freedom
  • Good baseline model for comparison

Disadvantages:

  • Ignores potential space-time dependencies
  • May underestimate uncertainty if real structure exists

Type II: Unstructured × Structured (Temporal)

The Model Formula

f(ID.area.int, model="iid", 
  group=ID.year.int, 
  control.group=list(model="rw2"))

What it means:

  • Main effect: ID.area.int with model="iid" → Areas are unstructured (independent)
  • Group: ID.year.int → Grouped by year
  • Control.group: model="rw2" → Years have temporal structure (smooth across time)

Mathematical Representation

\[\gamma_{it} = \delta_{it}\]

where for each area \(i\), \(\delta_{i1}, \delta_{i2}, ..., \delta_{iT}\) follows an RW2 process independently across areas.

Structure:

  • Spatial: IID (no spatial correlation between areas)
  • Temporal: RW2 (smooth temporal trends within each area)

Interpretation:

Each area has its own smooth temporal trajectory, but areas are independent of each other. This captures the idea that each location has its own unique time trend, but these trends are not influenced by neighboring areas.

Matrix Representation:

          Year 1 → Year 2 → Year 3 → Year 4
Area 1:   [ a1 →   a2  →   a3  →   a4  ]  ← RW2 across years
Area 2:   [ b1 →   b2  →   b3  →   b4  ]  ← RW2 across years
Area 3:   [ c1 →   c2  →   c3  →   c4  ]  ← RW2 across years
     ↑                    ↑
   IID (independent)   IID (independent)

When to use:

  • Areas have different temporal patterns
  • But these patterns are independent (no spatial similarity)
  • Each area evolves smoothly over time, but differently
  • You suspect temporal trends vary by location but spatial proximity doesn’t matter

Advantages:

  • Captures area-specific temporal dynamics
  • Allows for flexible, non-linear trends per area
  • More parsimonious than Type IV

Disadvantages:

  • Ignores spatial correlation in the interaction
  • May miss spatial clustering of temporal trends

Example Application:

Tracking crime rates across neighborhoods: each neighborhood may have its own temporal trend (e.g., gentrification effects), but these trends might be independent across neighborhoods.


Type III: Structured (Spatial) × Unstructured

The Model Formula

f(ID.year.int, model="iid", 
  group=ID.area.int, 
  control.group=list(model="besag", graph=Georgia.adj))

What it means:

  • Main effect: ID.year.int with model="iid" → Years are unstructured (independent)
  • Group: ID.area.int → Grouped by area
  • Control.group: model="besag" with adjacency → Areas have spatial structure

Mathematical Representation

\[\gamma_{it} = \theta_{ti}\]

where for each year \(t\), \(\theta_{t1}, \theta_{t2}, ..., \theta_{tI}\) follows a Besag (ICAR) process independently across years.

Structure:

  • Spatial: BYM/Besag (spatial correlation within each time point)
  • Temporal: IID (no temporal correlation between years)

Interpretation:

Each year has its own spatial pattern, but years are independent of each other. This captures the idea that spatial patterns can change from year to year, with no temporal smoothing.

Matrix Representation:

          Year 1     Year 2     Year 3     Year 4
Area 1:   [ a1        b1         c1         d1  ]
Area 2:   [ a2        b2         c2         d2  ]  ← IID across years
Area 3:   [ a3        b3         c3         d3  ]
     ↑          ↑          ↑          ↑
   BYM        BYM        BYM        BYM
(spatial)   (spatial)  (spatial)  (spatial)

When to use:

  • Spatial patterns change from year to year
  • But each year’s pattern has spatial structure (neighbors similar)
  • No temporal smoothing (each year independent)
  • You expect spatial clustering but no temporal autocorrelation

Advantages:

  • Captures year-specific spatial patterns
  • Allows spatial patterns to vary over time
  • Accounts for spatial autocorrelation

Disadvantages:

  • Ignores temporal continuity
  • May be too flexible if temporal patterns are smooth

Example Application:

Analyzing annual election results: each election year may have its own spatial pattern (e.g., urban-rural divides), but patterns might not smoothly evolve due to political shifts.


Type IV: Structured (Spatial) × Structured (Temporal)

The Model Formula

f(ID.area.int, model="besag", graph=Georgia.adj, 
  group=ID.year.int, 
  control.group=list(model="rw2"))

What it means:

  • Main effect: ID.area.int with model="besag" → Areas have spatial structure
  • Group: ID.year.int → Grouped by year
  • Control.group: model="rw2" → Years have temporal structure

Mathematical Representation

\[\gamma_{it} = \psi_{it}\]

where the vector \(\psi = (\psi_{11}, ..., \psi_{IT})\) follows a spatio-temporal model with both spatial and temporal dependence structures. Typically, this is achieved through the Kronecker product of the spatial and temporal precision matrices.

Structure:

  • Spatial: BYM/Besag (spatial correlation between neighboring areas)
  • Temporal: RW2 (temporal correlation across years)

Interpretation:

The interaction is smooth in both space AND time. - Neighboring areas have similar effects - Consecutive years have similar effects - This is the most complex interaction structure

Matrix Representation:

          Year 1 → Year 2 → Year 3 → Year 4
Area 1:   [ a1 →   a2  →   a3  →   a4  ]  ← RW2
Area 2:   [ b1 →   b2  →   b3  →   b4  ]  ← RW2
Area 3:   [ c1 →   c2  →   c3  →   c4  ]  ← RW2
   ↑          ↑          ↑          ↑
  BYM        BYM        BYM        BYM
(spatial)  (spatial)  (spatial)  (spatial)

When to use:

  • You expect smooth spatio-temporal evolution
  • Neighboring areas behave similarly over time
  • The phenomenon spreads continuously through space and time
  • Most flexible but most parameter-rich

Advantages:

  • Most realistic for many real-world phenomena
  • Captures complex space-time dependencies
  • Borrows strength across both dimensions

Disadvantages:

  • Most complex and computationally intensive
  • Risk of overfitting
  • Requires more data to estimate reliably

Example Application:

Modeling disease spread: diseases often spread from neighboring areas and evolve smoothly over time. This structure captures both the spatial and temporal dependencies simultaneously.


Summary Table

Type Formula Component Spatial Structure Temporal Structure Complexity
I f(ID.area.year, model="iid") ✗ IID ✗ IID Simplest
II f(ID.area.int, model="iid", group=ID.year.int, control.group=list(model="rw2")) ✗ IID ✓ RW2 Medium
III f(ID.year.int, model="iid", group=ID.area.int, control.group=list(model="besag", graph=Georgia.adj)) ✓ Besag ✗ IID Medium
IV f(ID.area.int, model="besag", graph=Georgia.adj, group=ID.year.int, control.group=list(model="rw2")) ✓ Besag ✓ RW2 Most complex

Key Pattern to Remember

The interaction type is determined by which dimension has structure:

  • Type I: No structure (IID × IID)
  • Type II: Temporal structure only (IID × RW2)
  • Type III: Spatial structure only (Besag × IID)
  • Type IV: Both structures (Besag × RW2)

Important: The .int variables are just copies of the ID variables used specifically for the interaction term, allowing them to have different model structures than the main effects.


Model Selection and Diagnostics

Which Type to Choose?

The selection depends on:

  1. Information Criteria:
    • Deviance Information Criterion (DIC): Lower is better
    • WAIC (Watanabe-Akaike Information Criterion): Lower is better
    • CPO (Conditional Predictive Ordinate): Higher is better
  2. Domain Knowledge:
    • What patterns do you expect?
    • Are there known spatial-temporal processes?
    • What is the scale of your phenomenon?
  3. Data Availability:
    • More complex models require more data
    • Check for identifiability issues
  4. Computational Resources:
    • Type IV is most computationally intensive
    • Consider runtime and memory constraints

Practical Example: Fitting All Four Models

# Load required libraries
library(INLA)
library(spdep)

# Assuming you have your data and adjacency matrix ready
# For this example, we'll use Georgia dataset

data(georgia)
Georgia.adj <- as.matrix(georgia.adj)

# Create unique identifiers
data$ID.area <- as.numeric(factor(data$county))
data$ID.year <- as.numeric(factor(data$year))
data$ID.area.year <- as.numeric(factor(paste(data$ID.area, data$ID.year, sep="_")))
data$ID.area.int <- data$ID.area  # Copy for interaction
data$ID.year.int <- data$ID.year  # Copy for interaction

# Type I: Unstructured × Unstructured
model1 <- inla(y ~ 1 + 
  f(ID.area, model="bym", graph=Georgia.adj) +
  f(ID.year, model="rw2") +
  f(ID.year1, model="iid") +
  f(ID.area.year, model="iid"),
  data = data,
  family = "poisson",
  control.predictor = list(compute = TRUE)
)

# Type II: Unstructured × Structured (Temporal)
model2 <- inla(y ~ 1 + 
  f(ID.area, model="bym", graph=Georgia.adj) +
  f(ID.year, model="rw2") +
  f(ID.year1, model="iid") +
  f(ID.area.int, model="iid", 
    group=ID.year.int, 
    control.group=list(model="rw2")),
  data = data,
  family = "poisson",
  control.predictor = list(compute = TRUE)
)

# Type III: Structured (Spatial) × Unstructured
model3 <- inla(y ~ 1 + 
  f(ID.area, model="bym", graph=Georgia.adj) +
  f(ID.year, model="rw2") +
  f(ID.year1, model="iid") +
  f(ID.year.int, model="iid", 
    group=ID.area.int, 
    control.group=list(model="besag", graph=Georgia.adj)),
  data = data,
  family = "poisson",
  control.predictor = list(compute = TRUE)
)

# Type IV: Structured (Spatial) × Structured (Temporal)
model4 <- inla(y ~ 1 + 
  f(ID.area, model="bym", graph=Georgia.adj) +
  f(ID.year, model="rw2") +
  f(ID.year1, model="iid") +
  f(ID.area.int, model="besag", graph=Georgia.adj, 
    group=ID.year.int, 
    control.group=list(model="rw2")),
  data = data,
  family = "poisson",
  control.predictor = list(compute = TRUE)
)

Model Comparison

# Create comparison table
model_comparison <- data.frame(
  Model = c("Type I", "Type II", "Type III", "Type IV"),
  DIC = c(model1$dic$dic, model2$dic$dic, 
          model3$dic$dic, model4$dic$dic),
  WAIC = c(model1$waic$waic, model2$waic$waic,
           model3$waic$waic, model4$waic$waic),
  p.eff = c(model1$dic$p.eff, model2$dic$p.eff,
           model3$dic$p.eff, model4$dic$p.eff)
)

# Print comparison table
kable(model_comparison, 
      caption = "Model Comparison Results",
      digits = 2)

# Identify the best model
best_model <- model_comparison[which.min(model_comparison$DIC), "Model"]
cat("Best model based on DIC:", best_model, "\n")

Visualizing Results

# Plot fitted values for each model
par(mfrow = c(2, 2))

# Type I
plot(data$y, model1$summary.fitted.values$mean,
     xlab = "Observed", ylab = "Fitted",
     main = "Type I: IID × IID")
abline(0, 1, col = "red")

# Type II
plot(data$y, model2$summary.fitted.values$mean,
     xlab = "Observed", ylab = "Fitted",
     main = "Type II: IID × RW2")
abline(0, 1, col = "red")

# Type III
plot(data$y, model3$summary.fitted.values$mean,
     xlab = "Observed", ylab = "Fitted",
     main = "Type III: Besag × IID")
abline(0, 1, col = "red")

# Type IV
plot(data$y, model4$summary.fitted.values$mean,
     xlab = "Observed", ylab = "Fitted",
     main = "Type IV: Besag × RW2")
abline(0, 1, col = "red")

Conclusion

The choice of space-time interaction structure is a crucial decision in spatio-temporal modeling with INLA. The four types proposed by Knorr-Held (2000) provide a flexible framework that balances complexity and interpretability:

  • Type I: Simple baseline, no interactions between space and time
  • Type II: Captures area-specific temporal trends
  • Type III: Captures year-specific spatial patterns
  • Type IV: Most complex, captures smooth space-time evolution

The selection should be guided by both statistical criteria (DIC, WAIC, CPO) and domain knowledge about the underlying phenomenon. In practice, fitting all four models and comparing their performance is recommended to find the most appropriate structure for your data.

Key Takeaways

  1. Always fit multiple interaction types - The data will guide you to the best structure
  2. Consider your research question - Different types answer different questions
  3. Balance fit with parsimony - More complex isn’t always better
  4. Check convergence - More complex models may have convergence issues
  5. Validate with domain knowledge - The best statistical model should also make sense substantively

References

  • Knorr-Held, L. (2000). Bayesian modelling of inseparable space-time variation in disease risk. Statistics in Medicine, 19(17-18), 2555-2567.
  • Rue, H., Martino, S., & Chopin, N. (2009). Approximate Bayesian inference for latent Gaussian models by using integrated nested Laplace approximations. Journal of the Royal Statistical Society: Series B, 71(2), 319-392.
  • Blangiardo, M., & Cameletti, M. (2015). Spatial and Spatio-temporal Bayesian Models with R-INLA. John Wiley & Sons.
  • Moraga, P. (2019). Geospatial Health Data: Modeling and Visualization with R-INLA and Shiny. Chapman & Hall/CRC.