Search

Search papers and lessons

Vector Autoregression

Level 3 · 13 min read

A vector autoregression (VAR) models several time series at once, predicting each one from the past values of all of them, with plain least squares fitting every equation.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Linear algebra
  • Losses & regularization
  • Stochastic processes
  • Sign in to see your progress

TL;DR

A vector autoregression, or VAR, is a model for several time series at once. Each variable is predicted from its own past values and from the past values of every other variable in the system. Each equation is an ordinary linear regression, so the whole model is fitted with tools you already know.

VARs let the variables talk to each other. An interest rate can depend on last month's inflation, and inflation can depend on last month's rate, all in one model.

Where you'll see it: in macroeconomic forecasting, where a handful of variables such as output, inflation and the policy rate are modelled together, and in studies that trace how a shock to one variable spreads to the others.

This lesson explains a statistical model. It is not financial or economic advice.

Intuition

One variable, then several

A single series can be forecast from its own history. If this month's temperature is close to last month's, a simple Autoregressive Model that says "tomorrow looks like today, a bit adjusted" does well. That is one equation with one variable.

Now suppose you track two things, say the number of rabbits and the number of foxes in a field. Rabbits today depend on rabbits yesterday, but also on how many foxes ate them. Foxes today depend on foxes yesterday, and on how many rabbits were available to eat. A model that uses only each series' own past misses the second effect. A VAR keeps both series and lets each one use the other's history.

The picture is a set of gears. Turn one and the others move with it, a little later and by an amount set by the model.

Why not just write a big structural model?

Economists used to build large models with dozens of equations, each carrying a theory about how one variable responds to another. Christopher Sims argued in 1980 that many of those restrictions were imposed for convenience rather than learned from the data. A VAR takes the opposite route. It lets every variable depend on the past of every other variable, and lets the data decide which links matter. You pay for that freedom with many parameters, and you have to be careful about how you read the results. Both points come up below.

The math

The model

Definition: Vector autoregression of order p

Let yt\mathbf{y}_t be a column vector of KK variables observed at time tt. A VAR(pp) is

yt=c+A1yt−1+A2yt−2+⋯+Apyt−p+εt\mathbf{y}_t = \mathbf{c} + A_1 \mathbf{y}_{t-1} + A_2 \mathbf{y}_{t-2} + \cdots + A_p \mathbf{y}_{t-p} + \boldsymbol{\varepsilon}_t

where c\mathbf{c} is a vector of constants, each AiA_i is a K×KK \times K matrix of coefficients, pp is the number of lags (how many past periods feed in), and εt\boldsymbol{\varepsilon}_t is a vector of shocks.

Read it one row at a time. Row jj says that variable jj today equals a constant, plus a weighted sum of all KK variables from the last pp periods, plus its own shock. The matrix AiA_i holds the weights: entry (j,k)(j, k) of AiA_i says how much variable kk at lag ii pushes variable jj today.

The shocks εt\boldsymbol{\varepsilon}_t are assumed to be White Noise in the vector sense. Each has mean zero, no link to its own past, and a covariance matrix Σ\Sigma that does not change over time. Because the shocks in one equation can be correlated with the shocks in another, Σ\Sigma is generally not diagonal. The entries of Σ\Sigma form the Covariance Matrix of the shocks.

The simplest case: two variables, one lag

Take K=2K = 2 and p=1p = 1, with no constant and no shocks for now:

xt=0.5 xt−1+0.2 zt−1zt=0.1 xt−1+0.6 zt−1\begin{aligned} x_t &= 0.5\,x_{t-1} + 0.2\,z_{t-1} \\ z_t &= 0.1\,x_{t-1} + 0.6\,z_{t-1} \end{aligned}

Here yt=(xt,zt)⊤\mathbf{y}_t = (x_t, z_t)^\top and

A1=(0.50.20.10.6).A_1 = \begin{pmatrix} 0.5 & 0.2 \\ 0.1 & 0.6 \end{pmatrix}.

The first equation says xx today is half of xx last period plus a fifth of zz last period. The second says zz today is a tenth of xx last period plus six tenths of zz last period.

Stationarity: will it settle down?

A single Stationary Process has the same mean and a fixed spread over time. For a univariate AR(1), yt=ϕyt−1+εty_t = \phi y_{t-1} + \varepsilon_t, the process is stationary when ∣ϕ∣<1|\phi| \lt 1. Each shock decays by the factor ϕ\phi every period, so its effect fades.

For a VAR the same idea uses the matrix. Stack the lags into a bigger first-order system, called the companion form, and ask for all of its eigenvalues to have absolute value below 1. For p=1p = 1 the eigenvalues are simply those of A1A_1. For a 2×22 \times 2 matrix, with trace tr⁡\operatorname{tr} (sum of the diagonal) and determinant det⁡\det (ad−bcad - bc for entries a,b,c,da, b, c, d), they solve λ2−tr⁡(A1)λ+det⁡(A1)=0\lambda^2 - \operatorname{tr}(A_1)\lambda + \det(A_1) = 0, which gives the answer for the example above.

