Skip to main content

Note 08: Time Series Linear Regression, Multicollinearity & Spuriousness

Module 2: Stationarity & Regression

Learning Objectives

  • Specify time series multiple linear regression models with TSLM(), including trend() and season() terms, and state the classical OLS assumptions.
  • Diagnose multicollinearity using Variance Inflation Factors (car::vif()) and identify valid remediation strategies.
  • Demonstrate spurious regression on independent random walks via Monte Carlo simulation and eliminate spuriousness through differencing.

1. Time Series Linear Models (TSLM) and OLS Assumptions

A time series multiple linear regression relates a response \(y_t\) to \(k\) explanatory predictors \(x_{1t}, \dots, x_{kt}\):

\[ y_t = \beta_0 + \sum_{j=1}^{k} \beta_j x_{jt} + \varepsilon_t, \qquad t = 1, \dots, n. \]

Ordinary least squares (OLS) minimizes \(\sum_{t=1}^n (y_t - \hat{y}_t)^2\). For standard \(t\)-tests, \(F\)-tests, and confidence intervals to remain valid, the errors \(\varepsilon_t\) must satisfy four core conditions:

  1. Zero conditional mean: \(\mathbb{E}[\varepsilon_t \mid \mathbf{X}] = 0\) (correct functional form and no omitted correlated variables).
  2. Homoscedasticity: \(\operatorname{Var}(\varepsilon_t \mid \mathbf{X}) = \sigma^2\) is constant across time.
  3. No autocorrelation: \(\operatorname{Cov}(\varepsilon_t, \varepsilon_s \mid \mathbf{X}) = 0\) for all \(t \neq s\).
  4. No perfect collinearity among predictors (and approximate normality of \(\varepsilon_t\) for exact small-sample inference).

In time series data, assumption 3 fails routinely. Under positively autocorrelated errors, OLS point estimates \(\hat{\boldsymbol{\beta}}\) may remain unbiased if predictors are strictly exogenous, but conventional OLS standard errors severely underestimate true sampling variability, inflating \(t\)-statistics and generating false positives.

In fable, TSLM() provides convenient deterministic trend() and season() specials for capturing linear drift and seasonal dummy variables alongside external predictors.

beer_recent <- aus_production |> filter_index("1992 Q1" ~ .)

fit_beer <- beer_recent |>
  model(tslm = TSLM(Beer ~ trend() + season()))

tidy(fit_beer) |>
  select(term, estimate, std.error, statistic, p.value) |>
  fmt_tbl(digits = 3, caption = "TSLM regression of quarterly Australian beer production on linear trend and seasonal dummies.")
TSLM regression of quarterly Australian beer production on linear trend and seasonal dummies.
term estimate std.error statistic p.value
(Intercept) 441.80 3.734 118.333 0
trend() -0.34 0.067 -5.111 0
season()year2 -34.66 3.968 -8.734 0
season()year3 -17.82 4.022 -4.430 0
season()year4 72.80 4.023 18.095 0
augment(fit_beer) |>
  ggplot(aes(x = Quarter)) +
  geom_line(aes(y = Beer, colour = "Observed"), linewidth = 0.65) +
  geom_line(aes(y = .fitted, colour = "TSLM Fitted"), linewidth = 0.85, linetype = "dashed") +
  scale_colour_manual(values = c("Observed" = unname(ts_pal["navy"]), "TSLM Fitted" = unname(ts_pal["orange"]))) +
  labs(
    title = "TSLM Fit: Australian Quarterly Beer Production",
    subtitle = "Beer ~ trend() + season() captures linear decline and Q4 holiday peaks",
    x = "Quarter", y = "Megalitres", colour = NULL
  )
Figure 1: Quarterly Australian beer production (1992 Q1 onward) with fitted TSLM values from linear trend and quarterly seasonal indicators.

2. Multicollinearity and Variance Inflation Factors

When explanatory variables are strongly correlated with one another, OLS cannot reliably separate their individual partial effects. We quantify multicollinearity for predictor \(j\) using the Variance Inflation Factor (VIF):

\[ \text{VIF}_j = \frac{1}{1 - R_j^2}, \]

where \(R_j^2\) is the \(R^2\) from regressing predictor \(x_j\) on all remaining predictors. As a practical benchmark, \(\text{VIF}_j > 5\) signals moderate collinearity and \(\text{VIF}_j > 10\) signals severe variance inflation (standard errors more than tripled relative to orthogonal predictors). Note that multicollinearity inflates parameter variance and destabilizes individual signs without necessarily hurting in-sample fit.

When computing car::vif(), pass a clean lm() object containing only the response and numeric predictors (never include the tsibble time index column in the formula). Let us evaluate us_change macroeconomic predictors:

fit_us_tslm <- us_change |>
  model(ols = TSLM(Consumption ~ Income + Production + Savings + Unemployment))

fit_us_lm <- lm(Consumption ~ Income + Production + Savings + Unemployment, data = us_change)

