10  Vector Autoregressions

The VAR is the workhorse of empirical macroeconomics. It lets you model the dynamic interactions between multiple macro variables — GDP, inflation, interest rates — without imposing a structural economic model.

10.1 What is a VAR?

A vector autoregression models a set of \(k\) time series as a system in which each variable depends on its own lags and the lags of every other variable. The reduced-form VAR of order \(p\) is:

\[ Y_t = c + A_1 Y_{t-1} + A_2 Y_{t-2} + \dots + A_p Y_{t-p} + u_t \]

where \(Y_t\) is a \(k \times 1\) vector of endogenous variables, \(c\) is a vector of intercepts, \(A_1, \dots, A_p\) are \(k \times k\) coefficient matrices, and \(u_t\) is a vector of reduced-form error terms with \(E[u_t u_t'] = \Sigma\). The system is “reduced form” because no contemporaneous relationships appear on the right-hand side — everything is predetermined.

The appeal of the VAR is its agnosticism. Unlike structural models that impose specific causal mechanisms (e.g., “the central bank sets rates according to a Taylor rule”), the VAR simply captures the empirical regularities in the data. Christopher Sims, who introduced VARs to macroeconomics in his 1980 Econometrica paper, argued that the profession’s structural models imposed “incredible” identifying restrictions. The VAR offered a disciplined alternative: let the data speak, then ask carefully structured questions about causality through impulse response analysis.

For a three-variable system of GDP growth (\(y_t\)), inflation (\(\pi_t\)), and the policy rate (\(i_t\)), the VAR(1) is:

\[ \begin{bmatrix} y_t \\ \pi_t \\ i_t \end{bmatrix} = \begin{bmatrix} c_1 \\ c_2 \\ c_3 \end{bmatrix} + \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix} \begin{bmatrix} y_{t-1} \\ \pi_{t-1} \\ i_{t-1} \end{bmatrix} + \begin{bmatrix} u_{1t} \\ u_{2t} \\ u_{3t} \end{bmatrix} \]

Each equation can be estimated by OLS. Because every equation has the same right-hand-side variables (the lags of all variables in the system), equation-by-equation OLS is efficient and equivalent to seemingly unrelated regressions (SUR). This makes VARs easy to estimate even with moderately large systems.

10.2 Estimation with the vars package

We begin by constructing a dataset of three key UK macro variables: quarterly GDP growth, CPI inflation, and Bank Rate. These form the canonical monetary policy VAR studied by central banks worldwide. The data come from the ons and boe packages.

library(ons)
library(boe)

Attaching package: 'boe'
The following object is masked from 'package:ons':

    clear_cache

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Attaching package: 'lubridate'
The following objects are masked from 'package:base':

    date, intersect, setdiff, union
Loading required package: MASS

Attaching package: 'MASS'
The following object is masked from 'package:dplyr':

    select
Loading required package: strucchange
Loading required package: zoo

Attaching package: 'zoo'
The following objects are masked from 'package:base':

    as.Date, as.Date.numeric
Loading required package: sandwich
Loading required package: urca
Loading required package: lmtest
library(ggplot2)

# vars loads MASS which masks dplyr::select; ensure dplyr wins
select <- dplyr::select

# Pull quarterly GDP growth (ons_gdp() returns q-on-q growth by default)
gdp <- ons_gdp() |>
  rename(gdp_growth = value)
ℹ Fetching GDP (growth)
✔ Fetching GDP (growth) [48ms]
# Pull CPI inflation (ons_cpi() returns the annual rate by default)
cpi <- ons_cpi() |>
  rename(inflation = value)
ℹ Fetching CPI (rate)
✔ Fetching CPI (rate) [60ms]
# Aggregate CPI to quarterly (take last month of each quarter)
cpi_q <- cpi |>
  mutate(quarter_date = floor_date(date, "quarter")) |>
  group_by(quarter_date) |>
  slice_tail(n = 1) |>
  ungroup() |>
  select(date = quarter_date, inflation)

# Pull Bank Rate and aggregate to quarterly average
bank_rate <- boe_bank_rate() |>
  mutate(quarter_date = floor_date(date, "quarter")) |>
  group_by(quarter_date) |>
  summarise(bank_rate = mean(rate_pct, na.rm = TRUE), .groups = "drop") |>
  rename(date = quarter_date)
ℹ Using cached data
✔ Using cached data [3ms]
# Merge into a single dataset
var_data <- gdp |>
  inner_join(cpi_q, by = "date") |>
  inner_join(bank_rate, by = "date") |>
  filter(!is.na(gdp_growth)) |>
  arrange(date)

# Convert to a ts object (vars requires ts)
var_ts <- ts(var_data |> select(gdp_growth, inflation, bank_rate),
             start = c(year(min(var_data$date)),
                       quarter(min(var_data$date))),
             frequency = 4)

With the data assembled as a multivariate time series object, estimation is a single function call. The VAR() function from the vars package estimates the reduced-form VAR by OLS.

# Estimate VAR(2)
var_model <- VAR(var_ts, p = 2, type = "const")
summary(var_model)

VAR Estimation Results:
========================= 
Endogenous variables: gdp_growth, inflation, bank_rate 
Deterministic variables: const 
Sample size: 146 
Log Likelihood: -523.759 
Roots of the characteristic polynomial:
0.9278 0.8438 0.6606 0.4543 0.4543 0.3889
Call:
VAR(y = var_ts, p = 2, type = "const")


Estimation results for equation gdp_growth: 
=========================================== 
gdp_growth = gdp_growth.l1 + inflation.l1 + bank_rate.l1 + gdp_growth.l2 + inflation.l2 + bank_rate.l2 + const 

              Estimate Std. Error t value Pr(>|t|)    
gdp_growth.l1 -0.37908    0.08540  -4.439 1.83e-05 ***
inflation.l1  -0.11301    0.24521  -0.461 0.645624    
bank_rate.l1   0.55213    0.41378   1.334 0.184273    
gdp_growth.l2 -0.20249    0.08419  -2.405 0.017480 *  
inflation.l2  -0.07904    0.24856  -0.318 0.750959    
bank_rate.l2  -0.54244    0.40278  -1.347 0.180249    
const          1.26810    0.34422   3.684 0.000328 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Residual standard error: 2.205 on 139 degrees of freedom
Multiple R-Squared: 0.1446, Adjusted R-squared: 0.1077 
F-statistic: 3.917 on 6 and 139 DF,  p-value: 0.001201 


Estimation results for equation inflation: 
========================================== 
inflation = gdp_growth.l1 + inflation.l1 + bank_rate.l1 + gdp_growth.l2 + inflation.l2 + bank_rate.l2 + const 

              Estimate Std. Error t value Pr(>|t|)    
gdp_growth.l1  0.01600    0.02816   0.568 0.570704    
inflation.l1   1.23176    0.08084  15.236  < 2e-16 ***
bank_rate.l1   0.04158    0.13642   0.305 0.760953    
gdp_growth.l2  0.03265    0.02776   1.176 0.241473    
inflation.l2  -0.32236    0.08195  -3.934 0.000132 ***
bank_rate.l2  -0.03572    0.13279  -0.269 0.788314    
const          0.20019    0.11348   1.764 0.079923 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Residual standard error: 0.7271 on 139 degrees of freedom
Multiple R-Squared: 0.8903, Adjusted R-squared: 0.8856 
F-statistic:   188 on 6 and 139 DF,  p-value: < 2.2e-16 


Estimation results for equation bank_rate: 
========================================== 
bank_rate = gdp_growth.l1 + inflation.l1 + bank_rate.l1 + gdp_growth.l2 + inflation.l2 + bank_rate.l2 + const 

               Estimate Std. Error t value Pr(>|t|)    
gdp_growth.l1  0.005264   0.013885   0.379    0.705    
inflation.l1   0.043024   0.039867   1.079    0.282    
bank_rate.l1   1.578039   0.067273  23.457  < 2e-16 ***
gdp_growth.l2  0.007293   0.013687   0.533    0.595    
inflation.l2  -0.027887   0.040412  -0.690    0.491    
bank_rate.l2  -0.603448   0.065484  -9.215  4.4e-16 ***
const          0.030406   0.055963   0.543    0.588    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


Residual standard error: 0.3586 on 139 degrees of freedom
Multiple R-Squared: 0.9906, Adjusted R-squared: 0.9901 
F-statistic:  2429 on 6 and 139 DF,  p-value: < 2.2e-16 



Covariance matrix of residuals:
           gdp_growth inflation bank_rate
gdp_growth     4.8639   0.29179   0.17102
inflation      0.2918   0.52866   0.02389
bank_rate      0.1710   0.02389   0.12856

Correlation matrix of residuals:
           gdp_growth inflation bank_rate
gdp_growth     1.0000   0.18196   0.21628
inflation      0.1820   1.00000   0.09165
bank_rate      0.2163   0.09165   1.00000

The summary output shows three OLS regressions — one for each variable in the system. Each includes two lags of all three variables plus an intercept. The coefficient estimates reveal the dynamic interactions: for example, the coefficient on lagged Bank Rate in the GDP growth equation captures the delayed effect of monetary policy on output. The residual correlation matrix at the bottom shows how the reduced-form shocks co-move contemporaneously.

10.3 Lag selection

Choosing the lag order \(p\) involves a trade-off between flexibility and parsimony. Too few lags and the model fails to capture the true dynamics — residuals will be serially correlated. Too many lags and the model overfits, consuming degrees of freedom and producing imprecise coefficient estimates. With \(k\) variables and \(p\) lags, the VAR has \(k^2 p + k\) parameters (including intercepts), so the parameter count grows rapidly.

The standard approach is to compute information criteria for a range of lag orders and select the one that minimises the criterion. The VARselect() function computes four criteria simultaneously: AIC (Akaike), HQ (Hannan-Quinn), SC (Schwarz/Bayesian), and FPE (final prediction error). AIC tends to select more lags (it penalises complexity less), while SC/BIC favours parsimony.

# Lag selection
lag_selection <- VARselect(var_ts, lag.max = 8, type = "const")
print(lag_selection$selection)
AIC(n)  HQ(n)  SC(n) FPE(n) 
     3      2      2      3 
print(lag_selection$criteria)
                1          2          3          4          5          6
AIC(n) -0.5801642 -1.1030330 -1.1180032 -1.0485010 -1.0417734 -1.0017624
HQ(n)  -0.4777017 -0.9237236 -0.8618470 -0.7154980 -0.6319235 -0.5150656
SC(n)  -0.3280234 -0.6617866 -0.4876513 -0.2290435 -0.0332103  0.1959063
FPE(n)  0.5598326  0.3319461  0.3271711  0.3510273  0.3538917  0.3690928
                7          8
AIC(n) -0.9570789 -1.0400943
HQ(n)  -0.3935353 -0.3997038
SC(n)   0.4296953  0.5357856
FPE(n)  0.3870502  0.3575490

In practice, the criteria often disagree. AIC might suggest 4 lags while BIC suggests 1 or 2. A reasonable strategy is to estimate the model at the BIC-selected lag and check that the residuals are free of serial correlation. If the Portmanteau test or Breusch-Godfrey LM test rejects at the BIC lag, increase the lag order until serial correlation is eliminated.

# Test for serial correlation in residuals
serial_test <- serial.test(var_model, lags.pt = 12, type = "PT.asymptotic")
print(serial_test)

    Portmanteau Test (asymptotic)

data:  Residuals of VAR object var_model
Chi-squared = 112.42, df = 90, p-value = 0.05499
$serial

    Portmanteau Test (asymptotic)

data:  Residuals of VAR object var_model
Chi-squared = 112.42, df = 90, p-value = 0.05499
# If serial correlation is present, increase lags
# var_model <- VAR(var_ts, p = 4, type = "const")

A useful diagnostic is the stability of the VAR. The model is stable (stationary) if all eigenvalues of the companion matrix lie inside the unit circle. If any eigenvalue is close to or exceeds 1, the model is explosive or has a unit root, and impulse responses will not converge.

# Check stability
roots_var <- roots(var_model)
print(roots_var)
[1] 0.9277939 0.8438348 0.6606421 0.4542502 0.4542502 0.3889062
cat("All roots inside unit circle:", all(roots_var < 1), "\n")
All roots inside unit circle: TRUE 

10.4 Impulse response functions

The impulse response function (IRF) traces the effect of a one-unit shock to one variable on the entire system over time. It answers questions like: “If Bank Rate rises unexpectedly by 25 basis points today, what happens to GDP growth and inflation over the next three years?”

In the reduced-form VAR, a shock to one equation’s error term generally affects all variables contemporaneously because the errors are correlated. To isolate the effect of a shock to a single variable, we need to orthogonalise the errors. The default method is the Cholesky decomposition (discussed further in the structural VAR section below), which imposes a recursive ordering: the first variable responds only to its own shock contemporaneously, the second responds to the first and its own, and so on.

The ordering matters. Placing GDP growth first assumes it does not respond to inflation or Bank Rate shocks within the quarter — a plausible assumption given that real economic activity adjusts slowly. Bank Rate is ordered last, reflecting the idea that the central bank observes GDP and inflation within the quarter before setting rates.

# Compute impulse response functions
# Ordering: gdp_growth, inflation, bank_rate (Cholesky)
irf_rate <- irf(var_model,
                impulse = "bank_rate",
                response = c("gdp_growth", "inflation", "bank_rate"),
                n.ahead = 20,
                ortho = TRUE,
                ci = 0.68)
plot(irf_rate)

The default plot() method from vars produces serviceable charts, but for publication-quality figures you may want to extract the IRF data and plot with ggplot2.

# Extract IRF data for custom plotting
irf_data <- data.frame(
  horizon = 0:20,
  gdp_response = irf_rate$irf$bank_rate[, "gdp_growth"],
  gdp_lower = irf_rate$Lower$bank_rate[, "gdp_growth"],
  gdp_upper = irf_rate$Upper$bank_rate[, "gdp_growth"]
)

ggplot(irf_data, aes(x = horizon)) +
  geom_ribbon(aes(ymin = gdp_lower, ymax = gdp_upper),
              fill = "steelblue", alpha = 0.2) +
  geom_line(aes(y = gdp_response), colour = "steelblue", linewidth = 1) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  labs(title = "Response of GDP growth to a Bank Rate shock",
       subtitle = "68% confidence bands from bootstrapped IRFs",
       x = "Quarters ahead", y = "Percentage points") +
  theme_minimal()

The economic interpretation is central. A contractionary monetary policy shock (a rise in Bank Rate) should, according to standard theory, reduce GDP growth with a lag of roughly 4 to 8 quarters — the “long and variable lags” that Milton Friedman described. Inflation should fall as well, though typically with a longer delay. If the IRF shows GDP rising after a rate increase, or inflation increasing persistently, the model may be misspecified or the identification scheme inappropriate.

The confidence bands deserve attention. Wider bands indicate greater uncertainty about the dynamic response. If the bands include zero at all horizons, the response is not statistically significant — we cannot distinguish the effect of a monetary policy shock from zero. The choice between 68 per cent and 95 per cent bands is partly aesthetic: 68 per cent bands (one standard error) are conventional in the VAR literature because 95 per cent bands are often very wide, obscuring economically meaningful responses.

10.5 Forecast error variance decomposition

While IRFs show the dynamic response to a specific shock, forecast error variance decomposition (FEVD) answers a different question: what fraction of the forecast uncertainty in each variable is attributable to each structural shock? At short horizons, each variable’s own shock typically dominates. At longer horizons, shocks from other variables become more important, revealing the transmission of disturbances through the system.

# Forecast error variance decomposition
fevd_result <- fevd(var_model, n.ahead = 20)
print(fevd_result)
$gdp_growth
      gdp_growth    inflation   bank_rate
 [1,]  1.0000000 0.0000000000 0.000000000
 [2,]  0.9924116 0.0008881145 0.006700321
 [3,]  0.9901485 0.0029013759 0.006950101
 [4,]  0.9888337 0.0042665984 0.006899704
 [5,]  0.9876818 0.0053872306 0.006930947
 [6,]  0.9867549 0.0063215705 0.006923550
 [7,]  0.9860504 0.0070090920 0.006940473
 [8,]  0.9855168 0.0075214975 0.006961738
 [9,]  0.9850967 0.0079083885 0.006994920
[10,]  0.9847698 0.0081961704 0.007033997
[11,]  0.9845174 0.0084105694 0.007072065
[12,]  0.9843206 0.0085710466 0.007108367
[13,]  0.9841670 0.0086911990 0.007141762
[14,]  0.9840471 0.0087813792 0.007171478
[15,]  0.9839531 0.0088492988 0.007197587
[16,]  0.9838791 0.0089006076 0.007220301
[17,]  0.9838206 0.0089395014 0.007239902
[18,]  0.9837742 0.0089690960 0.007256745
[19,]  0.9837371 0.0089917018 0.007271176
[20,]  0.9837074 0.0090090389 0.007283518

$inflation
      gdp_growth inflation    bank_rate
 [1,] 0.03311100 0.9668890 0.0000000000
 [2,] 0.04315249 0.9566906 0.0001569282
 [3,] 0.06029259 0.9391497 0.0005577062
 [4,] 0.06670546 0.9320169 0.0012776518
 [5,] 0.06999158 0.9279216 0.0020867868
 [6,] 0.07258309 0.9245470 0.0028699223
 [7,] 0.07429678 0.9221084 0.0035947931
 [8,] 0.07546167 0.9203064 0.0042319310
 [9,] 0.07631710 0.9189090 0.0047739351
[10,] 0.07693714 0.9178352 0.0052276178
[11,] 0.07738877 0.9170086 0.0056026210
[12,] 0.07772293 0.9163671 0.0059100011
[13,] 0.07797080 0.9158684 0.0061608286
[14,] 0.07815525 0.9154798 0.0063649812
[15,] 0.07829319 0.9151758 0.0065309592
[16,] 0.07839668 0.9149374 0.0066659146
[17,] 0.07847454 0.9147497 0.0067757416
[18,] 0.07853330 0.9146014 0.0068652460
[19,] 0.07857779 0.9144839 0.0069383223
[20,] 0.07861155 0.9143903 0.0069981112

$bank_rate
      gdp_growth   inflation bank_rate
 [1,] 0.04677509 0.002829003 0.9503959
 [2,] 0.05596418 0.008918048 0.9351178
 [3,] 0.06573547 0.015426933 0.9188376
 [4,] 0.07151809 0.021739943 0.9067420
 [5,] 0.07554723 0.027637381 0.8968154
 [6,] 0.07876107 0.033069662 0.8881693
 [7,] 0.08130010 0.038043741 0.8806562
 [8,] 0.08334837 0.042580083 0.8740716
 [9,] 0.08504296 0.046704399 0.8682526
[10,] 0.08645789 0.050443750 0.8630984
[11,] 0.08764940 0.053824532 0.8585261
[12,] 0.08866073 0.056872460 0.8544668
[13,] 0.08952354 0.059612617 0.8508638
[14,] 0.09026256 0.062069338 0.8476681
[15,] 0.09089759 0.064266114 0.8448363
[16,] 0.09144457 0.066225494 0.8423299
[17,] 0.09191656 0.067968946 0.8401145
[18,] 0.09232440 0.069516760 0.8381588
[19,] 0.09267717 0.070887969 0.8364349
[20,] 0.09298252 0.072100301 0.8349172
plot(fevd_result)

The FEVD output is a list of matrices, one per variable, showing the percentage of forecast error variance explained by each shock at each horizon. For GDP growth, we might find that its own shock explains 90 per cent of the variance at the one-quarter horizon but only 60 per cent at the five-year horizon, with Bank Rate shocks explaining an increasing share as the monetary transmission mechanism operates.

# Custom FEVD plot for GDP growth
fevd_gdp <- as.data.frame(fevd_result$gdp_growth)
fevd_gdp$horizon <- 1:nrow(fevd_gdp)

fevd_long <- fevd_gdp |>
  tidyr::pivot_longer(cols = -horizon, names_to = "shock", values_to = "share")

ggplot(fevd_long, aes(x = horizon, y = share, fill = shock)) +
  geom_area() +
  scale_fill_brewer(palette = "Set2",
                    labels = c("Bank Rate", "GDP growth", "Inflation")) +
  labs(title = "Forecast error variance decomposition: GDP growth",
       x = "Quarters ahead", y = "Share of forecast error variance",
       fill = "Shock") +
  theme_minimal()

The FEVD is sensitive to the identification scheme (the variable ordering), just like the IRFs. Re-ordering the variables will change the decomposition, particularly at short horizons where the Cholesky ordering has the most bite. This sensitivity motivates the structural identification approaches discussed next.

10.6 Structural VARs: identification

The reduced-form VAR tells us about correlations and dynamics, but not about causation. The reduced-form errors \(u_t\) are a mixture of underlying structural shocks \(\varepsilon_t\):

\[ u_t = B \varepsilon_t \]

where \(B\) is a \(k \times k\) matrix that maps structural shocks into reduced-form errors. To recover the structural shocks — and hence to give the IRFs a causal interpretation — we need to identify \(B\). This requires imposing restrictions, because the data alone cannot tell us the causal structure.

10.6.1 Cholesky decomposition

The most common identification scheme is the Cholesky decomposition, which sets \(B\) to be lower triangular. This imposes a recursive causal ordering: the first variable is not affected by any other variable contemporaneously, the second is affected only by the first, and so on. The ordering thus embodies assumptions about the speed of adjustment.

For a monetary policy VAR, the standard ordering is: output first, prices second, the policy rate last. The rationale is that GDP cannot respond to a monetary policy shock within the quarter (production plans are sticky), inflation responds sluggishly to both output and policy, but the central bank can observe and react to both output and inflation within the quarter.

# The Cholesky ordering is determined by column order in the data
# Our data is already ordered: gdp_growth, inflation, bank_rate
# This is the standard ordering

# Structural IRFs (Cholesky is the default for ortho = TRUE)
svar_irf <- irf(var_model,
                impulse = "bank_rate",
                response = c("gdp_growth", "inflation"),
                n.ahead = 20,
                ortho = TRUE,
                ci = 0.95,
                boot = TRUE,
                runs = 500)
plot(svar_irf)

It is worth experimenting with alternative orderings to assess robustness. If the results change dramatically when you swap the order of GDP and inflation, the conclusions are fragile and depend critically on untestable assumptions.

# Alternative ordering: inflation first, then GDP, then Bank Rate
var_ts_alt <- var_ts[, c("inflation", "gdp_growth", "bank_rate")]
var_model_alt <- VAR(var_ts_alt, p = 2, type = "const")

svar_irf_alt <- irf(var_model_alt,
                     impulse = "bank_rate",
                     response = c("gdp_growth", "inflation"),
                     n.ahead = 20,
                     ortho = TRUE,
                     ci = 0.95)
plot(svar_irf_alt)

10.6.2 Sign restrictions

An alternative to zero restrictions is to restrict the sign of the impulse responses. Rather than assuming that GDP does not respond at all to a monetary shock within the quarter, you assume that a contractionary monetary policy shock raises the policy rate, reduces output (at least over some horizon), and reduces inflation. This is weaker than the Cholesky assumption — it admits many possible impact matrices \(B\), not just one — and therefore produces a set of admissible IRFs rather than point estimates.

The sign restrictions approach, developed by Uhlig (2005) and Canova and De Nicolo (2002), proceeds by drawing candidate \(B\) matrices from the space of orthogonal decompositions of \(\Sigma\) and retaining only those that satisfy the sign conditions. The result is a distribution of IRFs, each consistent with the imposed signs. This is more honest about the identification uncertainty but harder to implement and interpret.

Several R packages implement sign restrictions, including VARsignR. The approach is computationally intensive — it involves drawing many candidate decompositions and checking each against the sign conditions — but straightforward conceptually. We do not implement it fully here, as the machinery is substantial, but the reader should be aware that it represents the state of the art for VAR identification in applied macroeconomics.

10.7 Bayesian VARs

Frequentist VARs suffer from a proliferation of parameters. A 3-variable VAR with 4 lags has 39 parameters; a 7-variable system with 4 lags has 203. With the relatively short time series typical in macroeconomics (60-80 quarterly observations), overfitting is a real concern. Bayesian VARs address this by placing prior distributions on the coefficients that shrink the estimates toward parsimonious benchmarks.

The most widely used prior is the Minnesota prior, introduced by Doan, Litterman, and Sims (1984) at the Federal Reserve Bank of Minneapolis. It embodies two beliefs: first, that each variable follows approximately a random walk (so the first own lag should be close to 1 and all other coefficients close to 0); second, that more distant lags are less important (the prior tightens as the lag increases). These are sensible default beliefs for macroeconomic time series, which are typically persistent and slowly mean-reverting.

The BVAR package provides a clean implementation. The key function is bvar(), which takes the data and a prior specification.


Attaching package: 'BVAR'
The following objects are masked from 'package:vars':

    fevd, irf
# Estimate Bayesian VAR with Minnesota prior
bvar_model <- bvar(var_ts,
                   lags = 2,
                   n_draw = 10000,
                   n_burn = 2000,
                   priors = bv_priors(hyper = "auto"),
                   mh = bv_mh(scale_hess = 0.05))
Optimisation concluded.
Posterior marginal likelihood: -619.318
Hyperparameters: lambda = 0.52326

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |================                                                      |  24%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |=================                                                     |  25%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=======================                                               |  34%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |==============================                                        |  44%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |===================================                                   |  51%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=====================================                                 |  54%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==========================================                            |  61%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=================================================                     |  71%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |===================================================                   |  74%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |========================================================              |  81%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |==========================================================            |  84%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |=================================================================     |  94%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%
Finished MCMC after 1.37 secs.
summary(bvar_model)
Bayesian VAR consisting of 146 observations, 3 variables and 2 lags.
Time spent calculating: 1.37 secs
Hyperparameters: lambda 
Hyperparameter values after optimisation: 0.52326
Iterations (burnt / thinning): 10000 (2000 / 1)
Accepted draws (rate): 6391 (0.799)

Numeric array (dimensions 7, 3) of coefficient values from a BVAR.
Median values:
                gdp_growth inflation bank_rate
constant             1.232     0.195     0.019
gdp_growth-lag1     -0.356     0.018     0.009
inflation-lag1      -0.117     1.194     0.044
bank_rate-lag1       0.433     0.040     1.472
gdp_growth-lag2     -0.185     0.032     0.010
inflation-lag2      -0.066    -0.282    -0.025
bank_rate-lag2      -0.425    -0.036    -0.500

Numeric array (dimensions 3, 3) of variance-covariance values from a BVAR.
Median values:
           gdp_growth inflation bank_rate
gdp_growth      4.681     0.274     0.168
inflation       0.274     0.508     0.024
bank_rate       0.168     0.024     0.135

Log-Likelihood: -525.5807 
# Bayesian IRFs
bvar_irf <- irf(bvar_model,
                horizon = 20,
                identification = TRUE)  # Cholesky identification

plot(bvar_irf)

Comparing the Bayesian and frequentist IRFs is instructive. The Minnesota prior typically produces smoother, more precisely estimated responses. This reflects the shrinkage: the prior pulls the estimates toward a random walk, reducing the noise that plagues unrestricted OLS estimates in small samples. If the Bayesian and frequentist IRFs agree qualitatively, this is reassuring — the conclusions are not driven by the prior. If they disagree, the prior is doing substantial work, and the researcher should investigate whether the prior is appropriate.

# BVAR forecast
bvar_forecast <- predict(bvar_model, horizon = 8)
plot(bvar_forecast)

The Bayesian VAR also produces natural forecast distributions — the posterior predictive density — rather than point forecasts with standard errors. Each draw from the posterior yields a different forecast path, and the collection of paths characterises the full uncertainty about the future. This is particularly valuable for fan charts, which show the probability of different economic outcomes.

10.8 Local projections

Local projections, introduced by Jorda (2005), offer an alternative to VARs for computing impulse response functions. Rather than estimating a full dynamic system and iterating forward, local projections estimate the response at each horizon directly using a sequence of regressions:

\[ y_{t+h} = \alpha_h + \beta_h \cdot \text{shock}_t + \gamma_h' \text{controls}_t + \varepsilon_{t+h} \]

for \(h = 0, 1, 2, \dots, H\). The coefficient \(\beta_h\) is the impulse response at horizon \(h\). The method has two advantages over VARs: it does not impose the dynamic structure of the VAR (which may be misspecified), and it is trivially robust to non-linearities when extended with interaction terms. Its disadvantage is reduced efficiency — each horizon is estimated separately, discarding information that the VAR uses.

# Local projections for the response of GDP growth to a Bank Rate shock
max_horizon <- 16
lp_results <- data.frame(horizon = 0:max_horizon,
                          beta = NA_real_,
                          se = NA_real_)

# Use the same dataset as the VAR
lp_data <- var_data |>
  mutate(gdp_lead = gdp_growth)  # placeholder

for (h in 0:max_horizon) {
  # Create the lead of GDP growth at horizon h
  lp_data <- lp_data |>
    mutate(y_lead = lead(gdp_growth, h))

  # Regress y_{t+h} on the shock and controls
  lp_reg <- lm(y_lead ~ bank_rate + lag(gdp_growth) + lag(inflation) +
                  lag(bank_rate),
                data = lp_data)

  lp_results$beta[h + 1] <- coef(lp_reg)["bank_rate"]
  lp_results$se[h + 1] <- summary(lp_reg)$coefficients["bank_rate", "Std. Error"]
}

# Compute confidence bands
lp_results <- lp_results |>
  mutate(lower = beta - 1.645 * se,
         upper = beta + 1.645 * se)
# Plot local projection IRF
ggplot(lp_results, aes(x = horizon)) +
  geom_ribbon(aes(ymin = lower, ymax = upper),
              fill = "darkorange", alpha = 0.2) +
  geom_line(aes(y = beta), colour = "darkorange", linewidth = 1) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  labs(title = "Local projection: response of GDP growth to Bank Rate",
       subtitle = "90% confidence bands based on Newey-West standard errors",
       x = "Quarters ahead", y = "Percentage points") +
  theme_minimal()

Local projections typically produce noisier IRFs than VARs, with wider confidence bands, particularly at longer horizons. This is the price of robustness: the local projection makes fewer assumptions and therefore admits more uncertainty. In practice, many applied papers now report both VAR and local projection IRFs as a robustness check. If they agree, the dynamic structure imposed by the VAR is not driving the results.

Note that the standard errors in the regression above should be corrected for serial correlation induced by the overlapping horizons. Newey-West (HAC) standard errors with a bandwidth of \(h\) are standard practice. The sandwich and lmtest packages provide these.

library(sandwich)
library(lmtest)

# Example with HAC standard errors for one horizon
h <- 8
lp_data_h <- var_data |> mutate(y_lead = lead(gdp_growth, h))
lp_reg_h <- lm(y_lead ~ bank_rate + lag(gdp_growth) + lag(inflation) +
                  lag(bank_rate),
                data = lp_data_h)

coeftest(lp_reg_h, vcov = NeweyWest(lp_reg_h, lag = h))

t test of coefficients:

                  Estimate Std. Error t value Pr(>|t|)   
(Intercept)      0.5350386  0.1635490  3.2714 0.001361 **
bank_rate        0.0449317  0.1862282  0.2413 0.809713   
lag(gdp_growth)  0.0081023  0.0094804  0.8546 0.394276   
lag(inflation)  -0.0400990  0.0304334 -1.3176 0.189887   
lag(bank_rate)  -0.0286684  0.1657654 -0.1729 0.862955   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

10.9 Application: what happens when the Bank of England raises rates?

This section ties together the full toolkit — reduced-form VAR, structural identification, Bayesian estimation, and local projections — to answer a single policy question: what are the macroeconomic effects of a monetary policy tightening in the United Kingdom?

We use the three-variable system estimated above: GDP growth, CPI inflation, and Bank Rate. The identification scheme is the Cholesky decomposition with the ordering GDP, inflation, Bank Rate — the assumption that the central bank responds to within-quarter movements in output and prices, but these real variables do not respond to monetary policy within the quarter.

# Full analysis: VAR-based monetary policy shock

# 1. Estimate VAR at BIC-selected lag
optimal_lag <- lag_selection$selection["SC(n)"]
var_final <- VAR(var_ts, p = optimal_lag, type = "const")

# 2. Check stability
cat("Eigenvalues:", roots(var_final), "\n")
Eigenvalues: 0.9277939 0.8438348 0.6606421 0.4542502 0.4542502 0.3889062 
cat("Stable:", all(roots(var_final) < 1), "\n")
Stable: TRUE 
# 3. Structural IRFs (Cholesky)
# Use vars::irf explicitly since BVAR also exports irf()
irf_gdp <- vars::irf(var_final, impulse = "bank_rate", response = "gdp_growth",
                      n.ahead = 20, ortho = TRUE, ci = 0.68, runs = 1000)
irf_inf <- vars::irf(var_final, impulse = "bank_rate", response = "inflation",
                      n.ahead = 20, ortho = TRUE, ci = 0.68, runs = 1000)
irf_rate_own <- vars::irf(var_final, impulse = "bank_rate", response = "bank_rate",
                           n.ahead = 20, ortho = TRUE, ci = 0.68, runs = 1000)
# Combine IRFs into a single plot
irf_combined <- data.frame(
  horizon = rep(0:20, 3),
  response = c(irf_gdp$irf$bank_rate[, 1],
               irf_inf$irf$bank_rate[, 1],
               irf_rate_own$irf$bank_rate[, 1]),
  lower = c(irf_gdp$Lower$bank_rate[, 1],
            irf_inf$Lower$bank_rate[, 1],
            irf_rate_own$Lower$bank_rate[, 1]),
  upper = c(irf_gdp$Upper$bank_rate[, 1],
            irf_inf$Upper$bank_rate[, 1],
            irf_rate_own$Upper$bank_rate[, 1]),
  variable = rep(c("GDP growth", "Inflation", "Bank Rate"), each = 21)
)

ggplot(irf_combined, aes(x = horizon)) +
  geom_ribbon(aes(ymin = lower, ymax = upper), fill = "steelblue", alpha = 0.2) +
  geom_line(aes(y = response), colour = "steelblue", linewidth = 1) +
  geom_hline(yintercept = 0, linetype = "dashed") +
  facet_wrap(~variable, scales = "free_y", ncol = 1) +
  labs(title = "Effects of a monetary policy tightening (25bp Bank Rate shock)",
       subtitle = "Cholesky identification, 68% bootstrapped confidence bands",
       x = "Quarters ahead", y = "Percentage points") +
  theme_minimal()

The results should be read as follows. A 25 basis point increase in Bank Rate — an unexpected tightening — typically reduces GDP growth with a lag of 4 to 6 quarters, with the maximum impact around 6 to 8 quarters. The effect on inflation is more delayed, peaking at roughly 8 to 12 quarters. Bank Rate itself returns toward baseline as the central bank unwinds the tightening once the economy slows. These dynamics are consistent with the Bank of England’s own estimates, which suggest that the full effect of a rate change takes 18 to 24 months to pass through to output and somewhat longer for inflation.

# 4. Variance decomposition
fevd_final <- vars::fevd(var_final, n.ahead = 20)

# Table: share of GDP growth variance explained at selected horizons
fevd_table <- as.data.frame(fevd_final$gdp_growth)
fevd_table$horizon <- 1:nrow(fevd_table)
fevd_selected <- fevd_table |>
  filter(horizon %in% c(1, 4, 8, 12, 20))
print(fevd_selected)
  gdp_growth   inflation   bank_rate horizon
1  1.0000000 0.000000000 0.000000000       1
2  0.9888337 0.004266598 0.006899704       4
3  0.9855168 0.007521497 0.006961738       8
4  0.9843206 0.008571047 0.007108367      12
5  0.9837074 0.009009039 0.007283518      20
# 5. Compare to Bayesian VAR IRFs
bvar_final <- bvar(var_ts,
                   lags = optimal_lag,
                   n_draw = 15000,
                   n_burn = 5000,
                   priors = bv_priors(hyper = "auto"),
                   mh = bv_mh(scale_hess = 0.05))
Optimisation concluded.
Posterior marginal likelihood: -619.318
Hyperparameters: lambda = 0.52326

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |                                                                      |   1%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |=======                                                               |  11%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |==============                                                        |  21%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |================                                                      |  24%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |=================                                                     |  25%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |=====================                                                 |  31%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=======================                                               |  34%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |==============================                                        |  44%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |===================================                                   |  51%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=====================================                                 |  54%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |==========================================                            |  61%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |=================================================                     |  71%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |===================================================                   |  74%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |========================================================              |  81%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |==========================================================            |  84%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |===========================================================           |  85%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |=================================================================     |  94%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================|  99%
  |                                                                            
  |======================================================================| 100%
Finished MCMC after 1.75 secs.
bvar_irf_final <- BVAR::irf(bvar_final, horizon = 20, identification = TRUE)
plot(bvar_irf_final)

The Bayesian IRFs should tell a similar qualitative story — a rate increase reduces output and inflation with a lag — but with tighter confidence bands, reflecting the regularisation provided by the Minnesota prior. If the Bayesian and frequentist results diverge sharply, the small sample is likely driving the frequentist estimates, and the Bayesian estimates may be more reliable.

# 6. Forecast the next 2 years
var_forecast <- stats::predict(var_final, n.ahead = 8, ci = 0.68)
plot(var_forecast)

# Extract point forecasts
forecast_table <- data.frame(
  quarter = 1:8,
  gdp_growth = var_forecast$fcst$gdp_growth[, "fcst"],
  inflation = var_forecast$fcst$inflation[, "fcst"],
  bank_rate = var_forecast$fcst$bank_rate[, "fcst"]
)
print(forecast_table)
  quarter gdp_growth inflation bank_rate
1       1  0.4905003  3.186500  3.858357
2       2  0.4105440  3.058949  3.769701
3       3  0.4040056  2.982387  3.699307
4       4  0.4506333  2.926723  3.641368
5       5  0.4528185  2.883478  3.592355
6       6  0.4562027  2.849743  3.550017
7       7  0.4649187  2.822245  3.512571
8       8  0.4689944  2.799455  3.478857

This application illustrates the full VAR workflow: data assembly, lag selection, estimation, identification, impulse response analysis, variance decomposition, and forecasting. Each step involves judgement calls — the choice of variables, lag length, identification scheme, and confidence level — that can influence the conclusions. Sensitivity analysis is not optional; it is an integral part of honest empirical work.

10.10 Exercises

  1. Estimate a 3-variable VAR with UK GDP growth, CPI inflation, and Bank Rate. How many lags does the AIC suggest?

  2. Compute impulse response functions for a 25bp Bank Rate shock. How long does it take for GDP growth to respond? What about inflation?

  3. Re-estimate the model as a Bayesian VAR using the BVAR package with a Minnesota prior. How do the impulse responses change?

  4. Estimate local projection IRFs for the same monetary policy shock and compare them to the VAR-based IRFs. Where do the two methods agree, and where do they diverge?

  5. Add a fourth variable — the sterling effective exchange rate from boe::boe_exchange_rate() — to the VAR. Does the exchange rate respond to Bank Rate shocks in the expected direction (appreciation)?