Estimation: one regression per equation

Every equation of a VAR has the same right-hand side: the constant and the lags of all KK variables. Because the regressors are identical across equations, you can estimate each equation separately by ordinary least squares. The result is the same as fitting the whole system jointly, and when the shocks are Gaussian it is also the maximum likelihood estimate.

The number of coefficients is large. Each equation has 1+Kp1 + Kp coefficients, so the equations together have

K(1+Kp)K(1 + Kp)

coefficients, before counting the entries of Σ\Sigma. Two variables with two lags give 2×5=102 \times 5 = 10. Three variables with four lags give 3×13=393 \times 13 = 39.

Forecasting

Given the current values, the one-step forecast is the model's mean for the next period with the shocks set to zero:

y^t+1∣t=c+A1yt+⋯+Apyt+1−p.\hat{\mathbf{y}}_{t+1 \mid t} = \mathbf{c} + A_1 \mathbf{y}_t + \cdots + A_p \mathbf{y}_{t+1-p}.

Longer forecasts feed each forecast back in as if it were data.

Impulse responses and the ordering problem

A VAR describes correlations between shocks, but the shocks are not yet "the interest-rate shock" or "the demand shock". The covariance matrix Σ\Sigma can be correlated across equations, so a shock to one equation also moves the others in the same period. To trace the effect of one economically meaningful shock you have to decide how the contemporaneous links run.

A common choice is a Cholesky Decomposition of Σ\Sigma, which orders the variables so that the first one responds only to its own shock within the period and the last one responds to all of them. The answer depends on the ordering, which is a judgment, not something the data settles. This is why a VAR's results need to be read together with an explicit identification assumption.

The mapping from a one-off shock to the path of every variable over time is the Impulse Response Function. It is built from the AiA_i matrices and the chosen shock structure.

Worked examples

Example
1. A tiny system, by hand

Use A1A_1 from the simplest case, no constant and no shocks, and start from y0=(1,0)⊤\mathbf{y}_0 = (1, 0)^\top.

  1. Period 1: x1=0.5×1+0.2×0=0.5x_1 = 0.5 \times 1 + 0.2 \times 0 = 0.5. Also z1=0.1×1+0.6×0=0.1z_1 = 0.1 \times 1 + 0.6 \times 0 = 0.1. So y1=(0.5,0.1)⊤\mathbf{y}_1 = (0.5, 0.1)^\top.
  2. Period 2: x2=0.5×0.5+0.2×0.1=0.25+0.02=0.27x_2 = 0.5 \times 0.5 + 0.2 \times 0.1 = 0.25 + 0.02 = 0.27. Also z2=0.1×0.5+0.6×0.1=0.05+0.06=0.11z_2 = 0.1 \times 0.5 + 0.6 \times 0.1 = 0.05 + 0.06 = 0.11. So y2=(0.27,0.11)⊤\mathbf{y}_2 = (0.27, 0.11)^\top.

Interpretation: a starting value of xx alone reaches zz one period later, and both values shrink each period. The effect of xx on zz is visible but small.

Example
2. The standard case: stationarity and forecasting

Same matrix. First check stationarity. The trace is 0.5+0.6=1.10.5 + 0.6 = 1.1 and the determinant is 0.5×0.6−0.2×0.1=0.280.5 \times 0.6 - 0.2 \times 0.1 = 0.28. The eigenvalues solve λ2−1.1λ+0.28=0\lambda^2 - 1.1\lambda + 0.28 = 0:

  1. Discriminant: 1.12−4×0.28=1.21−1.12=0.091.1^2 - 4 \times 0.28 = 1.21 - 1.12 = 0.09.
  2. Square root: 0.09=0.3\sqrt{0.09} = 0.3.
  3. Roots: λ=(1.1±0.3)/2\lambda = (1.1 \pm 0.3)/2, so λ=0.7\lambda = 0.7 or λ=0.4\lambda = 0.4.

Both are below 1 in absolute value, so the system is stationary.

Now forecast from yt=(2,1)⊤\mathbf{y}_t = (2, 1)^\top with zero shocks:

  1. One step: x=0.5×2+0.2×1=1.2x = 0.5 \times 2 + 0.2 \times 1 = 1.2 and z=0.1×2+0.6×1=0.8z = 0.1 \times 2 + 0.6 \times 1 = 0.8. Forecast (1.2,0.8)⊤(1.2, 0.8)^\top.
  2. Two steps: x=0.5×1.2+0.2×0.8=0.76x = 0.5 \times 1.2 + 0.2 \times 0.8 = 0.76 and z=0.1×1.2+0.6×0.8=0.60z = 0.1 \times 1.2 + 0.6 \times 0.8 = 0.60. Forecast (0.76,0.60)⊤(0.76, 0.60)^\top.