tidy(fit_us_tslm) |>
  select(term, estimate, std.error, statistic, p.value) |>
  left_join(
    tibble(term = names(car::vif(fit_us_lm)), VIF = as.numeric(car::vif(fit_us_lm))),
    by = "term"
  ) |>
  fmt_tbl(digits = 3, caption = "TSLM estimates and VIF diagnostics for U.S. quarterly consumption growth (us_change).")
TSLM estimates and VIF diagnostics for U.S. quarterly consumption growth (us_change).
term estimate std.error statistic p.value VIF
(Intercept) 0.253 0.034 7.343 0.000 NA
Income 0.741 0.040 18.461 0.000 2.671
Production 0.047 0.023 2.038 0.043 2.537
Savings -0.053 0.003 -18.088 0.000 2.506
Unemployment -0.175 0.096 -1.829 0.069 2.520

All four predictors in us_change have modest VIF values below 3, indicating well-conditioned estimation. When severe collinearity does occur, standard remedies include dropping redundant variables, combining collinear indicators into a composite index or ratio, differencing shared trends, or using regularized regression.

3. Spurious Regression: Monte Carlo Demonstration

Regressing one non-stationary random walk on an entirely independent random walk creates one of the most dangerous illusions in applied statistics (Granger-Newbold spurious regression):

\[ Y_t = Y_{t-1} + u_t, \qquad X_t = X_{t-1} + v_t, \qquad u_t \perp v_t. \]

Even though \(\beta_1 = 0\) identically, OLS in levels \(Y_t = \beta_0 + \beta_1 X_t + \varepsilon_t\) yields a non-stationary residual \(\varepsilon_t\) whose autocorrelation destroys standard \(t\)-test asymptotics. As \(n \to \infty\), the false rejection rate approaches 100%! Differencing both series (\(\Delta Y_t = \alpha + \beta_1 \Delta X_t + e_t\)) restores exact nominal 5% Type I error.

set.seed(493)
n_sim <- 400
n_obs <- 200

mc_res <- purrr::map_dfr(seq_len(n_sim), function(i) {
  x <- cumsum(rnorm(n_obs))
  y <- cumsum(rnorm(n_obs))
  m_lvl  <- summary(lm(y ~ x))
  m_diff <- summary(lm(diff(y) ~ diff(x)))
  tibble(
    r2_lvl = m_lvl$r.squared,
    p_lvl  = m_lvl$coefficients[2, 4],
    r2_diff = m_diff$r.squared,
    p_diff  = m_diff$coefficients[2, 4]
  )
})

tibble(
  Specification = c("Levels: Y_t ~ X_t (Spurious)", "First Differences: ΔY_t ~ ΔX_t"),
  `Median R²` = c(median(mc_res$r2_lvl), median(mc_res$r2_diff)),
  `Share with p < 0.05` = c(mean(mc_res$p_lvl < 0.05), mean(mc_res$p_diff < 0.05))
) |> fmt_tbl(digits = 3, caption = "Monte Carlo spurious regression across 400 independent random-walk pairs (n = 200).")
Monte Carlo spurious regression across 400 independent random-walk pairs (n = 200).
Specification Median R² Share with p < 0.05
Levels: Y_t ~ X_t (Spurious) 0.232 0.823
First Differences: ΔY_t ~ ΔX_t 0.002 0.045
set.seed(808)
rw_pair <- tibble(t = 1:200, X = cumsum(rnorm(200)), Y = cumsum(rnorm(200))) |>
  mutate(dX = X - lag(X), dY = Y - lag(Y))

r2_lvl  <- summary(lm(Y ~ X, rw_pair))$r.squared
r2_diff <- summary(lm(dY ~ dX, rw_pair))$r.squared

s1 <- rw_pair |>
  ggplot(aes(x = X, y = Y)) +
  geom_point(colour = ts_pal["crimson"], alpha = 0.65, size = 1.6) +
  geom_smooth(method = "lm", se = FALSE, colour = ts_pal["navy"], linewidth = 0.9) +
  labs(
    title = TeX(r"(Levels: $Y_t$ vs. $X_t$ (Random Walks))", bold = TRUE),
    subtitle = TeX(sprintf(r"(Spurious $R^2 = %.2f$)", r2_lvl)),
    x = TeX(r"($X_t$)", bold = TRUE),
    y = TeX(r"($Y_t$)", bold = TRUE)
  )

s2 <- rw_pair |>
  drop_na(dX, dY) |>
  ggplot(aes(x = dX, y = dY)) +
  geom_point(colour = ts_pal["teal"], alpha = 0.65, size = 1.6) +
  geom_smooth(method = "lm", se = FALSE, colour = ts_pal["navy"], linewidth = 0.9) +
  labs(
    title = TeX(r"(First Differences: $\Delta Y_t$ vs. $\Delta X_t$)", bold = TRUE),
    subtitle = TeX(sprintf(r"(Honest $R^2 = %.3f$)", r2_diff)),
    x = TeX(r"($\Delta X_t$)", bold = TRUE),
    y = TeX(r"($\Delta Y_t$)", bold = TRUE)
  )

(s1 | s2) +
  plot_layout(guides = "collect") &
  theme(legend.position = "bottom")
Figure 2: Single pair of independent random walks showing strong apparent correlation in levels (left) that vanishes completely after first differencing (right).

Practice Exercises

Exercise 1: Inducing and Diagnosing Multicollinearity on us_change

Add a near-duplicate predictor Income_proxy = Income + rnorm(n(), 0, 0.15) (set.seed(108)) to us_change. Fit an lm() model predicting Consumption with and without Income_proxy, and compare car::vif() and the standard error of Income.

Solution

Adding a noisy proxy of Income drives both Income and Income_proxy VIFs far above 10 and inflates the standard error of Income dramatically, even though the overall regression \(R^2\) barely changes.

set.seed(108)
us_col <- us_change |>
  as_tibble() |>
  mutate(Income_proxy = Income + rnorm(n(), 0, 0.15))

m_clean <- lm(Consumption ~ Income + Production + Savings + Unemployment, data = us_col)
m_col   <- lm(Consumption ~ Income + Income_proxy + Production + Savings + Unemployment, data = us_col)

tibble(
  Model = c("Clean predictors", "With near-duplicate Income_proxy"),
  `Income SE` = c(summary(m_clean)$coefficients["Income", "Std. Error"],
                  summary(m_col)$coefficients["Income", "Std. Error"]),
  `Income VIF` = c(car::vif(m_clean)["Income"], car::vif(m_col)["Income"]),
  `Adj. R²` = c(summary(m_clean)$adj.r.squared, summary(m_col)$adj.r.squared)
) |> fmt_tbl(digits = 3, caption = "Effect of severe collinearity on VIF, coefficient standard error, and adjusted R².")
Effect of severe collinearity on VIF, coefficient standard error, and adjusted R².
Model Income SE Income VIF Adj. R²
Clean predictors 0.040 2.671 0.763
With near-duplicate Income_proxy 0.165 44.729 0.762

Exercise 2: Levels vs. Log-Differenced Country GDPs

Extract annual GDP for "Australia" and "Sweden" from global_economy, join them by Year, and compare OLS regression in levels (Australia ~ Sweden) against OLS on annual log growth rates (Δ log(Australia) ~ Δ log(Sweden)). Report \(R^2\), slope \(t\)-statistic, and lag-1 residual autocorrelation for each.

Solution

In levels, shared global economic growth yields an \(R^2\) near 0.96 with heavily autocorrelated residuals (\(\hat{\rho}_1 > 0.7\)), invalidating OLS inference. On stationary log growth rates, the residual lag-1 autocorrelation drops near zero and \(R^2\) reflects honest annual co-movement in business cycles.

gdp_pair <- global_economy |>
  filter(Country %in% c("Australia", "Sweden")) |>
  as_tibble() |>
  select(Year, Country, GDP) |>
  pivot_wider(names_from = Country, values_from = GDP) |>
  drop_na() |>
  mutate(
    g_aus = log(Australia) - lag(log(Australia)),
    g_swe = log(Sweden) - lag(log(Sweden))
  )

m_gdp_lvl  <- lm(Australia ~ Sweden, data = gdp_pair)
m_gdp_diff <- lm(g_aus ~ g_swe, data = drop_na(gdp_pair))

tibble(
  Regression = c("Levels: GDP_AUS ~ GDP_SWE", "Log Growth: Δln(AUS) ~ Δln(SWE)"),
  `R²` = c(summary(m_gdp_lvl)$r.squared, summary(m_gdp_diff)$r.squared),
  `Slope t-stat` = c(summary(m_gdp_lvl)$coefficients[2, 3], summary(m_gdp_diff)$coefficients[2, 3]),
  `Resid lag-1 ACF` = c(
    acf(residuals(m_gdp_lvl), plot = FALSE)$acf[2],
    acf(residuals(m_gdp_diff), plot = FALSE)$acf[2]
  )
) |> fmt_tbl(digits = 3, caption = "Levels vs. log-growth regression between Australian and Swedish GDP.")
Levels vs. log-growth regression between Australian and Swedish GDP.
Regression R² Slope t-stat Resid lag-1 ACF
Levels: GDP_AUS ~ GDP_SWE 0.916 24.75 0.871
Log Growth: Δln(AUS) ~ Δln(SWE) 0.227 4.02 0.142

Key Takeaways

  • Classical OLS inference in TSLM() requires uncorrelated errors; positive serial correlation underestimates standard errors and produces spurious statistical significance.
  • Compute car::vif() on a clean lm() excluding the time index; VIF values above 5 to 10 flag severe multicollinearity that destabilizes individual slope estimates.
  • Regressing independent random walks in levels yields artificially high \(R^2\) and false rejections over 70% of the time at \(n = 200\).
  • Always verify stationarity of both variables and check residual autocorrelation before interpreting OLS regression statistics on time series.
Back to top