Interpretation: both forecasts drift towards zero, the mean of this stationary system. Your two-step forecast is already closer to zero than the one-step forecast.

Example
3. A realistic three-variable model

Macroeconomists often model three series together, for example output growth, inflation and a short-term interest rate, observed monthly. Take K=3K = 3 and p=4p = 4, so that four months of history feed into each equation.

  1. Each equation has 1+Kp=1+12=131 + Kp = 1 + 12 = 13 coefficients: one constant and twelve lag weights.
  2. Three equations give 3×13=393 \times 13 = 39 coefficients in the mean.
  3. The shock covariance Σ\Sigma is a 3×33 \times 3 symmetric matrix, so it has 66 distinct entries. The total is 4545 numbers.
  4. With a few hundred monthly observations, each equation is fitted with about the same amount of data as a single regression with 13 predictors. Estimates are noisy, so the coefficients are read as a group, not one at a time.

Interpretation: the model's strength is that output, inflation and the rate can influence each other with no imposed direction. Its weakness is that 45 numbers come from a short sample, so the individual links are uncertain. That is why impulse responses are usually reported with confidence bands.

Tradeoffs and failure modes

SituationWhat goes wrongBetter choice
Many variables with many lagsParameters grow as K2pK^2 p; the estimates become noisy and forecasts overfitFewer variables, fewer lags, or a Bayesian prior that shrinks the coefficients
Trending series such as levels of GDPRegressions on non-stationary data can show strong links that are not real (spurious results)Difference the series (model period-to-period changes), or use a cointegration model, which handles series that drift together over time, such as a vector error correction model
Asking what happens after a policy changeCorrelations between shocks hide which shock caused whatImpose an identification scheme and report how sensitive the answer is to it
Only forecasting a few steps aheadA VAR is often as good as a larger model and much easier to buildUse it as the baseline
Structural questions with a clear theoryThe VAR lets the data pick links that the theory rules outA structural model such as a DSGE Model

History

Vector autoregressions were popularised by Christopher Sims in the early 1980s. In his 1980 paper "Macroeconomics and Reality", published in Econometrica, he argued that large models with many imposed restrictions were not well supported by the data, and he proposed VARs as a less restrictive alternative. The approach spread quickly through macroeconomics and central-bank research. Sims shared the 2011 Nobel Memorial Prize in Economic Sciences with Thomas Sargent for their empirical work on cause and effect in the economy.

Recap

A VAR writes each variable as a linear function of the past of all variables plus a shock. It is stationary when the matrix of lag weights has eigenvalues inside the unit circle. Each equation is estimated by ordinary least squares, but the number of parameters grows quickly. Impulse responses, which trace one shock through time, need an identification choice on top of the fitted model. Where it leads next: the Impulse Response Function that answers "what does one shock do?", and the DSGE Model when a theory should constrain the links.

Check yourself

QuestionRecall: what does the matrix A1A_1 hold in a VAR(1), and what does the entry in row jj, column kk mean?Show answer

A1A_1 is the matrix of lag-one coefficients. Entry (j,k)(j, k) says how much variable kk in the previous period contributes to variable jj in the current period. Row jj is the equation for variable jj, and column kk indexes which variable from the past it uses.

QuestionComputation: for the VAR with A1=(0.50.20.10.6)A_1 = \begin{pmatrix} 0.5 & 0.2 \\ 0.1 & 0.6 \end{pmatrix} and yt=(0,2)⊤\mathbf{y}_t = (0, 2)^\top with zero shocks, what is yt+1\mathbf{y}_{t+1}?Show answer

xt+1=0.5×0+0.2×2=0.4x_{t+1} = 0.5 \times 0 + 0.2 \times 2 = 0.4. zt+1=0.1×0+0.6×2=1.2z_{t+1} = 0.1 \times 0 + 0.6 \times 2 = 1.2. So yt+1=(0.4,1.2)⊤\mathbf{y}_{t+1} = (0.4, 1.2)^\top.

QuestionWhy: why can each equation of a VAR be estimated by ordinary least squares on its own?Show answer

Every equation has the same regressors: the constant and the lags of every variable in the system. When the regressors are identical across equations, separate least squares fits give the same coefficients as a joint estimate of the system. With Gaussian shocks this is also the maximum likelihood estimate, so nothing is lost by treating the equations separately.

QuestionApplied: a researcher fits a VAR with five variables and six lags to 120 quarterly observations. What is the main concern, and what would you check first?Show answer

The system has K(1+Kp)=5×31=155K(1 + Kp) = 5 \times 31 = 155 coefficients in total. Each equation has 1+30=311 + 30 = 31 coefficients estimated from about 114 usable rows (the first six quarters are consumed as lags), so the estimates are very noisy and the model is likely to overfit. First check the stationarity of each series, then reduce the number of variables or lags, or use a prior that shrinks the coefficients towards zero.

Sources