Escolar Documentos
Profissional Documentos
Cultura Documentos
Technical guide
Alistair Dieppe
Romain Legrand
Björn van Roye
European Central Bank
20 June 2018
Contents
1. Model estimation and evaluation 1
1.1. VAR models: formulation and estimation . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2. Bayesian VAR estimation: principles . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3. The Minnesota prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4. The normal-Wishart prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.5. An independent normal-Wishart prior with unknown Σ and arbitrary Ω0 . . . . . . . 20
1.6. The normal-diffuse prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.7. A dummy observation prior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.8. Block exogeneity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.9. Evaluating the model: calculation of the marginal likelihood . . . . . . . . . . . . . . 39
2. Basic applications 51
2.1. Forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.2. Impulse response functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.3. Structural VARs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
2.4. Identification by Choleski factorisation . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.5. Identification by triangular factorisation . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.6. Identification by sign, magnitude and zero restrictions . . . . . . . . . . . . . . . . . . 65
3. Advanced analysis 86
3.1. Forecast error variance decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
3.2. Historical decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.3. Conditional forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
3.4. Conditional forecasts generated by specific shocks . . . . . . . . . . . . . . . . . . . . 96
3.5. Relative entropy methodology - Tilting . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.6. Time Varying Equilibrium VAR and priors for the long run . . . . . . . . . . . . . . . 117
3.6.1. Mean-adjusted BVAR: informative prior on the steady state (Villani (2009)) . 117
3.6.2. Equilibrium BVARs with breaks in linear and quadratic trends . . . . . . . . . 125
3.6.3. Priors for the long-run (Giannone et al. (2016)) . . . . . . . . . . . . . . . . . 125
i
Contents
4.8. Adding dynamic heterogeneity to the model: a dynamic factor approach . . . . . . . 162
4.9. Applications with panel VARs: forecasts, impulse response functions, forecast error
variance decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
4.10. Historical decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
4.11. Conditional forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
A. Derivations 240
A. Preliminary mathematical results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
B. Statistical distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
B.1. Uniform distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
B.2. Multivariate normal distribution . . . . . . . . . . . . . . . . . . . . . . . . . . 244
B.3. Matrix Normal Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
B.4. Inverse Wishart distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
B.5. Matrix variate student distribution . . . . . . . . . . . . . . . . . . . . . . . . 249
B.6. Gamma distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
B.7. Inverse Gamma distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
C. Derivations of the posterior distribution with a Minnesota prior . . . . . . . . . . . . 253
D. Derivations of the posterior distribution with a normal-Wishart prior . . . . . . . . . 256
E. Derivations of the posterior distribution with an independent normal-Wishart prior . 263
F. Derivations of the posterior distribution with a normal-diffuse prior . . . . . . . . . . 268
G. Derivations for the dummy observation prior . . . . . . . . . . . . . . . . . . . . . . . 270
H. Derivation of the marginal likelihood . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
I. Derivation of the steady-state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
J. Forecast evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
K. Derivation of confidence intervals for a standard OLS VAR model . . . . . . . . . . . 291
L. Examples on conditional forecasts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
M. Derivations for the pooled estimator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
N. Derivations for the Zellner and Hong prior . . . . . . . . . . . . . . . . . . . . . . . . 302
O. Derivations for the hierarchical prior . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
P. Derivations for the static factor model . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Q. Derivations for the dynamic factor approach . . . . . . . . . . . . . . . . . . . . . . . 319
R. Derivations for the stochastic volatility BVAR: standard model . . . . . . . . . . . . . 328
S. Derivations for the model with random inertia . . . . . . . . . . . . . . . . . . . . . . 346
ii
Contents
T. Derivations for the stochastic volatility model for large BVARs . . . . . . . . . . . . . 350
U. Derivations for the model with time-varying coefficients . . . . . . . . . . . . . . . . . 364
V. Derivations for the general time-varying model . . . . . . . . . . . . . . . . . . . . . . 371
Bibliography 373
iii
1. Model estimation and evaluation
y1,t a111 a112 · · · a11n y ap11 ap12 · · · ap1n y
1,t−1 1,t−p
y2,t
a121 a122 1
· · · a2n y2,t−1
ap21 ap22 p
· · · a2n y2,t−p
= + ··· +
..
.. .. .. .
.. .. .. .. .
..
. . . . .. . . . . .. .
p p
yn,t a1n1 a1n2 · · · a1nn yn,t−1 an1 an2 · · · apnn yn,t−p
c11 c12 · · · c1m x1,t ε1,t
c21 c22 · · · c2m
x2,t
ε1,t
+ .. .. .. ..
.. +
.. (1.1.1)
. . . . . .
cn1 cn2p · · · cnm xm,t ε1,t
yt = (y1,t , y2,t , · · · , yn,t ) is a n×1 vector of endogenous data, A1 , A2 , . . . , Ap are p matrices of dimension
n×n, C is a n×m matrix, and xt is a m×1 vector of exogenous regressors which can be e.g. constant
terms, time trends, or exogenous data series. εt = (ε1,t ε2,t · · · εn,t ) is a vector of residuals following
a multivariate normal distribution:
εt ∼ N (0, Σ) (1.1.3)
0 0
εt is assumed to be non-autocorrelated, so that E(εt εt ) = Σ while E(εt εs ) = 0 if t 6= s. Σ is a n × n
symmetric positive definite variance-covariance matrix, with variance terms on the diagonal and
covariance terms off diagonal. T is the size of the sample used for the regression, and the structure
of the VAR implies that there are k = np + m coefficients to estimate for each equation, leaving a
total of q = nk = n(np + m) coefficients to estimate for the full VAR model.
1
1. Model estimation and evaluation
For further computation, a convenient reformulation of 1.1.2 consists in writing the VAR in trans-
pose form as:
0 0 0 0 0 0 0 0 0 0
yt = yt−1 A1 + yt−2 A2 + ... + yt−p Ap + xt C + εt where t = 1, 2, ..., T (1.1.4)
Because 1.1.4 holds for any t, one can stack observations in the usual way to reformulate the model
for the whole data set:
y1, y0, ,
y−1 ,
y1−p x,1 ε,1
y2,
y1,
,
y0,
,
,
y2−p
,
x,2
,
ε,2
.. =
.. A +
1 .. A +... +
2 .. A +
p .. C +
.. (1.1.5)
. . . . . .
|{z} |{z} |{z}
|{z}
n×n n×n n×n m×n
yT, yT, −1 yT, −2 yT, −p x,T ε,T
| {z } | {z } | {z } | {z } | {z } | {z }
T ×n T ×n T ×n T ×n T ×m T ×n
Y = XB + E (1.1.7)
with:
A,1
y1, y0, ,
y−1 ,
· · · y1−p x,1 ε,1
A,2
y2, y1, y0, ,
· · · y2−p x,2 ε,2
..
Y =
.. ,X =
.. .. .. .. ,B =
. ,
and E =
.. (1.1.8)
. . . . . .
A,p
yT, yT, −1 yT, −2 · · · yT, −p x,T
,
ε,T
C
In model 1.1.7, subscripts t have been dropped to emphasize the fact that this formulation encom-
passes the whole sample. Once the model has been stacked this way, obtaining OLS estimates of the
VAR is straightforward. An estimate B̂ of the parameter B in 1.1.7 obtains from:
2
1. Model estimation and evaluation
B̂ = (X , X)−1 X , Y (1.1.9)
Following, an OLS estimate Ê of the residual matrix E can be computed from direct application of
1.1.7, and a (degree of freedom adjusted) estimate Σ̂ of the covariance matrix Σ in 1.1.3 may be
obtained from:
1
Σ̂ = Ê , Ê (1.1.10)
T −k−1
Alternatively, using A.8, one can vectorise 1.1.6 to reformulate the model as:
(1)
A
1
y0, ,
y−1 ,
· · · y1−p x,1 0 ··· 0
..
y
.
1,1 y1, y0, ,
x,2
..
· · · y−p
A(1)
.
.. .. .. .. .. ..
p
. . . . . .
C (1)
y1,T
yT, −1 yT, −2 · · · yT, −p x,T ···
..
0 0
..
. .
...
=
0 ··· 0 y0, ,
y−1 ,
· · · y1−p x,1
(n)
yn,1 A1
y1, y0, ,
· · · y−p x,2
.. ..
. .
.. .. .. .. .. ..
. . . . . .
yn,T A(n)
p
yT, −1 yT, −2 yT, −p x,T
0 ··· 0 ···
C (n)
| {z }
nT ×1 | {z }
nT ×q | {z }
q×1
ε
1,1
..
.
ε1,T
..
.
+ (1.1.11)
εn,1
..
.
εn,T
| {z }
nT ×1
(j)
where in the above formulation, Ai and C (j) respectively denote the transpose of row j of matrix Ai
and C. 1.1.11 reformulates compactly as:
y = X̄β + ε (1.1.12)
3
1. Model estimation and evaluation
with:
Note that one can also simply use 1.1.9 and vectorise B̂ to recover β̂. This solution is often preferred
in practice, since the computation of B̂ involves smaller matrices and thus produces more accurate
estimates. Similarly, OLS estimates ε̂ for the residuals can be obtained either by direct application
of 1.1.12, or by vectorising Ê calculated from 1.1.7.
It should be clear that 1.1.7 and 1.1.12 are just alternative but equivalent representations of the
same VAR model 1.1.2. In the incoming developments, one representation or the other will be chosen
according to which one is most convenient for computational purposes. 1.1.7 is typically faster to
compute, while the main appeal of 1.1.12 resides in the fact that Bayesian analysis typically works
with β rather than with B.
In a VAR framework, the parameters of interest for the econometrician are the coefficients of the
model, gathered in the vector β in 1.1.12, along with the residual covariance matrix Σ defined in 1.1.3
(though in some instances, it may be assumed that it is known). The principle of Bayesian analysis
is then to combine the prior information the econometrician may have about the distribution for
these parameters (the prior distribution) with the information contained in the data (the likelihood
function) to obtain an updated distribution accounting for both these sources of information, known
as the posterior distribution. This is done by using what is known as Bayes rule, which represents
4
1. Model estimation and evaluation
the cornerstone of Bayesian Analysis. For a general (vector of) parameter(s) θ and a data set y,
Bayes rule can be obtained from basic definitions of conditional probabilities, by noting that:
As it is common practice to denote data density by f (y |θ ) rather than by π(y |θ ), Bayes rule is
typically written as:
f (y |θ )π(θ)
π(θ |y ) = (1.2.2)
f (y)
Formula 1.2.2 says that π(θ|y), the posterior distribution of θ conditional on the information con-
tained in y, is equal to the product of the data likelihood function f (y |θ ) with the prior distribution
π(θ), divided by the density f (y) of the data. Since the denominator f (y) is independent of θ, it
only plays the role of a normalizing constant with respect to the posterior π(θ |y ), so that it is often
convenient to ignore it and rewrite 1.2.2 as:
In essence, any Bayesian estimation of econometric models reduces to an application of 1.2.3. This
expression allows to obtain the posterior distribution π(θ |y ), which represents the central object
for inference as it combines in one single expression all the information we have about θ. It is this
posterior distribution which is then used to carry inference about the parameter values, compute
point estimates, draw comparisons between models, and so on.
A preliminary remark may be done about the prior distribution π(θ). Most of the times, θ will
not represent a single parameter, but rather several different parameters - or blocks of parameters -
considered by the model. This then implies that π(θ) represents the joint prior distribution for all
the parameters considered simultaneously, which may be difficult to determine. For example, in a
typical Bayesian VAR model, θ will include two blocks: the VAR coefficients β on the one hand, and
the residual variance-covariance matrix Σ on the other hand. What should be a joint distribution for
a vector of VAR coefficients and a variance-covariance matrix is a question with no obvious answer.
A simple way to overcome this issue is to assume independence between parameters or blocks, so
that the joint density simply becomes the product of the individual densities. This then reduces the
problem to the determination of one distribution for each individual element, an easier and more
meaningful strategy than looking for a joint density. For a general model with d parameters or
blocks, π(θ) can then be rewritten as:
5
1. Model estimation and evaluation
For instance, in the typical VAR example made of the two blocks or parameters θ1 = β and θ2 = Σ,
this allows to rewrite 1.2.3 as:
In most practical Bayesian VAR applications, it is 1.2.5 rather than 1.2.3 that will be applied to
obtain the posterior distribution.
A similar issue arises with the posterior distribution π(θ |y ): it is also a joint distribution for the
parameters or blocks of the model, while the typical objects of interest for the statistician are the
individual posterior distributions. To derive the marginal distributions of a particular element, one
simply integrates out the remainder of the parameters from the joint posterior distribution:
Z
π(θi |y ) = π(θ1 , θ2 , ..., θd |y ) dθ1 dθ2 ...dθd (1.2.6)
| {z }
j6=i
For example, in the typical 2-block VAR model, one finds the distribution for θ1 by integrating the
joint distribution over θ2 :
Z
π(θ1 |y ) = π(θ1 , θ2 |y )dθ2 (1.2.7)
Similarly, one will obtain the distribution for θ2 by integrating the joint distribution over θ1 .
1.2.2 represents the simplest formulation of Bayes rule. It is however possible to build richer and
more sophisticated versions of it by using what is known as hierarchical prior distributions. To
understand this concept, consider the case of the prior distribution π(θ) set for some parameter
of interest θ. This prior distribution itself depends on some other parameter values that we may
denote by λ. For instance, if π(θ) is the multivariate normal distribution, it depends on the set of
parameters λ = (µ, Σ), which respectively represent the mean and covariance of the multivariate
normal distribution. To be perfectly rigorous, one should hence denote the prior distribution for θ by
π(θ |λ), but in practice the implicit parameters µ and Σ are often omitted to lighten notation so that
the prior distribution is simply written as π(θ). The parameters λ, known as hyperparameters (they
are the parameters determining the prior distribution of the parameters of interest θ), are usually
assumed to be fixed and known, with values provided by the Bayesian practitioner. It is however
possible to assume that λ is also a random variable, and as such to also characterize it with some
prior distribution. This way, an additional layer of uncertainty is added to the model.
6
1. Model estimation and evaluation
Because λ provides additional random variables to the model, those supplementary random vari-
ables must be added to the full posterior distribution, which thus becomes π(θ, λ |y ) and not just
π(θ |y ). It is straightforward to obtain a formula for π(θ, λ |y ) by starting from Bayes rule 1.2.2, and
then use basic algebra:
f (y |θ, λ)π(θ, λ)
π(θ, λ |y ) =
f (y)
f (y |θ, λ) π(θ, λ)
= π(λ)
f (y) π(λ)
f (y |θ, λ)
= π(θ |λ)π(λ)
f (y)
∝ f (y |θ, λ)π(θ |λ)π(λ) (1.2.8)
Note that the hyperparameter λ is only used to determine the prior distribution of θ. Therefore, once
the value of θ is determined, λ becomes redundant and does not give anymore any useful information
for the computation of the likelihood f (y |θ, λ). It can thus be omitted so that 1.2.8 rewrites:
(1.2.9) says that to obtain the full posterior distribution of the hierarchical model, it suffices to multi-
ply the likelihood function f (y |θ ) with the (conditional) prior π(θ |λ) for θ, and the prior distribution
π(λ) for λ. If one is then interested only in the posterior distribution of θ, a marginalisation process
similar to that of 1.2.6 is directly applicable:
Z
π(θ |y ) = π(θ, λ |y )dλ (1.2.10)
λ
Hierarchical priors can extend to more than one stage. It is possible for instance to add a third layer of
uncertainty. Indeed, since λ is a random variable, it also depends on some set of hyperparameters, say
γ. In the one-stage hierarchical model, γ was implicitly assumed to be fixed and known. However,
it is possible to assume that γ is actually also a random variable, and thus generate a two-stage
hierarchical model. Then, Bayes formula becomes:
7
1. Model estimation and evaluation
Any number of additional layers can be added to the model, with the same logic to extend Bayes
rule and the marginalisation process.
Once the posterior distribution is obtained, either in a standard or hierarchical way, the question
becomes how to handle the posterior distribution. The latter contains all the information that the
statistician has about θ, but as such it is hardly of any use, since an entire distribution represents
something too complicated to be conveniently used in practical applications. One may thus want to
summarize the information contained in the whole distribution in a few criteria only.
For instance, one may typically want to obtain a point estimate for θ. This is done by using a
loss function L(θ̂, θ), which specifies the loss incurred if the true value of the parameter is θ, but
is estimated as θ̂. An example of loss function is the quadratic loss function L(θ̂, θ) = (θ̂ − θ)2 .
The Bayes estimator (or point estimate) of θ is then defined as the value of θ̂ which minimizes the
expected loss over the posterior distribution of θ. That is, θ̂ is chosen to minimise:
h i Z
E L(θ̂, θ) = L(θ̂, θ)π(θ |y )dθ (1.2.13)
h i Z
E L(θ̂, θ) = (θ̂ − θ)2 π(θ |y )dθ (1.2.14)
or Z
θ̂ = θπ(θ |y )dθ = E(θ |y ) (1.2.16)
That is, the point estimate is given by the mean of the posterior distribution. Other values are
possible with different loss functions. For example, using an absolute value loss function yields the
median as the Bayes estimator, while the so-called step-loss function yields the mode. One may also
want to compute interval estimates for θ, that is:
P (θL ≤ θ ≤ θU ) = α (1.2.17)
which indicates that θL ≤ θ ≤ θU with a probability of α, for instance α = 0.95. Such intervals are
referred to as credibility intervals, since they reflect plausible values for θ, values outside the interval
being considered too uncommon or unlikely to be plausible. The credibility interval can be derived
8
1. Model estimation and evaluation
from the posterior distribution, either by trimming probability from both tails of the distribution,
or by selecting the pair yielding the shortest interval.
In practice, the median will typically be preferred to the mean as a point estimate, for two reasons.
The first is that the median is less sensitive than the mean to extreme values. Therefore, choosing the
median avoids selecting a point estimate which can be very remote from the centre of the distribution,
as can be the case with the mean if the posterior distribution is strongly skewed. The second is that
being the 50% quantile, the median is ensured to be comprised within the bounds of a credibility
interval, while the mean can produce an estimate outside these bounds in the case, once again, of a
skewed distribution.
A final feature of interest is the comparison of different models. Imagine for example that one
wants to compare model 1 and model 2, and determine which one is the true model. Model 1 is
characterized by the prior belief or prior probability P (M1 ) = p1 that it is indeed the true model, by
a set of parameters θ1 , a prior distribution π(θ1 |M1 ) over these parameters, and a likelihood function
f1 (y |θ1 , M1 ). Similarly, model 2 is characterized by P (M2 ) = p2 ,θ2 , π(θ2 |M2 ) and f2 (y |θ2 , M2 ). The
Bayesian methodology then consists in computing for each model the posterior probability P (M1 |y),
which is interpreted as the probability that model i is indeed the true one, given the information
contained in the data. Using Bayes rule 1.2.2, one obtains this posterior probability as:
f1 (y |Mi )P (Mi )
P (Mi |y ) = (1.2.18)
f (y)
After some use of rules of marginal and conditional probabilities, this rewrites as:
Note that this function involves the likelihood fi (y |θi , Mi ) and the prior π(θi |Mi ). The marginal
likelihood is a crucial element for model comparison. Indeed, to compare model 1 with model 2 and
determine which one is more likely to be the true one, the simplest method is to compute the ratio
of their posterior probabilities. Using 1.2.19 and 1.2.20, one obtains:
!
P (M1 |y ) p1 m1
R12 = = (1.2.21)
P (M2 |y ) p2 m2
9
1. Model estimation and evaluation
This shows that the ratio is made of two elements: the prior odds ratio p1 /p2 which reflects the
prior belief of the statistician in favour of model 1, and the ratio of the marginal likelihoods m1 /m2 ,
known as the Bayes factor. If the statistician has no preconceived idea on which model should be
true, he will set so that the whole burden of model comparison will fall on the Bayes factor. Once
R12 is calculated, the last remaining issue is to determine which rule of thumb should be followed to
determine whether model 1 should be deemed as the true one.
Any negative value of log10 (R12 ) has of course to be interpreted as evidence against model M1 .
This subsection summarized in a nutshell all the principles underlying the practice of Bayesian
econometrics. The following subsections mostly build on these principles, developing the details of
the Bayesian procedures used to estimate the general VAR model introduced in subsection 1.1.
The simplest form of prior distributions for VAR models is known as the Minnesota (or Litterman)
prior. In this framework, it is assumed that the VAR residual variance-covariance matrix Σ is
known. Hence, the only object left to estimate is the vector of parameters β. To obtain the posterior
distribution for β from 1.2.3, one needs two elements: the likelihood function f (y |β ) for the data,
and a prior distribution π(β) for β.
Start with the likelihood function. For the Minnesota prior, 1.1.12 turns out to be the most
convenient formulation for the VAR model. As stated in 1.1.3, this formulation implies that the
10
1. Model estimation and evaluation
residuals follow a multivariate normal distribution with mean 0 and covariance matrix Σ̄. This in
turn implies from 1.1.12 that y also follows a multivariate normal distribution with mean X̄β and
covariance Σ̄. Therefore, one may write the likelihood for y as:
1
−1/2 ,
f (y β, Σ̄) = (2π)−nT /2 Σ̄ y − X̄β Σ̄−1 y − X̄β
exp − (1.3.1)
2
Ignoring terms independent from β relegated to proportionality constants, 1.3.1 simplifies to:
1
,
∝ exp − y − X̄β Σ̄−1 y − X̄β
f (y β, Σ̄) (1.3.2)
2
Now turn to the prior distribution for β. It is assumed that β follows a multivariate normal distri-
bution, with mean β0 and covariance matrix Ω0 :
To identify β0 and Ω0 , Litterman (1986) proposed the following strategy. As most observed macroeco-
nomic variables seem to be characterized by a unit root (in the sense that their changes are impossible
to forecast), our prior belief should be that each endogenous variable included in the model presents
a unit root in its first own lags, and coefficients equal to zero for further lags and cross-variable lag
coefficients. In the absence of prior belief about exogenous variables, the most reasonable strategy
is to assume that they are neutral with respect to the endogenous variables, and hence that their
coefficients are equal to zero as well. These elements translate into β0 being a vector of zeros, save
for the entries concerning the first own lag of each endogenous variable which are attributed values
of 1. Note though that in the case of variables known to be stationary, this unit root hypothesis may
not be suitable, so that a value around 0.8 may be preferred to a value of 1.
As an example, consider a VAR model with two endogenous variables and two lags, along with one
exogenous variables (for instance a constant, or an exogenous data series). Each equation will involve
k = np + m = 2 × 2 + 1 = 5 coefficients to estimate, which implies a total of q = nk = 2 × 5 = 10
coefficients for the whole model, so that β0 will be a q ×1 vector. For our example, given the structure
described by 1.1.11-1.1.12, it is given by:
11
1. Model estimation and evaluation
1
0
0
0
0
β0 = (1.3.4)
0
1
0
0
0
For the variance-covariance matrix Ω0 , it is assumed that no covariance exists between terms in β,
so that Ω0 is diagonal. Also, Litterman (1986) argued that the further the lag, the more confident
we should be that coefficients linked to this lag have a value of zero. Therefore, variance should be
smaller on further lags. Also, this confidence should be greater for coefficients relating variables to
past values of other variables. Finally, it should be assumed that little is known about exogenous
variables, so that the variance on these terms should be large. Based on these principles, Litterman
(1986) distinguished three different cases:
1. For parameters in β relating endogenous variables to their own lags, the variance is given by:
!2
λ1
σa2ii = (1.3.5)
lλ3
where λ1 is an overall tightness parameter, l is the lag considered by the coefficient, and λ3 is
a scaling coefficient controlling the speed at which coefficients for lags greater than 1 converge
to 0 with greater certainty.
2. For parameters related to cross-variable lag coefficients, the variance is given by:
! !2
σi2 λ1 λ2
σa2ij = (1.3.6)
σj2 l λ3
where σi2 and σj2 denote the OLS residual variance of the auto-regressive models estimated for
variables i and j, and λ2 represents a cross-variable specific variance parameter.
3. For exogenous variables (including constant terms), the variance is given by:
12
1. Model estimation and evaluation
where σi2 is again the OLS residual variance of an auto-regressive model previously estimated
for variable i, and λ4 is a large (potentially infinite) variance parameter.
Ω0 is thus a q × q diagonal matrix with three different types of variance terms on its main diagonal.
For instance, for the VAR model with 2 variables, 2 lags and one exogenous variable specified above,
Ω0 is given by:
(λ1 )2 0 0 0 0 0 0 0 0 0
2
σ1
(λ1 λ2 )2
0 0 0 0 0 0 0 0 0
σ2
2
2
λ1
0 0 0 0 0 0 0 0 0
2λ3
2 2
σ1 λ1 λ2
0 0 0 0 0 0 0 0 0
σ2 2λ3
2
σ12 (λ1 λ4 )2
0 0 0 0 0 0 0 0 0
Ω0 =
2
σ2
2
0 0 0 0 0 (λ1 λ2 ) 0 0 0 0
σ2
1
2
0 0 0 0 0 0 (λ1 ) 0 0 0
2 2
σ2 λ1 λ2
0 0 0 0 0 0 0 0 0
σ2 2λ 3
1
2
λ1
0 0 0 0 0 0 0 0 0
2λ 3
0 0 0 0 0 0 0 0 0 σ22 (λ1 λ4 )2
(1.3.8)
Different choices are possible for λ1 ,λ2 ,λ3 and λ4 . However, values typically found in the literature
revolve around:
λ1 = 0.1 (1.3.9)
λ2 = 0.5 (1.3.10)
λ3 = 1 or 2 (1.3.11)
λ4 = 102 to ∞ (1.3.12)
Finally, since the Minnesota prior assumes that the variance-covariance matrix of residuals Σ is
known, one has to decide how to define it. The original Minnesota prior assumes that Σ is diagonal
which, as will be seen later, conveniently implies independence between the VAR coefficients of
different equations. This property was useful at a time of limited computational power as it allows
estimating the model equation by equation (this possibility is not used here). A first possibility is
thus to set the diagonal of Σ equal to the residual variance of individual AR models run on each
variable in the VAR. A second possibility is to use the variance-covariance matrix of a conventional
13
1. Model estimation and evaluation
VAR estimated by OLS, but to retain only the diagonal terms as Σ. Finally, as the model estimates
all the equations simultaneously in this setting, the assumption of a diagonal matrix is not required.
Therefore, a third and last possibility consists in using directly the entire variance-covariance matrix
of a VAR estimated by OLS.
Once β0 and Ω0 are determined, and that proper values re-attributed to Σ, one may compute the
prior distribution of β. The normality assumption implies that its density is given by:
1
−nk/2 −1/2
π(β) = (2π) |Ω0 | exp − (β − β0 ), Ω−1
0 (β − β0 ) (1.3.13)
2
Relegating terms independent of β to the proportionality constant, 1.3.13 rewrites:
1
π(β) ∝ exp − (β − β0 ), Ω−1 0 (β − β0 ) (1.3.14)
2
Now, directly applying 1.2.3, that is, combining the likelihood 1.3.2 with the prior 1.3.14, the posterior
distribution for β obtains as:
π(β |y ) ∝ f (y |β )π(β)
1 1
,
−1 , −1
∝ exp − y − X̄β Σ̄ y − X̄β × exp − (β − β0 ) Ω0 (β − β0 )
2 2
1 n
, o
= exp − y − X̄β Σ̄−1 y − X̄β + (β − β0 ), Ω−1
0 (β − β 0 ) (1.3.15)
2
Equation 1.3.15 represents the kernel of the posterior distribution, but it does not have the form of
a known distribution. Yet, it is possible to show that after some manipulations, it reformulates as:
1 n
, o
π(β |y ) ∝ exp − β − β̄ Ω̄−1 β − β̄ (1.3.16)
2
with:
h i−1
Ω̄ = Ω−1
0 +Σ
−1
⊗ X ,X (1.3.17)
and:
h i
β̄ = Ω̄ Ω−1
0 β0 + (Σ
−1
⊗ X , )y (1.3.18)
This is the kernel of a multivariate normal distribution with mean β̄ and covariance matrix Ω̄.
Therefore, the posterior distribution of β is given by:
14
1. Model estimation and evaluation
From this posterior distribution, point estimates and credibility intervals for β can obtain by direct
application of the methods developed in subsection 1.2.
there is no change in the assumptions relative to the data, its density is still given by 1.3.1, repeated
here for convenience:
1
−1/2 ,
f (y |β, Σ) = (2π)−nT /2 Σ̄ exp − y − X̄β Σ̄−1 y − X̄β (1.4.1)
2
However, since Σ is now assumed to be unknown, Σ̄ = Σ ⊗ IT cannot be relegated anymore to the
proportionality constant. Therefore, 1.4.1 now simplifies to:
1
−1/2 ,
−1
f (y |β, Σ) ∝ Σ̄ − X̄β Σ̄
exp − y y − X̄β (1.4.2)
2
After quite a bit of manipulations, one can show that this density rewrites as:
1
, −1
f (y |β, Σ) ∝ |Σ|−k/2 exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n , o
× |Σ|−[(T −k−n−1)+n+1]/2 exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (1.4.3)
2
where Y and X are defined in 1.1.8, and B̂ and β̂ are defined as in 1.1.9 and 1.1.15. Equation 1.4.3 can
be recognised as the kernel of a multivariate normal distribution (for β), and the kernel of an inverse
Wishart distribution (for Σ), both being centred around OLS estimators. It seems then natural to
assume similar prior distributions for β and Σ, in the hope that it could yield distributions of the
same families for the posterior distribution, which will indeed be the case (such identical families for
the prior and the posterior are known as conjugate priors).
For β, one thus assumes a multivariate normal distribution for the prior:
β ∼ N (β0 , Σ ⊗ Φ0 ) (1.4.4)
15
1. Model estimation and evaluation
The choice of β0 is usually simple, while Φ0 raises some issues. For β0 , a conventional Minnesota
scheme will be typically adopted, setting values around 1 for own first lag coefficients, and 0 for cross
variable and exogenous coefficients. For Φ0 , note the difference between 1.4.4 and the Minnesota
parameter Ω0 in 1.3.3: while Ω0 represents the full variance-covariance matrix of β, now Φ0 only
represents the variance for the parameters of one single equation in the VAR. Each such variance is
then scaled by the variable-specific variance contained in Σ. This Kronecker structure implies that
the variance-covariance matrix of β cannot be specified anymore as in 1.3.8: the variance-covariance
matrix of one equation has now to be proportional to the variance-covariance matrix of the other
equations. As shown in Appendix D, without this structure, it would not be possible to obtain a well
identified posterior distribution. One may however approach a Minnesota type of variance matrix
by adopting the following strategy (see e.g. Karlsson (2012)):
For lag terms (both own and cross-lags), define the variance as:
! !2
1 λ1
σa2ij = (1.4.5)
σj2 l λ3
where σj2 is the unknown residual variance for variable j in the BVAR model, approximated by
individual AR regressions. For exogenous variables, define the variance as:
For instance, with the two-variable VAR with two lags and one exogenous variable used as an example
in subsubsection 1.3, Φ0 would be:
(λ1 )2
1
σ12
0 0 0 0
0 1
(λ1 )2 0 0 0
σ22
2
1 λ1
Φ0 =
0 0 σ12 2λ3
0 0
(1.4.7)
2
1 λ1
0 0 0 0
σ22 2λ3
0 0 0 0 (λ1 λ4 )2
If one assumes a diagonal Σ as in the original Minnesota prior, 1.4.7 then implies that Σ ⊗ Φ0 is
given by:
16
1. Model estimation and evaluation
(λ1 )2 0 0 0 0 0 0 0 0 0
2
σ1
(λ1 )2
0 0 0 0 0 0 0 0 0
σ2
2
2
λ1
0 0 0 0 0 0 0 0 0
2λ3
2 2
σ1 λ1
0 0 0 0 0 0 0 0 0
σ2 2λ3
2
σ12 (λ1 λ4 )2
0 0 0 0 0 0 0 0 0
Σ ⊗ Φ0 =
2
σ2
2
0 0 0 0 0 (λ1 ) 0 0 0 0
σ2
1
2
0 0 0 0 0 0 (λ1 ) 0 0 0
2 2
σ2 λ1
0 0 0 0 0 0 0 0 0
σ2 2λ 3
1
2
λ1
0 0 0 0 0 0 0 0 0
2λ3
0 0 0 0 0 0 0 0 0 σ22 (λ1 λ4 )2
(1.4.8)
Comparing with 1.3.8, one can see that the normal-Wishart variance-covariance matrix of β is a
special case of the Minnesota variance-covariance matrix where Σ is diagonal and the parameter λ2
is constrained to take a value of 1. In this sense, the normal-Wishart prior appears as a Minnesota
prior that would not be able to provide tighter priors on cross-variable parameters, which may be
an undesirable assumption. For this reason, it is advised to set λ1 at a smaller value than for the
Minnesota prior (e.g. between 0.01 and 0.1), in order to compensate for the lack of extra shrinkage
from λ2 . For the remaining hyperparameters λ3 and λ4 , the same values as the Minnesota prior may
be attributed.
1
π(β) ∝ |Σ|−k/2 exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 ) (1.4.9)
2
Turn now to the prior for Σ. The retained distribution is an inverse Wishart distribution characterised
as:
Σ ∼ IW(S0 , α0 ) (1.4.10)
where S0 is the n × n scale matrix for the prior, and α0 is prior degrees of freedom. While any
choice can be made for these hyperparameters according to prior information, the literature once
again proposes standard schemes. For instance, following Karlsson (2012), S0 can be defined as:
17
1. Model estimation and evaluation
σ2 0 0 0
1
2
0 σ2 0 0
S0 = (α0 − n − 1) ...
(1.4.11)
0 0 0
2
0 0 0 σn
On the other hand, the prior degrees of freedom α0 is defined as:
α0 = n + 2 (1.4.12)
This specifies the prior degrees of freedom as the minimum possible to obtain well-defined mean and
variance. Indeed, this value implies that:
σ2 0 0 0
1
2
0 σ2 0 0
E(Σ) = ...
(1.4.13)
0 0 0
0 0 0 σn2
In other words, the expectation of Σ is the diagonal covariance matrix obtained from individual AR
regressions and used as an estimate for Σ in the Minnesota prior. As with the Minnesota prior, it is
possible to implement alternative schemes. For instance, the matrix 1.4.11 can be simply replaced
with an identity matrix of size n.
With these elements, the kernel of the prior density for Σ is given by:
1 n
o
−(α0 +n+1)/2
π(Σ) ∝ |Σ| exp − tr Σ−1 S0 (1.4.14)
2
From 1.2.5, the posterior obtains by combining the likelihood 1.4.3 with the priors 1.4.9 and 1.4.14.
After lengthy manipulations, one obtains:
1
−1
,
−(k)/2
π(β, Σ |y ) ∝ |Σ| exp − (β − β̄) Σ ⊗ Φ̄ (β − β̄)
2
1 n −1 o
−(ᾱ+n+1)/2
× |Σ| exp − tr Σ S̄ (1.4.15)
2
with:
h 0
i−1
Φ̄ = Φ−1
0 +X X (1.4.16)
0
h i
β̄ = vec(B̄), B̄ = Φ̄ Φ−1
0 B0 + X Y (1.4.17)
18
1. Model estimation and evaluation
ᾱ = T + α0 (1.4.18)
and
S̄ = Y , Y + S0 + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (1.4.19)
This is recognised as the kernel of a multivariate normal distribution for β (conditional on Σ),
multiplied by the kernel of an inverse Wishart distribution for Σ. The fact that the posterior takes
the same form as the prior justifies the denomination of conjugate prior. One then wants to use
the joint posterior 1.4.16 to derive the marginal distributions for β and Σ. This is done by direct
application of 1.2.7.
Obtaining the marginal for Σ is trivial: integrating out β is easy as it appears only in the first term
as a multivariate normal. Following integration, only the second term remains, which determines
straight away the posterior density for Σ as:
1 n
o
π(Σ |y ) ∝ |Σ|−(ᾱ+n+1)/2 exp − tr Σ−1 S̄
2
(1.4.20)
This is once again immediately recognised as the kernel of an inverse Wishart distribution:
π(Σ |y ) ∼ IW ᾱ, S̄ (1.4.21)
Integrating out Σ to derive the marginal for β is a more complicated matter, but it can be shown
after some work on 1.4.15 that:
,
− [T +α0 −n+1]+n+k−1
π(B |y ) ∝ In + S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
(1.4.22)
where B is defined in 1.1.8. This is the kernel of a matrix-variate student distribution with mean B̄,
scale matrices S̄ and Φ̄, and degrees of freedom T + α0 − n + 1:
with:
α̃ = T + α0 − n + 1 (1.4.24)
This then implies that each individual element Bi,j of B follows a univariate student distribution
with mean B̄i,j , scale parameter Φ̄i,i × S̄j,j and degrees of freedom α̃.
19
1. Model estimation and evaluation
1.4.21 and 1.4.25 can then eventually be used to compute point estimates and draw inference for β
and Σ, using once again the methods developed in subsection 1.2.
Ideally, one would thus like to estimate a BVAR model where at the same time Σ would be treated
as unknown, and an arbitrary structure could be proposed for Ω0 , with no assumed dependence
between residual variance and coefficient variance. Such a prior, known as the independent normal-
Wishart prior, is feasible but implies the sacrifice of analytical solutions in favour of numerical
methods. The analysis starts the usual way: first obtain the likelihood from the data. There is no
change here and likelihood is still given by 1.4.3:
1
, −1
f (y |β, Σ) ∝ |Σ|−T /2 exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (1.5.1)
2
Concerning the prior for β, it now departs from the normal-Wishart assumption by assuming that
β follows a multivariate normal distribution with mean β0 and covariance matrix Ω0 , but Ω0 is now
an arbitrary q × q matrix, not necessarily adopting the Kronecker structure described by 1.4.4. β0
on the other hand is the usual q × 1 mean vector. Hence:
20
1. Model estimation and evaluation
β ∼ N (β0 , Ω0 ) (1.5.2)
In typical applications, Ω0 will take the form of the Minnesota covariance matrix described in 1.3.8,
but any choice is possible. Similarly, β0 will typically be defined as the Minnesota β0 vector 1.3.4,
but any structure of vector β0 could be adopted.
1
π(β) ∝ exp − (β − β0 ), Ω−1 0 (β − β0 ) (1.5.3)
2
Similarly to the inverse-Wishart prior, the prior distribution for Σ is an inverse Wishart distribution,
with scale matrix S0 and degrees of freedom α0 :
Σ ∼ IW(S0 , α0 ) (1.5.4)
In typical applications, S0 and α0 will be determined as 1.4.11 and 1.4.12. Following, the prior
density of Σ is given by:
1 n
o
−(α0 +n+1)/2
π(Σ) ∝ |Σ| exp − tr Σ−1 S0 (1.5.5)
2
As usual, the posterior obtains from direct application of 1.2.5, using 1.5.1, 1.5.3 and 1.5.5 :
1 n
, o
−(T +α0 +n+1)/2
π(β, Σ |y) ∝|Σ| exp − β − β̂ Σ−1 ⊗ X , X β − β̂ + (β − β0 ), Ω−1
0 (β − β0 )
2
1 n
h , io
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) (1.5.7)
2
21
1. Model estimation and evaluation
1
−(T +α0 +n+1)/2 ,
π(β, Σ |y ) ∝ |Σ| exp − (β − β̄) Ω̄−1 (β − β̄)
2
1
× exp − β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1 , −1
0 β0 − β̄ Ω̄ β̄
2
1 n
h , io
× exp − tr Σ−1 Y − X B̂ Y − X B̂ + S0 (1.5.8)
2
with B̂ and β̂ defined the usual way as in 1.1.9 and 1.1.14, and:
h i−1
Ω̄ = Ω−1
0 +Σ
−1
⊗ X ,X (1.5.9)
and
h i
β̄ = Ω̄ Ω−1
0 β0 + (Σ
−1
⊗ X , )y (1.5.10)
Note that the general structure of Ω0 prevents from reformulating the second row of 1.5.8 as a trace
expression, which would have allowed to obtain a term corresponding to S̄ in 1.4.19. Consequently,
as it is, 1.5.8 provides no way to derive an analytical marginal distribution for β and Σ.
However, even if it is not possible to derive the unconditional marginal distribution for β and Σ, it
is possible to derive their conditional distributions. To do so, one considers the joint posteriors distri-
bution for all parameters and retain only terms involving parameters whose conditional distribution
must be determined. All terms that do not involve these parameters do not contain information
about their distribution and are thus relegated to the proportionality constant.
Apply first this method to β: considering 1.5.8, and ignoring terms not involving β, one is left
with:
1
,
π(β |Σ, y ) ∝ exp − (β − β̄) Ω̄−1 (β − β̄) (1.5.11)
2
This is recognised as the kernel of a multivariate distribution with mean β̄ and variance-covariance
matrix Ω̄. Hence:
Now determine the conditional distribution for Σ. To do so, it is easier to work directly with 1.5.7.
Thus, ignore terms not involving Σ in 1.5.7, and reshape the remaining elements to obtain:
22
1. Model estimation and evaluation
1 n
o
−[(T +α0 )+n+1]/2
π(Σ |β, y ) ∝ |Σ| exp − tr Σ−1 [(Y − XB), (Y − XB) + S0 ] (1.5.13)
2
This is recognised as the kernel of an inverse Wishart distribution:
Ŝ = (Y − XB), (Y − XB) + S0
α̂ = T + α0 (1.5.15)
With these conditional distributions at hand, it is possible to use a numerical method known as Gibbs
sampling to obtain random draws from the unconditional posterior distributions of the parameters
of interest. While a rigorous presentation of the theory of Gibbs sampling implies an exposition of
Markov Chain Monte Carlo methods and lies beyond the scope of this guide , it is still possible to
present the ideas underlying the process.1
The presentation is made for the simplest case: a model with only two blocks of parameters θ1
and θ2 (corresponding for a VAR model to β and Σ). However, it is straightforward to generalise it
to any number of blocks. Assume hence that one considers a model with two blocks of parameters
θ1 and θ2 , and wants to determine the unconditional posterior distribution for each of these blocks.
The unconditional distribution has an unknown form, but the conditional distribution has a known
form, and numerical softwares are able to sample from it. Then, consider the following procedure:
1
See e.g. Kadiyala and Karlsson (1997) for a brief presentation of the Gibbs sampling methodology, and Greenberg
(2008), chapters 6 and 7, for a much more comprehensive treatment of the topic.
23
1. Model estimation and evaluation
(1) (1)
4. At iteration 2, determine the conditional distribution f (θ1 θ2 ), using the value θ2 . Then
(2)
obtain a draw θ1 from this distribution.
(2) (2)
5. At iteration 2, determine the conditional distribution f (θ2 θ1 ), using the value θ1 . Then
(2)
obtain a draw θ2 from this distribution. This marks the end of iteration 2. Then pursue the
process, repeating any number of times:
(n−1) (n−1)
6. At iteration n, determine the conditional distribution f (θ1 θ2 ), using the value θ2 . Then
(n)
obtain a draw θ1 from this distribution.
(n) (n)
7. At iteration n, determine the conditional distribution f (θ2 θ1 ), using the value θ1 . Then
(n)
obtain a draw θ2 from this distribution.
The essential property of this process is that after a certain number of iterations, known as the tran-
sient, or burn-in sample, the draws will not be realised any more from the conditional distribution,
but from the unconditional distribution of each block. This is due to the fact the successive condi-
tional draws result in a gradual convergence of the process towards the unconditional distributions
of each block, and then remain at this distribution, hence the denomination of invariant distribution.
Once the convergence stage is over, it suffices to pursue the process any number of times to obtain
any number of draws from the unconditional posterior distribution, discard the burn-in sample to
keep only the draws from the unconditional distribution, and hence build an empirical posterior
distribution.
This remarkable property constitutes the core of modern numerical methods applied to Bayesian
analysis. All it requires is to know the conditional posterior distributions for the model, and sufficient
computer speed to accomplish the steps. Note that the process is flexible. While the example has
exposed the case of drawing first θ1 , then θ2 , the converse could have been done: the order is arbitrary
and convergence will be achieved anyway. Actually, the choice of the order should always be based
on convenience. Also, the process can be adapted to a model comprising more than two blocks.
For a model with n blocks, suffice is to condition each draw on each of the other (n − 1) block
(n)
values.
For instance, for a model with three blocks, each draw should be realised as : θ1 from
(n−1) (n−1) (n) (n) (n−1) (n) (n) (n)
f (θ1 θ2 , θ3 ), then θ2 from f (θ2 θ1 , θ3 ), then θ3 from f (θ1 θ1 , θ2 ) (once again, the
order could be different).
After this succinct presentation, it is possible to introduce the Gibbs sampling algorithm used for
the independent normal-Wishart prior. For this model, the two blocks of parameters of interest are
β and Σ, and their conditional distributions are given by 1.5.12 and 1.5.14. Also, while there is no
theorem to define what should be the size of the burn-in sample and the total number of iterations,
24
1. Model estimation and evaluation
in practice a total number of iterations (It) of 2000 and a burn-in sample (Bu) of 1000 provide
sufficient precision. The following algorithm is thus proposed:
Algorithm 1.5.2 (Gibbs sampling for VAR parameters with an independent normal-Wishart
prior):
1. Define the total number of iterations It of the algorithm, and the size Bu of the burn-in sample.
2. Define an initial value β(0) for the algorithm. This will typically be the VAR model OLS
estimates. Reshape to obtain B(0) . Then start running the algorithm.
3. At iteration n, draw the value Σ(n) , conditional on B(n−1) . Σ(n) is drawn from an inverse Wishart
distribution
with scale matrix Ŝ and degrees of freedom α̂, as defined in 1.5.15 and 1.5.15:
π(Σ(n) β(n−1) , y ) ∼ IW(Ŝ, α̂) with: α̂ = T + α0 and Ŝ = S0 + (Y − XB(n−1) ), (Y − XB(n−1) )
4. At iteration n, draw β(n) conditional on Σ(n) , and reshape it into B(n) for the next draw of
Σ. Draw β(n) from a multivariate normal with mean β̄ and covariance matrix Ω̄, as defined
h i−1
in 1.5.9 and 1.5.10: π(β(n) Σ(n) , y ) ∼ N (β̄, Ω̄) with: Ω̄ = Ω−1
0 + Σ −1
(n) ⊗ X ,
X and β̄ =
h i
Ω̄ Ω−1 −1 ,
0 β0 + (Σ(n) ⊗ X )y
5. Repeat until It iterations are realized, then discard the first Bu iterations.
1
, −1
−T /2
f (y |β, Σ) ∝ |Σ| exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (1.6.1)
2
and
1
π(β) ∝ exp − (β − β0 ), Ω−1
0 (β − β0 ) (1.6.2)
2
25
1. Model estimation and evaluation
The main change intervenes in the prior distribution for Σ, which is now defined as the so-called
Jeffrey’s or diffuse prior:
This prior is called an improper prior as it integrates to infinity rather than to one. Yet, this does not
necessarily preclude the posterior distribution to be proper, which is indeed the case here: combining
the likelihood 1.6.1 with the priors 1.6.2 and 1.6.3, and applying Bayes rule 1.2.5, the joint posterior
is given by:
1 n
, o
π(β, Σ |y ) ∝|Σ|−(T +n+1)/2 exp − β − β̂ Σ−1 ⊗ X , X β − β̂ + (β − β0 ), Ω−1
0 (β − β0 )
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (1.6.4)
2
1
,
π(β, Σ |y ) ∝ |Σ|−(T +n+1)/2 exp − (β − β̄) Ω̄−1 (β − β̄)
2
1 n , −1
o
× exp − β̂ Σ ⊗ X , X β̂ + β0, Ω−1 0 β 0 − β̄ , −1
Ω̄ β̄
2
1 n −1
o
,
× exp − tr Σ (Y − X B̂) (Y − X B̂) (1.6.5)
2
with β̄ and Ω̄ defined as in 1.5.9 and 1.5.10. The conditional posterior distribution for β obtains by
considering 1.6.5 and ignoring any term not involving β. This yields:
1
,
π(β |Σ, y ) ∝ exp − (β − β̄) Ω̄−1 (β − β̄) (1.6.6)
2
which is recognised as the kernel of a multivariate normal distribution:
On the other hand, the conditional posterior distribution for Σ obtains from 1.6.4, relegating to the
proportionality constant any term not involving Σ, and then rearranging. This yields:
1 n
o
π(β, Σ |y ) ∝ |Σ|−(T +n+1)/2 exp − tr Σ−1 [(Y − XB), (Y − XB)] (1.6.8)
2
This is the kernel of an inverse Wishart distribution:
26
1. Model estimation and evaluation
As one can see, the main difference between the results developed in this subsection and those of
the previous subsection lie in the expressions related to the posterior distribution of Σ (compare
1.6.9-1.6.10 with 1.5.15-1.5.15). The posterior distribution for Σ is inverse Wishart in both cases,
but the results obtained in the previous subsection involve the prior beliefs S0 and α0 , while those
obtained in the present subsection don’t, due to agnosticism about Σ.
The Gibbs algorithm used to derive the unconditional posterior is then similar to algorithm 1.5,
save for the scale matrix and degrees of freedom of the inverse Wishart distribution which have to
be modified, in compliance with 1.6.9 and 1.6.10.
While this representation is convenient, it results in three main shortcomings. The first is technical
and linked to the estimation of large models. Indeed, for all the priors adopting this Minnesota
structure, estimation of the posterior mean β̄ and the posterior variance Ω̄ involves the inversion of
a q × q matrix. For instance, in the case of a large model with 40 endogenous variables, 5 exogenous
variables and 15 lags (n = 40, m = 5, p = 15) , q is equal to 24200, implying that each iteration of
the Gibbs sampler requires the inversion of a 24200 × 24200 matrix, rendering the process so slow
that it becomes practically intractable. In the worst case, such very large matrices may even cause
numerical softwares to fail the inversion altogether. The second shortcoming is theoretical: with this
structure, no prior covariance is assumed among the VAR coefficients, which may be sub-optimal.
Of course, one could simply add off-diagonal terms in Ω0 in order to create prior covariance terms.
However, there is no all-ready theory to indicate what those values should be. The third issue is that
27
1. Model estimation and evaluation
with this kind of structure, it is very difficult to impose priors on combinations of VAR coefficients,
which can yet be useful when working with unit root or cointegrated processes.
To remedy these shortcomings, this subsection proposes a specific prior known as the dummy
coefficient prior, closely following the methodology introduced by Banbura et al. (2010) for large
VAR models. The text first introduces the simplified prior used as the basis of the exercise. It
then describes the process of creation of the dummy variable that enables to match the Minnesota
moments. Finally, it develops the two extensions (sum of coefficients, and initial dummy observation)
enriching the prior, and making them consistent with unit root or cointegration processes.
Consider first the prior distribution. As shown by D.8, it is possible to express the likelihood
function for the data as:
1 n
−T /2 , o
f (y |β, Σ) ∝ |Σ| exp − tr Σ−1 (B − B̂) (X , X)(B − B̂)
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (1.7.1)
2
B̂ = (X , X)−1 X , Y (1.7.2)
This likelihood function is then combined with a joint improper prior for β and Σ :
This prior is the simplest and least informative prior that one can propose for a VAR model. Combin-
ing the likelihood function 1.7.1 with the improper prior 1.7.3, one obtains the posterior distribution
as:
1 n
, o
f (β, Σ |y ) ∝ |Σ|−(T +n+1)/2 exp − tr Σ−1 (B − B̂) (X , X)(B − B̂)
2
1 n −1
o
,
× exp − tr Σ (Y − X B̂) (Y − X B̂) (1.7.4)
2
1.7.4 appears as being the product of a matrix normal distribution with an inverse-Wishart distri-
bution.
28
1. Model estimation and evaluation
Four remarks can be done about this posterior. First, as the product of a matrix normal distribu-
tion with an inverse-Wishart distribution, this posterior is immediately comparable to that obtained
for the normal-Wishart prior (see 1.4.15 and D.16). It can then be shown (see Appendix G for
details) that similarly to the normal-Wishart prior, the marginal posterior distributions for Σ and B
are respectively inverse-Wishart and matrix student. They are parameterized as:
Σ ∼ IW Ŝ, α̂ (1.7.5)
with:
,
Ŝ = (Y − X B̂) (Y − X B̂) (1.7.6)
and
α̂ = T − k (1.7.7)
_
B ∼ MT (B̂, Ŝ, Φ̂, α) (1.7.8)
Φ̂ = (X , X)−1 (1.7.9)
_
α=T −n−k+1 (1.7.10)
The second remark is that this prior solves the dimensionality issue. While the Minnesota requires
the inversion of a q × q matrix, it is apparent from 1.7.9 that this prior only requires the inversion
of a k × k matrix, with k = np + m. The intuition behind the result is similar to that of the
normal-Wishart: the posterior is computed at the scale of individual equations, rather than for the
full model simultaneously. In the case of the example VAR model with 40 endogenous variables, 5
exogenous variables and 15 lags (n = 40, m = 5, p = 15), while a prior in the Minnesota fashion
requires the inversion of a 24200 × 24200 matrix, which is practically infeasible, the present prior
only requires inversion of a 605 × 605 matrix, a size that remains tractable for numerical softwares.
The third point of interest is that, not surprisingly, an uninformative prior for β and Σ yields
posterior estimates centered at OLS (maximum likelihood) values. By not providing any prior infor-
mation on the mean of the estimates, and setting a flat distribution with infinite variance, one does
hardly more than performing OLS estimation, using only the information provided by the data.
29
1. Model estimation and evaluation
The final comment on this prior is that it is getting estimates that are basically OLS estimates
which creates an issue. The strength (and main interest) of Bayesian estimation is precisely to be able
to supplement the information contained in the data with personal information, in order to inflect
the estimates provided by the data and improve the accuracy of the model. If one does not provide
any information at all, there is, in fact, very little point into using Bayesian methods. Ideally, one
would thus like to provide prior information for the model, despite the diffuse prior. This is possible
thanks to what is known as dummy observations, or artificial observations.
Consider thus the possibility of generating artificial data for the model. The aim of this generated
data is to provide information to the model that would be equivalent to that supplied traditionally
by the prior distribution. Precisely, the following data matrices Yd and Xd , corresponding to Y and
X in 1.1.7, are created:
diag(ρσ1 /λ1 , ..., ρσn /λ1 )
0n(p−1)×n
Yd = (1.7.11)
0
m×n
diag(σ1 , ..., σn )
and
J ⊗ diag (σ1 /λ1 , ..., σn /λ1 )
p
0np×m
Xd = 0 (1/λ λ ) ⊗ I (1.7.12)
m×np 1 4 m
0n×np 0n×m
ρ denotes the value of the autoregressive coefficient on first lags in the Minnesota prior, and σ1 , ..., σn
denotes as usual the standard deviation of the OLS residual obtained from individual auto-regressive
models. Jp is defined as: Jp = diag 1λ3 , 2λ3 , ..., pλ3 . Yd is of dimension (n(p + 1) + m) × n, and
Xd is of dimension (n(p + 1) + m) × (np + m). Considering that each row of Yd (or Xd ) corresponds
to an artificial period, one obtains a total of Td = n(p + 1) + m simulated time periods. Note that
unlike the canonical VAR model, Xd here does not correspond to lagged values of Yd .
Both matrices Yd and Xd are made of three blocks. The first block, made of the first np rows,
is related to the moment of the VAR coefficients corresponding to the endogenous variables of the
model. The second block, made of the next m rows, represents the moments of the coefficients on
the exogenous variables. Finally, the last block, made of the last n rows, deals with the residual
variance-covariance matrix.
To make this more concrete, consider a simple example: a VAR model with two endogenous
variables and two lags, along with one exogenous variable (n = 2, m = 1, p = 2). This formulates as:
30
1. Model estimation and evaluation
y a1 a112 y1,t−1 a211 a212 y1,t−2 c11
1,t = 11
ε1,t
1 1
+ 2 2
+ (x1,t ) + (1.7.13)
y2,t a21 a22 y2,t−1 a21 a22 y2,t−2 c21 ε2,t
For Td periods, reformulated in the usual stacked form 1.1.6, one obtains:
ρσ /λ
1 1
0 1λ3 σ1 /λ1 0 0 0 0
0 ρσ2 /λ1 0 1λ3 σ2 /λ1 0 0 0 a1 a121
11
2λ3 σ1 /λ1
1
0 0 0 0 0 0 a a122
12
2λ3 σ2 /λ1
2
0 0 = 0 0 0 0 a a221
11
2
0 0 0 0 0 0 1/λ1 λ4 a a222
12
σ1 0 0 0 0 0 0 c11 c21
0 σ2 0 0 0 0 0
ε
1,1
ε2,1
ε1,2 ε2,2
ε1,3 ε2,3
+ ε1,4 ε2,4 (1.7.14)
ε1,5 ε2,5
ε1,6 ε2,6
ε1,7 ε2,7
To see why this formulation implies a structure comparable to the normal-Wishart prior, develop
the system 1.7.14, row after row. Start with the third block (the last two rows), and consider the
entries related to the first variable (the first column). Developing, one obtains:
ε1,6 = σ1 (1.7.15)
and
0 = ε1,7 (1.7.16)
E(ε1 ) = 0 (1.7.17)
Then, using 1.7.17 to compute the variance over 1.7.15, one concludes:
31
1. Model estimation and evaluation
This simply replicates the prior variance for ε1 in the normal-Wishart prior (see equation 1.7.13).
Now, consider blocks 1 and 2, starting with block 1. The first row of (1.7.14) develops as:
ρσ1 1λ3 σ1 1 ρ λ1
= a11 + ε1,1 ⇒ a111 = λ3 − λ3 ε1,1 (1.7.19)
λ1 λ1 1 1 σ1
And from 1.7.19, it is straightforward to conclude:
1λ3 σ1 1 λ1
0= a21 + ε2,1 ⇒ a121 = − λ3 ε2,1 (1.7.21)
λ1 1 σ1
From which one obtains:
!
σ22
E(a121 ) = 0 and V ar(a111 ) = 2
(λ1 )2 (1.7.22)
σ1
Go for block 2. Develop the first entry of row 5:
c11
0= + ε1,5 ⇒ c11 = −λ1 λ4 ε1,5 (1.7.23)
λ1 λ4
And from this, one obtains:
Going on the same way with the other entries of blocks 1 and 2, it is straightforward to see that
one will recover the full diagonal of 1.4.8, the prior covariance matrix for β implemented in the
normal-Wishart prior.
Note however that 1.7.14 implies more than 1.4.8. Using for instance 1.7.19 and 1.7.23 one con-
cludes that:
(1.7.25) shows that unlike the strict normal-Wishart prior, the dummy observation setting allows to
implement some prior covariance between the VAR coefficients of the same equation. In this respect,
the dummy observation scheme is even richer than the normal-Wishart prior.
32
1. Model estimation and evaluation
To conclude this presentation of the basic dummy observation strategy, it is now shown how this
setting combines with the simplified prior introduced at the beginning of the subsection. This is
done in a simple way. Define:
Y X
Y ∗ = , X ∗ = , T ∗ = T + Td (1.7.26)
Yd Xd
That is, Y ∗ and X ∗ are obtained by concatenating the dummy observation matrices at the top of the
actual data matrices Y and X, and T ∗ is the total number of time periods, obtained from adding
the actual and simulated time periods. Using this modified data set for the prior, one then obtains
the same posterior distributions as 1.7.5 and 1.7.8, except that the posterior parameters 1.7.2, 1.7.6,
1.7.7, 1.7.9, and 1.7.10 are computed using Y ∗ , X ∗ and T ∗ rather than Y, X and T .
Possible extensions to this basic methodology are now developed. Indeed, as already discussed
already, one of the main asset of the dummy coefficient prior is the convenience it offers to estimate
large models. However, one specific issue may typically arise in large models when variables are
introduced in level. Because such variables typically include unit roots, the model itself should be
characterized by one (or more) unit roots, that is, roots with a value of one. However, with large
models, each draw from the posterior distribution produces VAR coefficients for a large number of
equations. This significantly increases the risk that for any draw, at least one equation will obtain
coefficients that are actually explosive (have a root greater than one in absolute value) rather than
comprising a strict unit root. This may result, for instance, on explosive confidence bands for the
impulse response functions, which becomes larger at longer horizons.
It would thus be desirable to set a prior that would force the dynamic to favor unit root draws,
rather than explosive draws. This can be realized, once again, with the use of dummy observations.
The literature mainly focuses on two strategies: the "sum-of-coefficients" approach, initially intro-
duced by Doan et al. (1984), and the "initial dummy observation" approach due to Sims (1992). To
understand the mechanism at work, the traditional VAR model 1.1.2 is first re-expressed into what
is known as an error correction form. Considering again the example VAR model used so far in this
subsection, it is possible to obtain:
33
1. Model estimation and evaluation
1.7.27 comprises two main parts on its right-hand side. The first term, −(I − A1 − A2 )yt−1 , is the
error correction term. It guaranties stationarity of the model by correcting the current-period change
in yt with part of the preceding period deviation from the long-run value of the model. The second
part, −A2 ∆yt−1 + Cxt + εt , is made of stationary terms and hence does not impact the stationarity
of the model.
In general, a VAR model with p lags in the form of 1.1.2 can be rewritten in error correction form
as (see Appendix G for details):
∆yt = −(I − A1 − A2 ... − Ap )yt−1 + B1 ∆yt−1 + B2 ∆yt−2 + ... + Bp−1 ∆yt−(p−1) + Cxt + εt (1.7.28)
It is now possible to introduce the "sums-of-coefficients" approach. Assume that for a VAR model
with p lags, the following holds:
I − A1 − A2 ... − Ap = 0 (1.7.29)
Or, equivalently:
In this case, yt is equal to its previous value, plus a sum of stationary terms not affecting stationarity.
It follows that each variable in yt contains a unit root. Also, note that the absence of error correction
term rules out the possibility of cointegration relations.
34
1. Model estimation and evaluation
In order to guarantee that the draws obtained from the posterior are characterized by a unit root
rather than by explosive behavior, one may thus want to shrink prior information around 1.7.29.
This can be done by creating the following dummy observations:
and
Xs = 11×p ⊗ Ys 0n×m (1.7.32)
where ȳi denotes the arithmetic mean of variable yi over the p pre-sample initial conditions, and λ6 is
a sums-of-coefficients specific shrinkage parameter. Ys is of dimension n × n , and Xs is of dimension
n × (np + m). That is, an additional Ts = n periods of dummy observations are generated. For the
example VAR model used so far, this yields:
a1
11
a121
a112 a122
ȳ /λ
1 6
0 ȳ1 /λ6 0 ȳ1 /λ6 0 0
2
ε
1,1 ε 1,2
= a11 a221 + (1.7.33)
0 ȳ2 /λ6 0 ȳ2 /λ6 0 ȳ2 /λ6 0 2
ε2,1 ε2,2
a12 a222
c11 c21
Develop entry (1,1) to obtain:
35
1. Model estimation and evaluation
Apply then the same posterior distributions 1.7.5 and 1.7.8, but use the values 1.7.36 rather than
the original data values.
A shortcoming of the sum-of-coefficients strategy is that it rules out cointegration in the limit,
which may be undesirable. Therefore, an additional identification scheme, known as the "dummy
initial observation", is now proposed. In this scheme, one single dummy observation is created for
each variable. This leads to the creation of the following matrices Yo and Xo :
Yo = ȳ1 /λ7 ... ȳn /λ7 (1.7.37)
and
Xo = 11×p ⊗ Yo x̄/λ7 (1.7.38)
where x̄ = x̄1 ... x̄m is the 1 × m vector in which each entry x̄i denotes the arithmetic mean of
exogenous variable xi over the p pre-sample initial conditions, and λ7 is a dummy initial observation
specific hyperparameter. Yo is of dimension 1 × n, Xo is of dimension 1 × (np + m), and To = 1 period
of dummy observation is generated. For the example VAR model used so far, this yields:
a1
11
a121
1
a a122
12
2 2
ȳ1 /λ7 ȳ2 /λ7 = ȳ1 /λ7 ȳ2 /λ7 ȳ1 /λ7 ȳ2 /λ7 x̄1 /λ7 a
11
a21
+ ε1,1 ε1,2 (1.7.39)
2
a12 a222
c11 c21
Developing the first entry of 1.7.39, one obtains:
ȳ1 = ȳ1 a111 + ȳ2 a112 + ȳ1 a211 + ȳ2 a212 + x̄1 c11 (1.7.41)
V ar(ȳ1 − ȳ1 a111 − ȳ2 a112 − ȳ1 a211 − ȳ2 a212 − x̄1 c11 ) = (λ7 )2 σ12 (1.7.42)
36
1. Model estimation and evaluation
1.7.41 states that a no-change forecast constitutes a good representation of the dynamic of the
model. From 1.7.42, it appears that λ7 represents, again, the shrinkage parameter over the prior.
When λ7 → ∞, the prior is diffuse. When λ7 → 0, 1.7.41 holds. Then, either all the variables are
at their unconditional mean, which implies that the model is stationary despite the unit roots in the
variables (implying cointegration), or the dynamic of the system is characterized by an unspecified
number of unit roots, and the variables share a common stochastic trend. The methodology is then
similar to the one previously applied. Define:
Y
X
Y = Yd , X = Xd , T ∗ = T + Td + To
∗ ∗
(1.7.43)
Yo Xo
Apply then the same posterior distributions 1.7.5 and 1.7.8, but use the values 1.7.43 rather than
the original data values.
Note finally that if the two dummy observation extensions (sums-of-coefficients and dummy initial
observations) have been introduced in the context of the dummy prior, they can actually apply to
any of the other priors developed so far. Adaptation is straightforward. Define:
Y
X
Y ∗ = Ys , X ∗ = Xs , and T ∗ = T + Ts + To (1.7.44)
Yo Xo
with Ys , Yo , Xs and Xo defined as in 1.7.31, 1.7.32, 1.7.37 and 1.7.38. Then run estimation of the
posterior distribution as usual, but replace Y, X and T by Y ∗ , X ∗ and T ∗ . Also, it is obviously
possible to run the estimation process with only one of the two dummy extensions, with 1.7.44
modified accordingly.
37
1. Model estimation and evaluation
Imagine that for some reason, one thinks that the second variable does not affect the first variable,
that is, it has no impact on it. In terms of the example model 1.8.1, the fact that y1,t is exogenous
to y2,t translates into:
y a1
1,t = 11
0 y1,t−1 a211 0 y1,t−2 c11 ε1,t
1 1
+ 2 2
+ (x1,t ) + (1.8.2)
y2,t a21 a22 y2,t−1 a21 a22 y2,t−2 c21 ε2,t
If 1.8.2 is believed to be the correct representation of the relation between y1 and y2 , one would like
to obtain this representation from the posterior of the VAR model. In fact, it turns out to be easy
to force the posterior distribution of a BVAR model to take the form of 1.8.2: by setting a 0 prior
mean on the relevant coefficients, and by implementing an arbitrary small prior variance on them,
one can make sure that the posterior values will be close to 0 as well. In practice, this implies the
following: first, set the prior mean by using a conventional Minnesota scheme. Here, one would just
use 1.3.4:
1
0
0
0
0
β0 = (1.8.3)
0
1
0
0
0
This guarantees that the prior mean of any block exogenous coefficient is 0 (the Minnesota scheme
only implements non-zero entries on own lags, which cannot be part of the block exogeneity scheme
since a variable cannot be exogenous to itself). Then, use a variance scheme similar to 1.3.8, but
multiply the block exogenous variance by an additional parameter (λ5 )2 , which will be set to an
arbitrary small value. This will result in a very tight prior variance on these coefficients. In practice,
one may for example use the value: λ5 = 0.001. Using this strategy on the above example, one
obtains a modified version of 1.3.8:
38
1. Model estimation and evaluation
(λ1 )2 0 0 0 0 0 0 0 0 0
2
σ1
(λ1 λ2 λ5 )2
0 0 0 0 0 0 0 0 0
σ2
2
2
λ1
0 0 0 0 0 0 0 0 0
2λ3
2 2
σ1 λ1 λ2 λ5
0 0 0 0 0 0 0 0 0
σ2 2λ3
2
σ12 (λ1 λ4 )2
0 0 0 0 0 0 0 0 0
Ω0 =
2
σ2
2
0 0 0 0 0 (λ1 λ2 ) 0 0 0 0
σ2
1
2
0 0 0 0 0 0 (λ1 ) 0 0 0
2 2
σ2 λ1 λ2
0 0 0 0 0 0 0 0 0
σ2 2λ3
1
2
λ1
0 0 0 0 0 0 0 0 0
2λ3
0 0 0 0 0 0 0 0 0 σ22 (λ1 λ4 )2
(1.8.4)
Because the prior variance will be very close to 0 (it can actually be made arbitrarily close to 0 by
reducing the value of λ5 ), the posterior distribution will be extremely tight around 0, as wished.
Of course, block exogeneity needs not being limited to one variable only. One may create as many
exogenous blocks as required. Suffice is to multiply the prior variance of all the relevant coefficients
by (λ5 )2 to obtain the desired exogenity on the posterior mean.
A final remark on block exogeneity: it is available with the Minnesota, independent normal-
Wishart, and normal diffuse priors, but not with the normal-Wishart prior nor the dummy obser-
vation prior. For the dummy observation prior the reason is obvious - the prior is diffuse, so Σ⊗ is
simply not defined. For the normal-Wishart prior it is the particular Kronecker structure Σ ⊗ Φ0 in
place of the covariance matrix Ω0 that causes instability. This structure implies that the variance of
one equation has to be proportional with the variance of the other equations. Hence, imposing block
exogeneity on one variable for one equation would lead to impose it on all the other equations. Not
only would it lead to assume block exogeneity on some equations where it would not be desired, but
it would also lead to some of the model variables to be exogenous to themselves, which is impossible
(for instance, in the above example, y2 would become exogenous to itself).
39
1. Model estimation and evaluation
prior distribution? This issue is central, as one wants to select an adequate model before starting
the analysis of forecasts, impulse response functions, and so on.
Answering this question is fundamentally a matter of model comparison: for instance the simplest
way to determine if the optimal number of lags for the model is two or three, one will simply
compare the two models and determine which one has the highest posterior probability of being
the true model. The discussion was initiated in subsection 2, and it was seen (equations 1.2.20 and
1.2.21) that comparing two models requires the computation of the Bayes factor, itself derived from
the marginal likelihoods of the models. This subsection is thus dedicated to the methods used to
compute the marginal likelihood in practice.
The methodology employed to derive the marginal likelihood varies from one prior to the other.
Therefore, the derivations are developed in turn for each prior 2 .
The derivation of the marginal likelihood for the Minnesota prior essentially follows the strategy
proposed by Giannone et al. (2015) for the normal-Wishart prior. To derive the marginal likelihood
for model i, first remember that it is defined by 1.2.20 as:
Z
mi (y) = fi (y |θi , Mi )πi (θi |Mi )dθi (1.9.1)
Suppress for the time being the model indexes i and Mi to consider the general situation wherein
m(y) is the marginal density for a given model. Then, 1.9.1 reformulates as:
Z
m(y) = f (y |θ)π(θ)dθ (1.9.2)
The marginal likelihood can thus be seen as the product of the data likelihood function f (y |θ ) with
the prior distribution π(θ), integrated over parameter values. Note that unlike the application of
Bayes rule to derive posterior distribution, it is not sufficient here to work only with the kernels of
the distributions. The normalizing constants have to be integrated in the calculations. In the case
of the Minnesota prior (and the other natural conjugate prior, the normal-Wishart), it is possible to
apply 1.9.2 directly to compute the value of the marginal likelihood.
For the Minnesota, the set of parameters θ reduces to the VAR coefficients β, so that θ = β, and
1.9.2 writes as:
2
Some details of the derivations are omitted in the main text. The missing steps can be found in Appendix H
40
1. Model estimation and evaluation
Z
m(y) = f (y |β)π(β)dβ (1.9.3)
1
−1/2 ,
f (y β, Σ̄) = (2π)−nT /2 Σ̄ exp − y − X̄β Σ̄−1 y − X̄β (1.9.4)
2
The prior density π(β) is given by 1.3.13:
1
−nk/2 −1/2
π(β) = (2π) |Ω0 | exp − (β − β0 ), Ω−1
0 (β − β0 ) (1.9.5)
2
Combining 1.9.4 and 1.9.5, one obtains:
−1/2
f (y |β ) π(β) = (2π)−n(T +k)/2 Σ̄ |Ω0 |−1/2
1 n
, o
× exp − y − X̄β Σ̄−1 y − X̄β + (β − β0 ), Ω−1
0 (β − β 0 ) (1.9.6)
2
Note that the second row of 1.9.6 is just C.1. Then, from C.8, it is possible to rewrite 1.9.6 as:
−1/2
f (y |β ) π(β) = (2π)−n(T +k)/2 Σ̄ |Ω0 |−1/2
1 n
, o
−1 , −1 , −1 , −1
× exp − β − β̄ Ω̄ β − β̄ + β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ̄ y (1.9.7)
2
Where β̄ and Ω̄ are defined as in 1.3.17 and 1.3.18. It is then possible to reformulate 1.9.7 as:
1 , −1
−1/2 1/2
f (y |β ) π(β) = (2π)−nT /2 Σ̄ |Ω0 |−1/2 Ω̄ exp − β0 Ω0 β0 − β̄ , Ω̄−1 β̄ + y , Σ̄−1 y
2
1
−1/2 ,
× (2π)−nk/2 Ω̄ exp − β − β̄ Ω̄−1 β − β̄ (1.9.8)
2
The advantage of 1.9.8 is that its second row can be readily recognized as the density of a multivariate
normal distribution for β. Therefore, when integrating with respect to β , this row will simply
integrate to 1, greatly simplifying 1.9.8.
41
1. Model estimation and evaluation
Z
m(y) = f (y |β)π(β)dβ
1 , −1
−1/2 1/2
= (2π)−nT /2 Σ̄ |Ω0 |−1/2 Ω̄ exp − β0 Ω0 β0 − β̄ , Ω̄−1 β̄ + y , Σ̄−1 y
2
1
Z −1/2 ,
(2π)−nk/2 Ω̄ exp − β − β̄ Ω̄−1 β − β̄ dβ (1.9.9)
2
1
−1/2
−1/2 1/2
−nT /2
m(y) = (2π) Σ̄ |Ω0 | Ω̄ exp − β0, Ω−1
0 β0
, −1 ,
− β̄ Ω̄ β̄ + y Σ̄ y −1
(1.9.10)
2
Numerical issues with the marginal likelihood for the Minnesota prior
While 1.9.10 is a perfectly correct formula for the marginal likelihood, it may suffer from numerical
instability. In other words, numerical softwares may not be able to compute it, and will return an
error. This is mostly due to the fact that for large models, Ω0 may become close to singular (some
diagonal entries will become very close to zero), leading the software to conclude that |Ω0 |=0. It
is then preferable to transform 1.9.10, in order to obtain a formula which will be more stable, and
computationally more efficient. After some manipulations, it can be rewritten as:
−1/2
m(y) = (2π)−nT /2 |Σ|−T /2 Ink + FΩ, Σ−1 ⊗ X , X FΩ
1 , −1
, −1 , −1
× exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ ⊗ IT y (1.9.11)
2
where FΩ denotes the square root matrix of Ω0 , that is, the matrix FΩ such that FΩ FΩ, = Ω0 . 1.9.11
is both numerically stable and faster to compute than 1.9.10. The determinant of the first row can
be obtained from A.21, taking the product of 1 plus the eigenvalues of FΩ, (Σ−1 ⊗ X , X) FΩ .
Finally, as it is typically easier to work with logs than with values in level, 1.9.11 can be equivalently
reformulated as:
nT T 1
log (m(y)) = − log (2π) − log (|Σ|) − log Ink + FΩ, Σ−1 ⊗ X , X FΩ
2 2 2
1 , −1
− β0 Ω0 β0 − β̄ , Ω̄−1 β̄ + y , Σ−1 ⊗ IT y (1.9.12)
2
42
1. Model estimation and evaluation
The strategy to derive the marginal likelihood for the normal Wishart prior is comparable to that
of the Minnesota, though the computation are made more complex by the inclusion of two sets of
parameters β and Σ. Hence, for the normal Wishart, the set of parameters is θ = β, Σ, so that 1.9.2
writes:
ZZ
m(y) = f (y |β, Σ) π(β, Σ)dβdΣ (1.9.13)
From 1.1.13, 1.1.14 and 1.3.1, the likelihood for the data is given by:
f (y |β, Σ) = (2π)−nT /2
1
× |Σ ⊗ IT |−1/2 exp − (y − (In ⊗ X) β), (Σ ⊗ IT )−1 (y − (In ⊗ X) β) (1.9.15)
2
The second row of 1.9.15 is just D.1. Therefore, from D.8, the data density rewrites as:
1 n , o
f (y |β, Σ) = (2π)−nT /2 |Σ|−T /2 exp − tr Σ−1 B − B̂ (X , X) B − B̂
2
1 n −1
, o
× exp − tr Σ (Y − X B̂) (Y − X B̂) (1.9.16)
2
1
−nk/2 −1/2
π(β) = (2π) |Σ ⊗ Φ0 | exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 ) (1.9.17)
2
GivenB.13, 1.9.17 reformulates as:
1 h
i
−nk/2 −k/2 −n/2
π(β) = (2π) |Σ| |Φ0 | exp − tr Σ−1 (B − B0 ), Φ−1
0 (B − B0 ) (1.9.18)
2
Finally, the prior distribution for Σ is given by:
1 1 n
o
π(Σ) = |S0 |α0 /2 |Σ|−(α0 +n+1)/2 exp − tr Σ−1 S0 (1.9.19)
2α0 n/2 Γn α0 2
2
43
1. Model estimation and evaluation
1
f (y |β, Σ)π(β)π(Σ) = (2π)−nT /2 (2π)−nk/2 |Φ0 |−n/2
α0
|S0 |α0 /2
2α0 n/2 Γn 2
1 n
, o
× |Σ|−T /2 exp − tr Σ−1 B − B̂ (X , X) B − B̂
2
1
o
n
−1 ,
× exp − tr Σ (Y − X B̂) (Y − X B̂)
2
−k/2 1 h −1 , −1
i
× |Σ| exp − tr Σ (B − B0 ) Φ0 (B − B0 )
2
1 n −1 o
−(α0 +n+1)/2
× |Σ| exp − tr Σ S0 (1.9.20)
2
The last four rows of 1.9.20 can be recognised as D.10. Therefore, from D.16, 1.9.20 rewrites as:
1
f (y |β, Σ)π(β)π(Σ) = (2π)−nT /2 (2π)−nk/2 |Φ0 |−n/2
α0
|S0 |α0 /2
2α0 n/2 Γn 2
1 n
,
h io
−k/2
× |Σ| exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄)
2
1 n −1 o
−(ᾱ+n+1)/2
× |Σ| exp − tr Σ S̄ (1.9.21)
2
where B̄, Φ̄, ᾱ and S̄ are defined as in 1.9.17-1.9.20. It is then convenient to reformulate 1.9.21 as:
ᾱ
n/2 −ᾱ/2 2ᾱn/2 Γn
(2π)−nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
f (y |β, Σ)π(β)π(Σ) =
α0
2α0 n/2 Γn 2
1 n
−n/2 io
,
h
−nk/2 −k/2
× (2π) |Σ| Φ̄ exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄)
2
1 1 n −1 o
ᾱ/2
−(ᾱ+n+1)/2
× S̄ |Σ| exp − tr Σ S̄ (1.9.22)
2ᾱn/2 Γn ᾱ 2
2
1.9.22 greatly facilitates the integration process in 1.9.14, since the second row of 1.9.22 can be
recognised as the density of a matrix normal distribution, while the third row can be recognised as
the density of an inverse Wishart distribution, both integrating to 1.
44
1. Model estimation and evaluation
ZZ
m(y) = f (y |β, Σ) π(β)π(Σ)dβdΣ
ᾱ
Z n/2 −ᾱ/2 2ᾱn/2 Γn
(2π)−nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
=
α
2α0 n/2 Γn 20
1 n
Z −n/2 io
,
h
−nk/2 −k/2
× (2π) |Σ| Φ̄
exp − tr Σ−1 (B −1
− B̄) Φ̄ (B − B̄) dβ
2
1 1
ᾱ/2 n o
× S̄ |Σ|−(ᾱ+n+1)/2 exp − tr Σ−1 S̄ dΣ
2ᾱn/2 Γn ᾱ 2
2
ᾱ
n/2 −ᾱ/2 2ᾱn/2 Γn
(2π)−nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
=
α
2α0 n/2 Γn 20
1 1 n
Z ᾱ/2 o
× S̄ |Σ|−(ᾱ+n+1)/2 exp − tr Σ−1 S̄ dΣ (1.9.23)
2ᾱn/2 Γn ᾱ 2
2
Which yields:
ᾱ
n/2 −ᾱ/2 2ᾱn/2 Γn
(2π)−nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
m(y) =
α0
(1.9.24)
2α 0 n/2 Γn 2
After some additional manipulations, one eventually obtains:
ᾱ
n/2 −ᾱ/2 Γn
π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
m(y) =
α0
(1.9.25)
Γn 2
Numerical issues with the marginal likelihood for the normal-Wishart prior
1.9.25 is a valid formula for the marginal likelihood, but it tends to suffer from the same numerical
instability as in the Minnesota case. To improve numerical stability and efficiency, some reformulation
is required. After quite a bit of manipulations, it is possible to show that 1.9.25 reformulates as:
ᾱ
Γn h i −ᾱ/2
|S0 |−T /2 |Ik + FΦ, X , XFΦ |−n/2 In + FS,
−nT /2 2
m(y) = π S̄ − S0 FS (1.9.26)
α0
Γn 2
where FΦ denotes the square root matrix of Φ0 so that FΦ FΦ, = Φ0 , and FS denotes the inverse
square root matrix of S0 so that FS FS, = S0−1 . Once again, the two determinant terms in 1.9.26 can
h i
be computed taking the products of 1 plus the eigenvalues of FΦ, X , XFΦ and FS, S̄ − S0 FS .
Working from A.21, by once again with logs rather than levels, 1.9.26 becomes:
45
1. Model estimation and evaluation
nT ᾱ α0 T
log (m(y)) = − log (π) + log Γn − log Γn − log (|S0 |)
2 2 2 2
n ᾱ
− log (|Ik + FΦ, X , XFΦ |) − log In + FS, S̄ − S0 FS (1.9.27)
2 2
Deriving the marginal likelihood for the independent normal Wishart prior
While in the case of the Minnesota and normal Wishart priors, it was possible to derive the value of
the marginal likelihood by direct application of 1.9.2, this is not possible anymore in the case of the
independent normal Wishart prior. The reason is similar to that preventing to obtain an analytical
formula for the posterior distributions for this prior: in the product term f (y |β, Σ)π(β)π(Σ), the
terms involving β and Σ are so interwoven that it is not possible to separate them into marginal
distributions disappearing during the integration process.
There exists, fortunately, alternative ways to obtain the marginal likelihood. The one used for the
independent normal-Wishart prior follows the methodology proposed by Chib (1995), who proposes
a simple technique based on Gibbs sampling outputs. Start again from 1.9.2 and develop, using basic
definitions of conditional probabilities:
Z Z Z
m(y) = f (y |θ)π(θ)dθ = [f (y, θ)/π(θ)] π(θ)dθ = f (y, θ)dθ = f (y) (1.9.28)
That is, the marginal likelihood is equal to f (y), the density of the data. The strategy of Chib (1995)
consists in noticing that the inverse of f (y) is used as the normative constant in Bayes rules 1.2.2,
and use this rule to obtain the marginal likelihood. Hence, start from Bayes rule 1.2.2:
f (y |θ )π(θ)
π(θ |y ) = (1.9.29)
f (y)
Use 1.9.27 and rearrange to obtain:
f (y |θ )π(θ)
m(y) = (1.9.30)
π(θ |y )
Given that θ = β, Σ , and assuming as usual independence, 1.9.30 rewrites:
f (y |β, Σ)π(β)π(Σ)
m(y) = (1.9.31)
π(β, Σ |y )
Equation 1.9.30 is perfectly general and thus works for any chosen value for β and Σ. In practice,
however, a point of high density such as the posterior median is chosen in order to increase numerical
precision. Denoting respectively by β̃ and Σ̃ the posterior median for β and Σ, 1.9.31 rewrites as:
46
1. Model estimation and evaluation
f (y β̃, Σ̃)π(β̃)π(Σ̃)
m(y) = (1.9.32)
π(β̃, Σ̃ |y )
While the denominator of 1.9.32 can be readily computed (it is the product of the data likelihood
with the priors distributions for β and Σ, estimated at β̃ and Σ̃), the numerator is unknown. Indeed,
as shown by 1.2.3, only the kernel of the posterior distribution π(β, Σ |y ) is computed in practice,
since the normalising term f (y) in 1.2.2 is unknown (indeed, this term is the marginal likelihood, to
be estimated). Therefore, it is not possible to use the kernel of the posterior density obtained from
1.2.3 in place of π(β̃, Σ̃ |y ), which is the full posterior value. The solution proposed by Chib (1995)
consists first in noticing that π(β̃, Σ̃ |y ) can be manipulated to obtain:
Z
π(Σ̃, β, y)
Z Z
π(Σ̃, β, y) π(β, y) Z
π(Σ̃ |y ) = π(Σ̃, β |y )dβ = dβ = dβ = π(Σ̃ |β, y )π(β |y )dβ
π(y) π(β, y) π(y)
(1.9.34)
While the integral in 1.9.34 is not analytically computable, an approximation of this term can be
estimated from:
It−Bu
Z
1
π(Σ̃ β (n) , y )
X
π(Σ̃ |y ) = π(Σ̃ |β, y )π(β |y )dβ ≈ (1.9.35)
(It − Bu) n=1
Then, from 1.9.33 and 1.9.35, it is possible to rewrite 1.9.32 as:
f (y β̃, Σ̃)π(β̃)π(Σ̃)
m(y) = It−Bu
(1.9.36)
π(β̃ Σ̃, y )(It − Bu)−1 π(Σ̃ |β (n) , y )
P
n=1
Combining the likelihood function B.18 with the priors 1.3.13 and 1.9.19, and simplifying, one even-
tually obtains:
47
1. Model estimation and evaluation
−1/2
(2π)−nT /2 −(T +α0 +n+1)/2 |Ω |
m(y) = |S0 |α0 /2 Σ̃ 0
α n/2 α0
2 0 Γn 2 Ω̄
1
oi
,
h n
× exp − tr Σ̃−1 (Y − X B̃) (Y − X B̃) + S0
2
1 1
,
× exp − (β̃ − β0 ) Ω−1
0 β̃ − β0 × It−Bu
(1.9.37)
2
(It − Bu)−1 π(Σ̃ |β (n) , y )
P
n=1
Numerical issues with the marginal likelihood for the independent normal-Wishart prior
1.9.37 provides an accurate approximation of the marginal likelihood value, but it can also suffer
from numerical instability. It is thus preferable to rewrite it to obtain a more stable and efficient
formulation. After some manipulations, one obtains:
where FΩ denotes the square root matrix of Ω0 , that is, FΩ FΩ, = Ω0 . The determinant term in the
first row can be computed, as usual from A.21, by taking the products of 1 plus the eigenvalues of
FΩ, (In ⊗ X , ) Σ̃−1 ⊗ X FΩ .
Once again, it is more convenient to work with logs rather than with values in level. Therefore,
1.9.38 is rewritten as:
nT α0 n α0 α0 T + α0 + n + 1
log (m(y)) = − log(2π) − log(2) − log Γn + log (|S0 |) − log Σ̃
2 2 2 2 2
1 1 h n ,
oi
− log Iq + FΩ, (In ⊗ X , ) Σ̃−1 ⊗ X FΩ − tr Σ̃−1 (Y − X B̃) (Y − X B̃) + S0
2 2
It−Bu
!
1 , −1
−1
X
(n)
− (β̃ − β0 ) Ω0 β̃ − β0 − log (It − Bu) π(Σ̃ β , y ) (1.9.39)
2 n=1
48
1. Model estimation and evaluation
Deriving the marginal likelihood for the normal diffuse and dummy priors
In the case of the normal diffuse prior, it is not possible to derive the marginal likelihood. This can
be seen simply from 1.9.2:
Z
m(y) = f (y |θ)π(θ)dθ (1.9.40)
Since for the normal-diffuse, θ = β, Σ, and β and Σ are independent, this reformulates as:
ZZ
m(y) = f (y |β, Σ) π(β)π(Σ)dβdΣ (1.9.41)
The problem, as shown by 1.6.3, is that π(Σ) is an improper prior. Because it is diffuse and does
not integrate to one, only its kernel is known:
This renders estimation of 1.9.40 impossible, as the full proper prior π(Σ) is required, and not just
the kernel. For the dummy prior the reasoning is exactly the same.
When dummy observations are included in the estimation process, it is not correct to calculate naively
the marginal likelihood over the total data set (comprising both actual and dummy observations), as
the dummy observations are now included into the estimation process, and hence their contributions
must be taken into account if one wants to obtain the marginal likelihood for actual data only.
Concretely, and following 1.7.44,
denote
by Y ∗ the total data set (comprising both actual and dummy
Ys
observations) and by Y dum = the set of dummy observations. Denote their respective marginal
Yo
∗ dum
likelihoods by m(y ) and m(y ). The object of interest is m(y), the marginal likelihood for the
actual data only. Notice that from 1.9.28, the marginal likelihood is just equal to the density of the
data. Therefore, the conventional properties of densities apply. Then, using the fact that Y and
Y dum are independent, one obtains:
It follows that:
m(y ∗ )
m(y) = (1.9.44)
m(y dum )
49
1. Model estimation and evaluation
That is, the marginal likelihood for the data can be recovered by dividing the marginal likelihood
for the total data set by that of the dummy observations alone.
In their seminal paper, Giannone et al. (2012) introduce a procedure allowing to optimise the values
of the hyperparameters. Optimal here means that the estimated hyperparameters maximise the
value of the marginal likelihood for the model. This implies that the hyperparameter values are not
given anymore but have to be estimated within the Bayesian framework, adopting the hierarchical
approach described in section 1.2. A similar but simpler approach consists into running a grid search.
To do so, one defines for every hyperparameter of the model a minimum and a maximum value (hence
defining a range) along with a step size defining the size of the increment within the range. Then the
marginal likelihood can be estimated for the model for every possible combination of hyperparameter
values within the specified ranges, and the optimal combination is retained as that which maximises
this criterion.
50
2. Basic applications
2.1. Forecasts
Forecasts are a central issue for economists. In a traditional frequentist approach, obtaining forecasts
is relatively straightforward, by using what is known as the chain rule of forecasting. Indeed, consider
again the VAR model 1.1.2, or its vectorised form 1.1.12. With the frequentist approach, estimation
of the model would produce a single value of β̂, the vector of VAR coefficients, which would be used as
the estimate for the true parameter value β. Equivalently, under its original form, estimation of the
model would produce Â1 , Â2 , ..., Âp and Ĉ, which would be used as estimates for the true parameter
values A1 , A2 , ..., Ap and C. Once these coefficients are estimated, the chain rule of forecasting simply
consists in constructing forecasts for ỹT +1 , ỹT +2 , ..., ỹT +h sequentially by using conditional expectation
in the following way 1 :
where ỹT +1 denotes the predicted value for yT +1 , and yT = {yt }Tt=1 is the information set containing
data observed up to period T . Applying the same method for ỹT +2 yields:
1
It can be shown that this estimator minimizes the mean squared forecast error (see Luetkepohl (1993), chapter
2)
51
2. Basic applications
Going on:
One would like to use this methodology in a Bayesian context as well. This is however not possible
as this method ignores the parameter uncertainty proper to Bayesian analysis. In other words, in a
Bayesian framework, the "correct" parameter values β or A1 , A2 , ..., Ap , C do not exist, they are only
characterised by a distribution from which realisations can be obtained. This implies that forecasts
cannot be obtained either as a single value: they face the same uncertainty as the parameters, and are
thus characterised also by a distribution rather than a single estimate. Such a distribution is called
the posterior predictive distribution, and is a central object of interest for Bayesian practitioners. It
is denoted by:
where f (yT +1:T +h |yT ) denotes the distribution of future datapoints yT +1 , ..., yT +h , conditional on
the information set yT . This posterior predictive distribution is the fundamental element used in
Bayesian forecasting: once it is obtained, it is straightforward to produce confidence intervals and
point estimates, using 1.2.16 and 1.2.17. The main difficulty thus consists in identifying the form of
this posterior distribution. Although analytical solutions may exist, they may not produce tractable
implementations. In practice, the following solution is thus favoured: rearrange 2.1.4 to obtain:
Z
f (yT +1:T +h |yT ) = f (yT +1:T +h , θ|yT )dθ (2.1.5)
θ
f (yT +1:T +h , θ, yT )
Z
= dθ
θ f (yT )
Z
f (yT +1:T +h , θ, yT ) f (yT , θ)
= dθ
θ f (yT , θ) f (yT )
Z
= f (yT +1:T +h |θ, yT )f (θ|yT )dθ (2.1.6)
θ
where θ denotes the parameters of interest for the VAR model (typically, β and Σ). 2.1.6 shows that
the posterior predictive distribution rewrites as an (integrated) product of two distributions: the
posterior distribution, and the distribution of future observations, conditional on data and parameter
values. This way, 2.1.6 suggests a direct simulation method to obtain draws from f (yT +1:T +h |yT ).
52
2. Basic applications
Suppose one can generate random draws from the posterior distribution f (θ |yT ), and then, from
these drawn values and yT , compute a sequence yT +1 , yT +2 , ..., yT +h . This would form a random draw
from f (yT +1:T +h |θ, yT ), so that the product with the draw from f (θ |yT ) would give a draw from
f (yT +1:T +h , θ |yT ), as indicated by 2.1.6. Marginalizing, which simply implies to discard the values
for θ, would then produces a draw from f (yT +1:T +h |yT ).
But doing so is easy. In the case of the independent normal-Wishart and normal-diffuse priors
developed in subsections 1.5 and 1.6., draws from f (θ |yT ) are already obtained from the Gibbs
sampling process of the BVAR estimation. For the Minnesota and normal-Wishart priors, suffice is
to run a comparable algorithm. Once estimates for the Gibbs algorithm are obtained, the procedure is
simple: for each iteration of the algorithm, a sequence yT +1 , yT +2 , ..., yT +h can be obtained by drawing
h series of residuals, then constructing (yT +1 |θ, yT ), (yT +2 |θ, yT +1 , yT ) , (yT +3 |θ, yT +2 , yT +1 , yT ) and
so on, recursively using 1.1.2.
Karlsson (2012) hence proposes the following algorithm to derive the posterior predictive distri-
bution. Note that the algorithm supposes that random draws from the posterior distributions of β
and Σ are available.
1. Define the number of iterations (It − Bu) of the algorithm. Because the Gibbs algorithm
previously run for the model estimation phase has already produced (It − Bu) draws from the
posterior distribution of β and Σ, an efficient strategy consists in recycling those draws, rather
than running again the whole Gibbs sampler. Therefore, (It − Bu) iterations are sufficient.
Also, define the forecast horizon h.
2. At iteration n, draw Σ(n) and β(n) from their posterior distributions. Simply recycle draw n
from the Gibbs sampler.
(n) (n) (n)
3. Draw simulated series of residuals ε̃T +1 , ε̃T +2 , ..., ε̃T +h from N (0, Σ(n) ).
(n) (n) (n) (n)
4. Generate recursively the simulated values ỹT +1 , ỹT +2 , ..., ỹT +h from 1.1.2: ỹT +1 = A1 yT +
(n) (n) (n)
A2 yT −1 + ... + Ap yT +1−p + CxT +1 + ε̃T +1 Once ỹT +1 is computed, use: ỹT +2 = A1 ỹT +1 +
(n) (n)
A2 yT + ... + Ap yT +2−p + CxT +2 + ε̃T +2 And continue this way until ỹT +h is obtained. The
values of c, , A,1 , A,2 ...A,p come from β(n) . Note that each iteration may involve both actual data
(n) (n)
(regressors up to period T :yT , yT −1 , yT −2 ...) and simulated values (forecasts ỹT +1 , ỹT +2 ... and
(n) (n)
simulated residual series ε̃T +1 , ε̃T +2 , ...). Notice also that the forecasts include the exogenous
values xT +1 , xT +2 ...xT +h , which have hence to be known and provided exogenously.
53
2. Basic applications
a sample of independent draws from the joint predictive distribution which can be used for
inference and computation of point estimates.
Because algorithm 3.2.1.1 requires the series Σ(1) , Σ(2) , ..., Σ(It−Bu) and β(1) , β(2) , ..., β(It−Bu) , it is
necessary to run a Gibbs sampling algorithm to obtain them, even if the retained prior (for instance
the Minnesota or the normal-Wishart prior) yields analytical solutions. Therefore, to conclude this
subsection, the Gibbs algorithm for these two priors is presented. They are very similar to algorithm
3.1.5.1, but are somewhat simpler as the priors admit analytical solutions. Indeed, no burn-in or
transition sample is required since the unconditional posterior distribution is known, so that draws
from the correct marginal distribution can be realised as soon as the algorithm starts. In the case
of the Minnesota prior, this means drawing β directly from a N (β̄, Ω̄). In the normal-Wishart case,
this means drawing B directly from B ∼ MT (α̃, B̄, S̄, Φ̄), and Σ directly from IW(S̄, ᾱ).
1. Set the number of iterations of the algorithm as (It − Bu). Since draws are directly realised
form the posterior distribution, no burn-in sample is required.
2. Fix the value Σ for the BVAR model, in accordance with the prior.
3. At iteration n, draw the value β(n) conditional on Σ, from a multivariate normal with mean
β̄ and variance-covariance matrix Ω̄, as defined in 1.3.17 and 1.3.18: β(n) ∼ N (β̄, Ω̄) with:
h i−1 h i
Ω̄ = Ω−1
0 + Σ −1
⊗ X ,
X and β̄ = Ω̄ Ω−1
0 β0 + (Σ −1
⊗ X ,
)y
1. Set the number of iterations of the algorithm as (It − Bu). Since draws are directly realised
form the posterior distribution, no burn-in sample is required.
2. At iteration n, draw the value B(n) from a matrix-variate student distribution, as defined by
1.4.16, 1.4.17, 1.4.19, 1.4.23 and 1.4.24: B(n) ∼ MT (B̄, S̄, Φ̄, α̃) with α̃ = T + α0 − n + 1,
h i−1 h i−1
Φ̄ = Φ−10 + X ,
X , B̄ = Φ̄ Φ−1
0 B0 + X ,
Y and S̄ = Y , Y + S0 + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
54
2. Basic applications
3. at iteration n, draw the value Σ(n) from an inverse Wishart distribution, as defined by 1.4.18
,
and 1.4.19: Σ(n) ∼ IW ᾱ, S̄ with ᾱ = T + α0 and S̄ = Y − X B̂ Y − X B̂ + S0 +
B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
Finally, note that closely associated to the concept of forecast is that of forecast evaluation, namely
how good is the estimated model at producing forecast values (or distributions) which are close to
the realised values. There exist many criteria for this: some of them only compare the realised value
with the forecast value, while others compare the realised value with the whole posterior distribution
for the forecasts. For more details on the different forecast evaluation criteria and their estimation,
you may refer to Appendix J.
2
That is, if the exogenous variables remain constant as well
55
2. Basic applications
Under the assumption of covariance stationarity, the Wold theorem implies that it is possible to
"invert" this lag polynomial, that is, it is possible to reformulate the model as an infinite order
moving average:
A(L)yt = Cxt + εt
⇔ yt = A(L)−1 [Cxt + εt ]
⇔ yt = A(L)−1 Cxt + A(L)−1 εt
∞
⇔ yt = A(L)−1 Cxt +
X
Ψi εt−i
i=0
The moving average part is made of a sequence of n × n matrices Ψ0 , Ψ1 , Ψ2 ..., where each matrix is
of the form:
φ φi,12 · · · φi,1n
i,11
φi,21 φi,22
· · · φi,2n
Ψi =
.. .. .. .. (2.2.5)
. . . .
φi,n1 φi,n2 · · · φi,nn
The sequence Ψ0 , Ψ1 , Ψ2 ... actually represents the impulse response functions for the model 2.2.1. To
see this, move model 2.2.4 forward by h periods to obtain:
yt+h = A(L)−1 Cxt+h + Ψ0 εt+h + Ψ1 εt+h−1 + ... + Ψh−1 εt+1 + Ψh εt + Ψh+1 εt−1 + . . . (2.2.6)
∂yt+h
= Ψh (2.2.7)
∂εt
And this shows that Ψh represents the impulse response function for the shock εt on yt+h . More
precisely, from 2.2.6 and 2.2.5, it is possible to obtain the impact of the shock in variable j on
variable yi,t+h as:
∂yi,t+h
= φh,ij (2.2.8)
∂εj,t
56
2. Basic applications
While there exists elegant analytical methods to invert a lag polynomial and compute Ψ0 , Ψ1 , Ψ2 ...,
in actual applications it is simpler to rely on simulation methods. To see this, go back to model 2.2.1
and compute the impact of εt on yt :
∂yt
= I = Ψ0 (2.2.9)
∂εt
Move the model forward by one period:
or:
∂yt+1
= A1 = Ψ1 (2.2.12)
∂εt
Move again the model forward by one period and use 2.2.1 and 2.2.11:
or:
57
2. Basic applications
∂yt+2
= A1 A1 + A2 = Ψ2 (2.2.15)
∂εt
Going on, it is possible to recover numerically the whole sequence Ψ0 , Ψ1 , Ψ2 , Ψ3 , Ψ4 ... Note that this
method is in essence very similar to the chain rule of forecasts developed in the previous subsection.
The problem with this method is that it implies the computation of partial derivatives, a task
that numerical softwares are not able to perform. However, looking at the recursive sequence 2.2.1,
2.2.11, 2.2.14, and so on, it is clear that only the terms related to εt are of interest. Therefore, it is
possible to recover numerically φ0,ij , φ1,ij , φ2,ij , . . . , the response of variable i to shock j over periods
0, 1, 2, . . . directly from these equations by setting a unit shock at period t, and switching off to 0 all
the other values of the recursive sequence which are of no interest. Precisely, set
ε
1,t
ε2,t
εt =
..
(2.2.16)
.
εn,t
such that
εj,t = 1
(2.2.17)
6=j,t = 0
ε
and
Then run the recursive sequence 2.2.1, 2.2.11, 2.2.14. Do this for all variables and all shocks, and
recover finally Ψh from 2.2.5 by gathering all the φh,ij elements. Finally, it should be clear from 2.2.1
that assuming εi,t = 1 and yt−1 , yt−2 , ..., xt = 0 is equivalent to assuming yt−1 , yt−2 , ..., xt , εt = 0 and
yi,t = 1, a formulation that will prove more convenient for numerical computations.
As for the forecasts, it is not possible to apply directly this simulation method in a Bayesian
framework, due to the additional parameter uncertainty that prevails in a Bayesian framework. For-
tunately, it is easy to integrate the impulse response calculation into the Gibbs sampling framework
previously developed. Note in particular that the simulation experiment described above really is
equivalent to producing forecasts for ỹt+1 , . . . , ỹt+h in the particular context of the simulation ex-
periment. Therefore, intuitively, one may like to use the methodology introduced in subsubsection
58
2. Basic applications
2.1 for forecasts, and adapt it to impulse response functions. This is indeed what will be done: to
calculate the impulse response functions, simply obtain the posterior predictive distribution 2.1.4:
for h = 1, 2, . . .
conditional on:
• yt−1 , yt−2 , · · · = 0
• εt+1 , εt+2 , · · · = 0
• xt , xt+1 , xt+2 · · · = 0
1. Define the number of iterations (It − Bu) of the algorithm, and the time horizon h.
3. At iteration n, draw β(n) from its posterior distributions. Simply recycle draw n from the Gibbs
sampler.
(n) (n) (n) (n)
4. Generate recursively the simulated values ỹT +1 , ỹT +2 , ..., ỹT +h from 1.1.2: ỹT +1 = A1 yT +
(n) (n)
A2 yT −1 + ... + Ap yT +1−p Once ỹT +1 is computed, use: ỹT +2 = A1 ỹT +1 + A2 yT + ... + Ap yT +2−p
(n)
And continue this way until ỹT +h is obtained. Once again, both the exogenous terms and the
shocks are ignored since they are assumed to take a value of 0 at all periods. The values of
A,1 , A,2 ...A,p come from β(n) .
(n) (n) (n)
5. Discard β(n) to obtain draws ỹT +1 , ỹT +2 ...ỹT +h from the predictive distribution f (yT +1:T +h |yT ).
n oI
(n) (n) (n)
6. Repeat until (It−Bu) iterations have been performed. This produces: ỹT +1 |yT , ỹT +2 |yT , ..., ỹT +h |yT
j
a sample of independent draws from the joint predictive distribution in the case yi,T = 1.
7. Go back to step 2, and fix i = 2. Then go through steps 3-6 all over again. Then repeat the
process for i = 3, ..., n. This generates the impulse response functions for all the shocks in the
model.
59
2. Basic applications
with εt ∼ N (0, Σ). This is a reduced-form VAR model. An alternative specification of this model is
the structural VAR model:
with ηt ∼ N (0, Γ) a vector of structural innovations with variance-covariance matrix Γ. Most of the
time, one wants Γ to be diagonal. This will imply that the shocks in ηt are mutually orthogonal,
which is what is required to obtain meaningful impulse response functions not suffering from the shock
correlation issue. Also, from a more theoretical point of view, it makes also sense to assume that
structural shocks (say e.g. supply shocks, demand shocks, monetary shocks, etc) are uncorrelated
and arise independently.
D = D0−1 (2.3.3)
Then premultiplying both sides of 2.3.2 by D makes straightforward the relation between 2.3.1 and
2.3.2 :
Ai = DDi (2.3.4)
C = DF (2.3.5)
εt = Dηt (2.3.6)
60
2. Basic applications
2.3.6 shows that D can be interpreted as a structural matrix: it permits to recover structural inno-
vations from the reduced-form VAR residuals. Note that 2.3.6 also implies:
or
Σ = DΓD, (2.3.8)
Another interesting feature of structural VARs is the moving average representation of the model.
Remember from 2.2.4 that 2.3.1 can rewrite as an infinite order moving average process:
where the series I, Ψ1 , Ψ2 , Ψ3 , ... represents the impulse response functions of the reduced form VAR.
Rewrite then 2.3.9 as:
or:
∞
yt = A(L)−1 Cxt +
X
Ψ̃i ηt−i (2.3.13)
i=0
where
The series D, Ψ̃1 , Ψ̃2 , Ψ̃3 , ... represents the impulse response functions of the structural VAR, that
is, the response of the VAR variables to structural innovations. Then, as long as Γ is diagonal, the
series of responses D, Ψ̃1 , Ψ̃2 , Ψ̃3 , ... will result from independent shocks, and can be given meaningful
economic interpretation.
If D was known, one could use estimates of the reduced form VAR 2.3.1 to identify the structural
disturbances (from 2.3.6), and to obtain the responses of the variables to structural innovations (from
61
2. Basic applications
2.3.14). However, 2.3.1 provides no information about D. Some information is provided by 2.3.8:
if the VAR 2.3.1 comprises n variables, then D comprises n2 elements to identify, and Γ comprises
n×(n+1)/2 distinct elements, which hence makes a total of (n/2) (3n + 1)elements to identify. Since
in 2.3.8 the known elements of Σ provide only n × (n + 1)/2 restrictions on D and Γ, n2 additional
restrictions have to be implemented to identify D and Γ.
0
Σ = DD (2.4.1)
Given the n2 elements of D to identify, and the n×(n+1)/2 restrictions provided by Σ, there remains
an additional n × (n − 1)/2 restrictions to impose to identify D. A simple way to obtain them is to
implement contemporaneous restrictions on D. Ignoring the exogenous variables, 2.3.2 rewrites:
• Order the variables so as to impose contemporaneous restrictions on D that will make it lower
triangular.
• Compute shocks and orthogonalized response functions from 2.3.6 and 2.3.14.
62
2. Basic applications
In a Bayesian framework, D is considered as a random variable, as any other parameter of the VAR.
Therefore, in theory, one would have to compute its posterior distribution. In practice, however,
because the Choleski identification exactly identifies D (that is, there is a one-to-one relationship
between Σ and D), it is possible to estimate draws from the posterior of D directly from draws from
the posterior distribution of Σ. If the latter have been already obtained for a Gibbs sampling process,
computing the posterior distribution of D merely amounts to recycling existing posterior draws for
Σ.
2. At iteration n, draw Σ(n) from its posterior distributions. Simply recycle draw n from the
Gibbs sampler.
5. Repeat until (It − Bu) iterations have been achieved. This yields a sample of independent
(n) It−Bu
n o
(n)
posterior draws: D(n) , Ψ̃1 , Ψ̃2
n=1
These draws can then be used as usual for point estimates and confidence intervals.
• Γ is diagonal, but not identity. This way, the zeros below the diagonal impose n(n − 1)/2
constraints over the n2 required to identify Γ and D with 2.3.8.
63
2. Basic applications
• D is lower triangular, and its main diagonal is made of ones. This assumes contemporaneous
restrictions in a way that is similar to a Cholesky decomposition, and additionally imposes a
unit contemporaneous response of variables to their own shocks. Then, the zeros above the
main diagonal combined with the diagonal of ones generate another n(n + 1)/2 constraints.
Combining the n(n − 1)/2 constraints on Γ with the n(n + 1)/2 constraints on D results in n2
constraints, which exactly identify Γ and D from 2.3.8. In practice, identification follows from the
following result from Hamilton (1994) (result 4.4.1, p 87):
Any positive definite symmetric n × n matrix Σ has a unique representation of the form:
Σ = DΓD, (2.5.1)
where D is a lower triangular matrix with ones along the principal diagonal, and Γ is a diagonal
matrix.
Suffice is thus to apply the result directly to satisfy 2.3.8. Also, uniqueness of the decomposition
permits to integrate it into the Gibbs sampling process. Empirical computation of D and Γ follows
from the result on Choleski factors provided in Hamilton (1994), p 92. This result basically states
the following: because Σ is positive definitive, it has a unique Choleski factor H such that:
Σ = HH , (2.5.2)
But then, from 2.5.1 and 2.5.2, it is straightforward to conclude that DΓD, = HH , or equivalently
that DΓ1/2 = H, which implies:
√g11 0 0 ··· 0
√g 0 0 ··· 0
··· 0 √11
1 0 0 √ √
d21 1 0 ··· 0 0 g22 0 ··· 0 d21 √g11 g22 0 ··· 0
√
d31 g11 d32 √g22 √
d31 d32 1 0 0 0 g33 0 g33 0
= (2.5.3)
.. ..
.. ..
.. ..
.. .. ..
.
. . . . . √
.
√ .
√ √ .√
dn1 dn2 dn3 ··· 1 0 0 0 gnn dn1 g11 dn2 g22 dn3 g33 ··· gnn
Any numerical software can compute the Choleski factor H (the right-hand side of 2.5.3) very easily.
Once H is known, 2.5.3 makes it clear that it suffices to recover D to divide each column of H by
√ √
its corresponding diagonal entry: divide column one by g11 , column two by g22 , and so on. As
for Γ, 2.5.3 identifies Γ1/2 . To obtain Γ, the only step to take is to square all the diagonal entries of
Γ1/2 . Then D and Γ are identified.
64
2. Basic applications
2. At iteration n, draw Σ(n) from its posterior distributions. Simply recycle draw n from the
Gibbs sampler.
3. Obtain D(n) and Γ(n) from triangular factorisation of Σ(n) , using 2.5.3
(n) (n) (n) (n)
4. Obtain Ψ̃1 , Ψ̃2 ... from Ψ1 D(n) , Ψ2 D(n) ..., following 2.3.14. In practice, there is no need to
(n) (n)
calculate Ψ1 , Ψ2 ... since they have already been obtained when the impulse functions have
been computed. Suffice is thus to recycle those estimates.
5. Repeat until (It − Bu) iterations have been achieved. This yields a sample of independent
posterior draws:
n oIt−Bu
(n) (n)
D(n) , Γ(n) , Ψ̃1 , Ψ̃2 ...
n=1
These draws can then be used as usual for point estimates and confidence intervals.
To be precise, the methodology described in this subsection develops three types of restrictions.
Sign restriction represents the action of constraining the response of a variable to a specific structural
shock to be positive or negative. Magnitude restriction represents the fact of constraining the response
of a variable to a specific structural shock to be included into some interval of values. Finally, zero
restrictions represent the action of constraining the response of a variable to a specific structural
shock to take the value of zero. Each such restriction set by the user of the VAR model can be
65
2. Basic applications
defined over any number of impulse response function periods, which need not be the same across
restrictions.
For simplicity, assume that ηt ∼ N (0, I), that is, the structural shocks are mutually orthogonal
and have unit variance. The aim consists in finding a structural matrix D = D0−1 such that the
structural impulse response functions Ψ̃0 , Ψ̃1 , Ψ̃2 ... produced from model 2.6.1 satisfy the restrictions
specified by the user. To verify that the restrictions hold, it is convenient to stack the structural
impulse response function matrices of all periods subject to a restriction into a single matrix de-
noted by f (D, D1 , ..., Dp ). For instance, if restrictions are implemented for periods p1 , p2 , ..., pn , then
f (D, D1 , ..., Dp ) is:
Ψ̃
p1
Ψ̃p2
f (D, D1 , ..., Dp ) =
..
(2.6.2)
.
Ψ̃pn
Verification of the restrictions can then be realized by the way of selection matrices. For example, with
sign restrictions, the matrix for sign restrictions with respect to structural shock j, for j = 1, 2, ..., n,
will be the matrix Sj with a number of columns equal to the number of rows of f (D, D1 , ..., Dp ), and
a number of rows equal to the number of sign restrictions on shock j. Each row of Sj represents one
restriction and is made only of zeros, save for the entry representing the restriction which is a one
(for a positive sign restriction), or a minus one (for negative sign restrictions). Then, the restrictions
on shock j hold if:
where fj (D, D1 , ..., Dp ) represents column j of the matrix f (D, D1 , ..., Dp ). The sign restrictions hold
if 2.6.3 holds for all shocks j = 1, 2, ..., n.
Magnitude restrictions on shock j can be represented by the way of the selection matrix Mj , and
two vectors Ml,j and Mu,j . Mj is a selection matrix with a number of columns equal to the number
of rows of f (D, D1 , ..., Dp ), a number of rows equal to the number of magnitude restrictions on shock
j, and selection entries equal to one. Ml,j and Mu,j are vectors with as many rows as Mj . Each
row entry of Ml,j is the lower bound of the corresponding restriction interval, while each row entry
66
2. Basic applications
of Mu,j contains the upper bound of the restriction interval. Then, the magnitude restrictions on
structural shock j hold if :
where the operator × denotes element wise product rather than a standard matrix product. The
idea is the following: if the magnitude restrictions are satisfied, then the considered impulse re-
sponse function values Mj × fj (D, D1 , ..., Dp ) are comprised between Ml,j and Mu,j . Therefore,
Mj × fj (D, D1 , ..., Dp ) − Ml,j should be a vector of positive values, and Mu,j − Mj × fj (D, D1 , ..., Dp )
should also be a vector of positive values. Element wise multiplication should thus result in a strictly
positive vector. On the other hand, if any one restrictions is not satisfied, then either the correspond-
ing row of Mj × fj (D, D1 , ..., Dp ) − Ml,j will be negative (if the impulse response function value is
smaller than the lower bound) while the corresponding row of Mu,j − Mj × fj (D, D1 , ..., Dp ) will be
positive, or the row of Mj × fj (D, D1 , ..., Dp ) − Ml,j will be negative (if the impulse response function
value is larger than the upper bound) while the corresponding row of Mj × fj (D, D1 , ..., Dp ) − Ml,j
will be positive. In both cases, the element wise product will be negative, indicating failure of the
restriction. The magnitude restrictions hold if 2.6.4 holds for all shocks j = 1, 2, ..., n.
Eventually, zero restrictions with respect to structural shock j can be checked using a selection
matrix Zj , with a number of columns equal to the number of rows of f (D, D1 , ..., Dp ), a number
of rows equal to the number of zero restrictions on shock j, and zero entries, except for the entries
relative to the restrictions which take a value of one. Then, the zero restrictions on structural shock
j hold if:
The zero restrictions hold if 2.6.5 holds for all shocks j = 1, 2, ..., n. In the line of the Gibbs sampler
methodology systematically used so far, a natural strategy would be to adopt the following algorithm:
Algorithm 2.6.1 (Gibbs sampling for sign, magnitude and zero restrictions):
1. Draw the SVAR coefficients D0 , D1 , D2 , ..., Dp and F from the unrestricted posterior distribu-
tion.
2. Compute the structural impulse response functions Ψ̃0 , Ψ̃1 , Ψ̃2 ... from the coefficients.
3. Check if the restrictions are satisfied, using 2.6.3, 2.6.4 and 2.6.5. If yes, keep the draw, if not,
discard the draw.
4. Repeat steps 1-3 until the desired number of iterations satisfying the restrictions is obtained.
67
2. Basic applications
Of course, the difficulty with algorithm 2.6.1 is that the traditional Gibbs sampler framework does
not allow to draw directly from the posterior distribution of the SVAR coefficients D0 , D1 , D2 , ..., Dp
and F . Rather, the Gibbs sampling procedure produces draws from the posterior distribution of the
reduced form VAR model 1.1.2:
with εt ∼ N (0, Σ). That is, the conventional Gibbs sampler methodology only provides draws for
A1 , A2 , ..., Ap , C and Σ.
Intuitively, it would be tempting to apply the following strategy: draw the coefficients A1 , A2 , . . . , Ap , C
and Σ of a reduced-form VAR model, from the posterior distribution. From these coefficients, obtain
the impulse response functions Ψ0 , Ψ1 , Ψ2 ... Then apply a standard identification scheme such as a
Choleski factorization of the residual covariance matrix Σ to recover the structural matrix D. With
D at hand, finally, identify the SVAR impulse response functions Ψ̃0 , Ψ̃1 , Ψ̃2 ... Check if the restric-
tions are satisfied, as described in algorithm 2.6.1, and preserve the draw only if the requirement
is met. The problem is that such an identification would not produce a posterior draw from the
correct distribution for the SVAR coefficients D0 , D1 , D2 , ..., Dp and F . Arias et al. (2014) show
however (theorem 2) that it is possible to use draws from the posterior distributions of the reduced
form model to obtain draws from the correct posterior distribution of the SVAR model. The only
requirement is the implementation of an additional orthogonalisation step.
Because the procedure differs depending on the fact the zero restrictions are included or not in
the setting, the two methodologies are developed in turn, starting with the simplest case of sign and
magnitude restrictions only.
Identification with pure sign and magnitude restrictions: In the case of pure sign and magnitude
restrictions, the procedure remains simple. First, draw a vector β (that is, a set of reduced form VAR
coefficients A1 , A2 , ..., Ap , C), and a residual covariance matrix Σ from their posterior distributions.
From this, recover the reduced form VAR model 1.1.2:
From this reduced VAR model, one can obtain the impulse response functions Ψ0 , Ψ1 , Ψ2 ...Then,
define a preliminary structural matrix h(Σ), where h() is any continuously differentiable function of
symmetric positive definite matrices such that h(Σ) × h(Σ), = Σ. In practice, the usual Choleski
factor is used for h(). From this preliminary structural matrix, obtain a first set of structural impulse
response functions Ψ̄0 , Ψ̄1 , Ψ̄2 ... from 2.3.14:
68
2. Basic applications
These preliminary impulse response functions, however, are not drawn from the correct distribution.
To draw from the correct posterior distribution, an additional orthogonalisation step is required. To
do so, one has to draw a random matrix Q from a uniform distribution, and define:
D = h(Σ)Q (2.6.9)
The strategy is then to draw such a Q matrix which would be orthogonal, in order to preserve the
SVAR property 2.3.8:
To obtain an orthogonal matrix Q from the uniform distribution, the procedure is the following.
First, draw a n × n random matrix X, for which each entry is drawn from an independent standard
normal distribution. Then, use a QR decomposition of X, such that X = QR, with Q an orthogonal
matrix and R an upper triangular matrix. It is then possible to obtain the definitive structural
impulse response functions from 2.2.12 as:
With this, the stacked structural matrix 2.6.2 can write as:
Ψ̃ Ψ̄
p1 p1
Ψ̃p2 Ψ̄p2
¯
f (D, D1 , ..., Dp ) = . = . Q = f (D, D1 , ..., Dp ) × Q (2.6.12)
.. ..
Ψ̃pn Ψ̄pn
with
Ψ̄
p1
Ψ̄p2
¯
f (D, D1 , ..., Dp ) = .
(2.6.13)
..
Ψ̄pn
If the restrictions are respected, then 2.6.3 and 2.6.4 hold for all structural shocks j = 1, 2, . . . , n. If
it is not the case, then restart the whole process all over again. It is thus possible to propose the
following Gibbs algorithm:
69
2. Basic applications
3. At iteration n, draw the reduced-form VAR coefficients B(n) and Σ(n) from their posterior dis-
tributions, and recover model 2.6.6.
(n) (n) (n)
4. At iteration n, obtain Ψ0 , Ψ1 , Ψ2 ... from B(n) .
(n) (n) (n)
5. At iteration n, calculate h(Σ(n) ), and generate Ψ̄0 , Ψ̄1 , Ψ̄2 ... from 2.6.8. Create the prelim-
Ψ̄p(n)
1
(n)
Ψ̄p2
¯
inary stacked matrix f (D, D1 , ..., Dp ) =
.. from 2.6.14.
.
Ψ̄p(n)
n
6. At iteration n, draw a random matrix X, for which each entry is drawn from an independent
standard normal distribution. Then, use a QR decomposition of X to obtain the structural
matrix Q.
7. At iteration n, compute the candidate stacked structural impulse response function matrix
f (D, D1 , ..., Dp ) from 2.6.13.
8. At iteration n, verify that the restrictions hold from 2.6.3 and 2.6.4. If yes, keep the matrix
Q and go for the next iteration. If not, repeat steps 3 to 8 until a valid matrix Q is obtained.
Then go for the next iterations.
Identification with sign, magnitude, and zero restrictions: When zero restrictions are included
into the setting, identification becomes more complicated. The reason is that if one tries to apply
naively algorithm 2.6.2 to identify a matrix Q that would satisfy the zero restrictions, the algorithm
would always fail since the set of matrices satisfying the zero restrictions has measure zero. In other
words, the probability to draw by chance a Q matrix that would satisfy the zero restriction is null.
The procedure has then to be adapted to first force the Q draw to produce an orthogonal Q matrix
which will satisfy for sure the zero restrictions, and then run the normal checking process 2.6.3 and
2.6.4 of Q for the remaining sign and magnitude restrictions.
The algorithm to obtain a matrix Q satisfying the sign restrictions goes as follows:
70
2. Basic applications
3. Find a matrix Nj−1 whose columns form a non-zero orthonormal basis for the nullspace of Rj .
Do it only if Rj 6= φ. If Rj = φ, there are no restrictions on shock j, nor any already existing
element of Q. In this case, do not do anything.
6. Set j = 2 (that is, consider now restrictions on structural shock 2), and repeat steps 2 to 5.
7. Repeat for j = 3, 4, . . . , n. This produces an orthonormal Q matrix that satisfies the zero
restrictions.
Note: When trying to implement sign restrictions, one has to be careful with the number of restriction
implemented on each structural shock, as not every zero restriction setting will be well-identified.
The reason is the following: for j = 1, 2, . . . , n, the solution qj to the equation:
Rj qj (2.6.14)
will be a non-zero solution if and only if zj ≤ n − j, where zj is the total number of zero restrictions
on structural shock j. That is, a well identified orthonormal matrix can only be obtained if for each
structural shock j, the number of zero restrictions on that shock is at most equal to n − j, with n
denoting, as usual, the total number of variables in the model. If for any shock, zj > n − j , the
basis Nj−1 of the nullspace of Rj will be only the trivial basis (a zero vector), so that qj = 0, and Q
cannot be an orthonormal matrix.
However, this issue does not make the exercise as restrictive as it may seem, since one can play on
the order of the variables in the VAR model to achieve a certain setting. Indeed, unlike a conventional
a Choleski/triangular factorization scheme where the ordering of the variable does matter, in a
restriction setting, the variable ordering is perfectly arbitrary. Therefore assume for instance A VAR
model with 4 variables, and two zero restrictions on shock 4. Then z4 = 2 > 0 = 4−4 = n−j. So the
71
2. Basic applications
zero restrictions are not identified in this case. However, a simple solution consists in simply inverting
the order of variables 2 and 4 in the VAR model. Then, the two restrictions become restrictions on
shock 2, so that z2 = 2 > 4 − 2 = n − j, and the identification scheme will work.
Algorithm 2.6.4 (Gibbs sampling for general zero, sign and magnitude restrictions):
3. At iteration n, draw the reduced-form VAR coefficients B(n) and Σ(n) from their posterior dis-
tributions, and recover model 2.6.7.
(n) (n) (n)
4. At iteration n, obtain Ψ0 , Ψ1 , Ψ2 ... from B(n) .
(n) (n) (n)
5. At iteration n, calculate h(Σ(n) ), and generate Ψ̄0 , Ψ̄1 , Ψ̄2 ... from 2.6.8. Create the prelim-
inary stacked matrix:
Ψ̄(n)
p1
(n)
Ψ̄p2
..
(2.6.15)
.
Ψ̄(n)
pn
6. At iteration n, apply algorithm 2.6.3 to obtain an orthonormal Q matrix which satisfies the
zero restrictions.
7. At iteration n, compute the candidate stacked structural impulse response function matrix
f (D, D1 , ..., Dp ) from 2.6.13.
8. At iteration n, verify that the sign and magnitude restrictions hold from 2.6.3and 2.6.4. If yes,
keep the matrix Q and go for the next iteration. If not, repeat steps 3 to 8 until a valid matrix
Q is obtained. Then go for the next iterations.
An example: Consider a 3-variable VAR model with two lags, and assume for simplicity3 that there
are no exogenous variables included in the model:
3
Note that exogenous variables are irrelevant for the computation of impulses response functions, and thus for
implementing restrictions on them. Therefore, they can be omitted without loss of generality.
72
2. Basic applications
y
1,t
a1 a112 a113 y1,t−1 a211 a212 a213 y1,t−2 ε1,t
11
y2,t = a21 a122 a123 y2,t−1 + a221 a222 a223 y2,t−2 + ε2,t
1
(2.6.16)
y3,t a131 a132 a133 y3,t−1 a231 a232 a233 y3,t−2 ε3,t
The conventional assumption on residuals applies:
, or
ε
1,t
σ
11
σ12 σ13
E ε2,t ε1,t ε2,t ε3,t = σ12 σ22 σ23 (2.6.18)
ε3,t σ13 σ23 σ33
The following restrictions are implemented:
• Sign restrictions: a positive sign restriction on the response of variable 1 to structural shock 2,
to be implemented at period 2. And a negative sign restriction on the response of variable 1
to structural shock 3, to be implemented at period 3.
h i
• A magnitude restriction of −0.5 0.5 on the response of variable 2 to structural shock 2, and
h i
a magnitude restriction of −0.3 0.7 on the response of variable 3 to structural shock 2, both
to be implemented at period 1.
Because the model comprises three variables, each individual impulse response function matrix
Ψ̃ will be of size 3 × 3. With three of them stacked, the matrix f (D, D1 , ..., Dp ) will comprise a
total of 3 × 3 = 9 rows. Therefore, each restriction matrix Sj and Mj will comprise 9 columns.
The restriction matrices are thus as follows:
73
2. Basic applications
S2 = 0 0 0 1 0 0 0 0 0 (2.6.20)
S3 = 0 0 0 0 0 0 −1 0 0 (2.6.21)
h i
• A magnitude restriction of −0.5 0.5 on the response of variable 2 to structural shock
h i
2, and a magnitude restriction of −0.3 0.7 on the response of variable 3 to structural
shock 2, both to be implemented at period 1:
0 1 0 0 0 0 0 0 0
M2 = (2.6.22)
0 0 1 0 0 0 0 0 0
,
−0.5
Ml,2 = (2.6.23)
−0.3
,
0.5
Mu,2 = (2.6.24)
0.7
2. Assume that the following draw is realized for the values of the VAR coefficients:
y
1,t
0.78 0.12 −0.08 y1,t−1 0.02 −0.04 0.07 y1,t−2 ε1,t
y2,t = 0.05 0.82 0.03 y2,t−1 + 0.11 0.06 −0.16 y + ε
2,t−2 2,t
y3,t −0.16 0.21 0.85 y3,t−1 −0.03 0.08 −0.09 y3,t−2 ε3,t
(2.6.25)
It can be shown that such a draw produces a stationary model. Assume that the draw for Σ is
given by:
0.028 −0.013 0.034
Σ = −0.013 0.042 0.006
(2.6.26)
0.034 0.006 0.125
74
2. Basic applications
0.78 0.12 −0.08
Ψ1 = 0.05 0.82 0.03
(2.6.27)
−0.16 0.21 0.85
0.65 0.14 −0.06
Ψ2 = 0.19 0.74 −0.11 (2.6.28)
−0.28 0.41 0.65
0.55 0.15 −0.05
Ψ3 = 0.29 0.66 −0.22
(2.6.29)
−0.31 0.53 0.47
0.1673 0 0
h(Σ) = −0.0777 0.1896
0
(2.6.30)
0.2032 0.1149 0.2656
0.105 0.013 −0.021
−0.049 0.159 0.008
0.129 0.137 0.226
Ψ̄ Ψ 0.086 0.019 −0.015
1 1
Ψ̄2 = Ψ2 h(Σ) = −0.050 0.128 −0.030 (2.6.31)
Ψ̄3 Ψ3 0.053 0.153 0.173
0.070 0.021 −0.014
−0.047 0.099 −0.058
0.002 0.154 0.124
−0.3034 0.8884 −0.8095
X = 0.2939 −1.1471 −2.9443 (2.6.32)
−0.7873 1.0689 1.4384
75
2. Basic applications
−0.3396 0.5484 0.7642
Q = 0.3289 −0.6919 −0.6427
(2.6.33)
−0.8812 −0.4696 0.0546
−0.0125 0.0581 −0.0901
0.0620 −0.1407 −0.0641
−0.1977 −0.1300 −0.1751
Ψ̃p1 Ψ̄p1
0.0097 0.0412 −0.0790
Ψ̃p2 Ψ̄p2
f (D, D1 , ..., Dp ) = = Q =
0.0858 −0.1019 −0.0458 (2.6.34)
.. ..
. .
−0.1204 −0.1577 0.1297
Ψ̃pn Ψ̄pn
−0.0042 0.0302 −0.0682
0.1002 −0.0675 −0.0311
−0.0596 −0.1633 −0.0939
0.0581
−0.1407
−0.1300
0.0412
S2 × f2 (D, D1 , ..., Dp ) = 0 0 0 1 0 0 0 0 0 −0.1019 = (0.0412) > 0
−0.1577
0.0302
−0.0675
−0.1633
(2.6.35)
• A negative sign restriction on the response of variable 1 to structural shock 3, to be
implemented at period 3:
76
2. Basic applications
−0.0901
−0.0641
−0.1751
−0.0790
S3 × f3 (D, D1 , ..., Dp ) = 0 0 0 0 0 0 −1 0 0 −0.0458 = (0.0682) > 0
0.1297
−0.0682
−0.0311
−0.0939
(2.6.36)
h i
• A magnitude restriction of −0.5 0.5 on the response of variable 2 to structural shock
h i
2, and a magnitude restriction of −0.3 0.7 on the response of variable 3 to structural
shock 2, both to be implemented at period 1:
77
2. Basic applications
Hence all the restrictions are satisfied. Keep this matrix Q since it is a valid candidate.
1. There are now restrictions over four periods (periods 0, 1, 2 and 3, see below), so that the
stacked matrix for impulse response functions will be:
78
2. Basic applications
Ψ̃
0
Ψ̃1
f (D, D1 , ..., Dp ) = (2.6.38)
Ψ̃2
Ψ̃3
Because the model comprises three variables, each individual impulse response function matrix
Ψ̃ will be of size 3 × 3. With four of them stacked, the matrix f (D, D1 , ..., Dp ) will comprise
a total of 3 × 4 = 12 rows. Therefore, each restriction matrix Sj and Mj will comprise 12
columns.
S2 = (0 0 0 0 0 0 1 0 0 0 0 0) (2.6.39)
S3 = (0 0 0 0 0 0 0 0 0 − 1 0 0) (2.6.40)
h i
• A magnitude restriction of −0.5 0.5 on the response of variable 2 to structural shock
2, and a magnitude restriction of
h i
−0.3 0.7 (2.6.41)
0 0 0 0 1 0 0 0 0 0 0 0 −0.5 0.5
M2 = , Ml,2 = , Mu,2 = (2.6.42)
0 0 0 0 0 1 0 0 0 0 0 0 −0.3 0.7
79
2. Basic applications
2. Assume that the following draws are realized for the values of the VAR coefficients and residual
covariance matrix Σ (same as the pure sign and magnitude restriction case):
y
1,t
0.78 0.12 −0.08 y1,t−1 0.02 −0.04 0.07 y1,t−2 ε1,t
y2,t = 0.05 0.82 0.03 y + 0.11 0.06 −0.16 y + ε
2,t−1 2,t−2 2,t
y3,t −0.16 0.21 0.85 y3,t−1 −0.03 0.08 −0.09 y3,t−2 ε3,t
(2.6.44)
0.028 −0.013 0.034
Σ = −0.013 0.042 0.006 (2.6.45)
0.034 0.006 0.125
1 0 0
Ψ1 = 0 1 0 (2.6.46)
0 0 1
0.78 0.12 −0.08
Ψ1 = 0.05 0.82 0.03
(2.6.47)
−0.16 0.21 0.85
0.65 0.14 −0.06
Ψ2 = 0.19 0.74 −0.11 (2.6.48)
−0.28 0.41 0.65
0.55 0.15 −0.05
Ψ3 = 0.29 0.66 −0.22 (2.6.49)
−0.31 0.53 0.47
0.1673 0 0
h(Σ) = −0.0777 0.1896 0 (2.6.50)
0.2032 0.1149 0.2656
80
2. Basic applications
0.1673 0 0
−0.0777 0.1896 0
0.2032 0.1149 0.2656
0.105 0.013 −0.021
Ψ̄ Ψ −0.049 0.159 0.008
0 0
Ψ̄1 Ψ1 0.129 0.137 0.226
¯
f (D, D1 , ..., Dp ) = = h(Σ) =
(2.6.51)
Ψ̄2 Ψ2 0.086 0.019 −0.015
Ψ̄3 Ψ3 −0.050 0.128 −0.030
0.053 0.153 0.173
0.070 0.021 −0.014
−0.047 0.099 −0.058
0.002 0.154 0.124
5. Apply algorithm 2.6.3 to obtain an orthonormal Q matrix which satisfies the zero restrictions:
• Set j = 1
• Create
Z1 f¯(D, D1 , ..., Dp ) Z1 f¯(D, D1 , ..., Dp ) 0.1673 0 0
R1 = , = =
Q0 φ 0.2032 0.1149 0.2656
(2.6.52)
• Obtain
0
N0 = −0.9178 (2.6.53)
0.3970
• Draw
0.3252
x1 = −0.7549 (2.6.54)
1.3703
• Obtain
0
, ,
q1 = N0 (N0 x1 / kN0 x1 k) = −0.9178 (2.6.55)
0.3970
• set j = 2
81
2. Basic applications
• Create
Z2 f¯(D, D1 , ..., Dp ) φ
R2 = , = , = 0 −0.9178 0.3970 (2.6.56)
Q1 Q1
• Obtain
−0.9178 0.3970
N1 = 0.1576 0.3644
(2.6.57)
0.3644 0.8424
• Draw
0.3192
x2 = 0.3129 (2.6.58)
−0.8649
• Obtain
0.4303
, ,
q2 = N1 (N1 x2 / kN1 x2 k) = −0.3584 (2.6.59)
−0.8285
• Set j = 3
• Create
Z3 f¯(D, D1 , ..., Dp ) φ 0 −0.9178 0.3970
R3 = , = , = (2.6.60)
Q2 Q2 0.4303 −0.3584 0.8285
• Obtain
0.9027
N2 = 0.1709
(2.6.61)
0.3950
• Draw
−0.0301
x2 = −0.1649 (2.6.62)
0.6277
• Obtain
0.9027
, ,
q3 = N2 (N2 x3 / kN2 x3 k) = 0.1709 (2.6.63)
0.3950
82
2. Basic applications
Obtain:
0 0.4303 0.9027
Q = −0.9178 −0.3584 0.1709
(2.6.64)
0.3970 −0.8285 0.3950
6. Compute the candidate stacked structural impulse response function matrix f (D, D1 , ..., Dp ):
0 0.0720 0.1511
−0.1741 −0.1014 −0.0377
0 −0.1737 0.3079
−0.0209 0.0579 0.0887
−0.1427 −0.0848 −0.0141
−0.0366 −0.1805 0.2297
f (D, D1 , ..., Dp ) = f¯(D, D1 , ..., Dp ) × Q = (2.6.65)
−0.0235 0.0428 0.0752
−0.1296 −0.0424 −0.0352
−0.0716 −0.1751 0.1428
−0.0254 0.0342 0.0614
−0.1146 −0.0077 −0.0487
−0.0918 −0.1569 0.0775
7. Verify that the sign and magnitude restrictions hold from 2.6.3 and 2.6.4 . It is not necessary
to check for the zero restrictions since Q has been constructed to satisfy them (and indeed, it
can be readily verified from f (D, D1 , ..., Dp ) that the zero restrictions are satisfied).
83
2. Basic applications
0.0720
−0.1014
−0.1737
0.0579
−0.0848
−0.1805
S2 × f2 (D, D1 , ..., Dp ) = 0 0 0
= (0.0428) > 0 (2.6.66)
0.0428
−0.0424
−0.1751
0.0342
−0.0077
−0.1569
0.1511
−0.0377
0.3079
0.0887
−0.0141
0.2297
S3 × f3 (D, D1 , ..., Dp ) = 0 0 0 0 0
= (−0.0614) < 0 (2.6.67)
0.0752
−0.0352
0.1428
0.0614
−0.0487
0.0775
Hence, the second sign restriction is not satisfied.
• A magnitude restriction of
h i
−0.5 0.5 (2.6.68)
84
2. Basic applications
Therefore, the magnitude restrictions are satisfied. Only one restriction is not satisfied (the second
sign restriction), but this is sufficient to conclude that the identified Q matrix is not a valid candidate.
Go back to steps 3-8 and repeat until a valid candidate is obtained.
85
3. Advanced analysis
This is the moving average representation of the reduced-form VAR. As shown by 2.3.13, by using a
structural decomposition, one may obtain a moving average representation of the VAR in terms of
uncorrelated structural disturbances as:
with:
φ̃ φ̃k,12 · · · φ̃k,1n
k,11
φ̃k,21 φ̃k,22 · · · φ̃k,2n
Ψ̃k = .
.. .. (3.1.4)
.. . .
φ̃k,n1 φ̃k,n2 · · · φ̃k,nn
Consider forecasting the value yt+h using 3.1.3:
∞
−1
X
yt+h = A(L) Cxt+h + Ψ̃i ηt+h−k (3.1.5)
k=0
h−1 ∞
A(L)−1 Cxt+h
X X
yt+h = + Ψ̃k ηt+h−k + Ψ̃k ηt+h−k (3.1.6)
k=0 k=0
| {z }
future values of exogenous variables, | {z } | {z }
assumed to be known unknown, future shocks known present and past shocks
86
3. Advanced analysis
h−1
X
yt+h − Et (yt+h ) = Ψ̃k ηt+h−k (3.1.8)
k=0
| {z }
unknown, future shocks
y − Et (y1,t+h ) φ̃ φ̃0,12 · · · φ̃0,1n η φ̃ φ̃1,12 · · · φ̃1,1n η
1,t+h 0,11 1,t+h 1,11 1,t+h−1
y2,t+h − Et (y2,t+h ) φ̃ φ̃0,22 · · · φ̃0,2n η2,t+h φ̃1,21 φ̃1,22 · · · φ̃1,2n η2,t+h−1
= 0,21
.. .. .. .. .. + .. .. .. .. ...
. . . . . . . . .
yn,t+h − Et (yn,t+h ) φ̃0,n1 φ̃0,n2 · · · φ̃0,nn ηn,t+h φ̃1,n1 φ̃1,n2 · · · φ̃1,nn ηn,t+h−1
(3.1.9)
Therefore, considering variable i in the VAR (i = 1, 2, ..., n), and using 3.1.9, the forecast error 3.1.8
rewrites:
h−1
X
yi,t+h − Et (yi,t+h ) = φ̃k,i1 η1,t+h−k + φ̃k,i2 η2,t+h−k + ... + φ̃k,in ηn,t+h−k (3.1.10)
k=0
or
h−1
X h−1
X h−1
X
yi,t+h − Et (yi,t+h ) = φ̃k,i1 η1,t+h−k + φ̃k,i2 η2,t+h−k + ... + φ̃k,in ηn,t+h−k (3.1.11)
k=0 k=0 k=0
2
Denote the variance of this forecast error by σy,i (h), and the constant variances of the structural
2 2 2
innovation series found on the diagonal of Γ by ση,1 , ση,2 , ..., ση,n . Then, taking the variance of both
sides of 3.1.11, it rewrites as:
where use has been made of the fact that structural disturbances are uncorrelated, so that no covari-
2
ance terms appear in the formula. Then, dividing both sides of 3.1.12 by σy,i (h), one obtains:
87
3. Advanced analysis
or
with
2 h−1
ση,j X 2
σi (j, h) = 2
(φ̃k,ij ) (3.1.15)
σy,i (h) k=0
σi (j, h) represents the proportion of forecast error variance of variable i due to structural shock
j at horizon T + h. Once again, this characterizes identification of variance decomposition in a
frequentist approach. In a Bayesian framework, one must take into account the uncertainty related
to the parameters. Hence, rather than computing a single estimate, one draws estimates for the
variance decomposition directly from the posterior distribution of orthogonalised impulse response
functions. Then, with these draws from the posterior distribution of variance decomposition, one
may as usual compute point estimates and credibility intervals. The following algorithm is thus
proposed:
4. repeat until (It−Bu) iterations have been achieved. This yields a sample of independent draws
from the posterior distribution of variance decomposition,
n oIt−Bu
(n)
σi (j, h) (3.1.16)
n=1
88
3. Advanced analysis
Consider again for simplicity the case where the VAR model has only one lag:
yt = A1 yt−1 + Cxt + εt
= A1 (A1 yt−2 + Cxt−1 + εt−1 ) + Cxt + εt
= A1 A1 yt−2 + Cxt + A1 Cxt−1 + εt + A1 εt−1 (3.2.3)
t−1 t−1
yt = (A1 )t y0 + (A1 )j Cxt−j + (A1 )j εt−j
X X
(3.2.5)
j=0 j=0
When there is more than one lag, the backward substitution process becomes more complex, but the
logic remains the same. In general, for a model with p lags, one can rewrite yt as:
p t−1 t−1
X (t) X X
yt = Aj y1−j + Cj xt−j + Bj εt−j (3.2.6)
j=1 j=0 j=0
89
3. Advanced analysis
(t)
where the matrix series Aj , Cj and Bj are (potentially complicated) functions of A1 , A2 , ..., Ap . For
(t) (t)
instance, in 3.2.5, A1 = (A1 )t , Cj = (A1 )j C, and Bj = (A1 )j . The t superscript on Aj emphasizes
(t)
the fact that the matrix Aj depends on t = 1, 2, ..., T , while the Cj and Bj series are independent of
it.
Note also that the matrices B1 , B2 , ..., Bt−1 provide the response of yt to shocks occurring at periods
t, t − 1, ..., 2, 1. By definition, they are thus the series of impulse response function matrices:
Bj = Ψj (3.2.7)
p t−1 t−1
X (t) X X
yt = Aj y1−j + Cj xt−j + Ψj εt−j (3.2.8)
j=1 j=0 j=0
Using 2.3.6 and 2.3.14, one may obtain a representation of the impulse response functions in terms
of structural shocks:
p t−1 t−1
X (t) X X
yt = Aj y1−j + Cj xt−j + Ψ̃j ηt−j (3.2.10)
j=1 j=0 j=0
| {z } | {z }
historical contribution of historical contribution
deterministic variables of structural shocks
3.2.10 makes it clear that yt can be separated into two parts: one due to deterministic exogenous
variables and initial conditions, and one due to the contribution of unpredictable structural distur-
bances affecting the dynamics of the model. Because it is only the latter part which is of interest in
this exercise, one may simply rewrite 3.2.10 as:
t−1
(t)
X
yt = d + Ψ̃j ηt−j (3.2.11)
j=0
| {z }
historical contribution
of structural shocks
where for and VAR with n variables, d(t) is a n×1 vector of contributions from deterministic variables
and initial conditions. Considering variable i of the model (for i = 1, 2, ..., n) , one can then express
the value of yi,t as:
t−1
(t) X
yi,t = di + φ̃j,i1 η1,t−j + φ̃j,i2 η2,t−j + ... + φ̃j,in ηn,t−j (3.2.12)
j=0
90
3. Advanced analysis
where φ̃j,ik denotes entry (i, k) of the structural impulse response matrix Ψ̃j . Rearranging:
Equation 3.2.13 finally expresses, for each variable in the model, the historical decomposition of this
variable in terms of present and past structural shocks, along with its exogenous component.
Once again, this describes the historical decomposition in a traditional, frequentist context. Because
the Bayesian framework implies uncertainty with respect to the VAR coefficients, this uncertainty
must be integrated into the above framework, and one must compute the posterior distribution of the
historical decomposition. As usual, this is done by integrating the historical decomposition frame-
work into the Gibbs sampler, in order to obtain draws from the posterior distribution. The following
Gibbs algorithm is proposed:
1. Define the number of iterations (It − Bu) of the algorithm. Then run the algorithm:
2. At iteration n, obtain random draws β(n) , Σ(n) and D(n) from their posterior distribution.
Simply recycle draw n from the Gibbs sampler.
3. For j = 1, 2..., T , compute the impulse response function matrices Ψj and Ψ̃j from β(n) , Σ(n)
and D(n) .
4. For j = 1, 2..., T , obtain the VAR residuals εt from β(n) . Then, using D(n) , obtain the structural
disturbances ηt .
5. With these elements, compute for j = 1, 2..., T the historical contribution of each shock, using
3.2.13.
6. For j = 1, 2..., T , obtain the contribution of the non-shock components by rearranging 3.2.13:
91
3. Advanced analysis
Assume that one wants to use model 3.3.1 to produce forecasts, and to make things more concrete,
consider the simple case of predicting yT +2 for a VAR with one lag. By recursive iteration similar to
that applied in subsubsection 2.2, one obtains:
yT +1 = A1 yT + CxT +1 + εT +1 (3.3.2)
and
yT +2 = A1 yT +1 + CxT +2 + εT +2
= A1 (A1 yT + CxT +1 + εT +1 ) + CxT +2 + εT +2
= A1 A1 yT + A1 CxT +1 + CxT +2 + A1 εT +1 + εT +2 (3.3.3)
The forecasts are functions of three terms: terms involving the present value of the endogenous
variables yt , terms involving future values of the exogenous variables xt , and terms involving future
values of the reduced form residuals εt . In general, for a forecast of period T + h from a VAR with
plags, one obtains an expression of the form:
p h h
X (h) X (h) X (h)
yT +h = Aj yT −j+1 + Cj xT +j + Bj εT +j (3.3.4)
j=1 j=1 j=1
92
3. Advanced analysis
(h)
Bj = Ψh−j (3.3.5)
p h h
X (h) X (h) X
yT +h = Aj yT −j+1 + Cj xT +j + Ψh−j εT +j (3.3.6)
j=1 j=1 j=1
3.3.7 then allows to rewrite the forecast function 3.3.6 in terms of structural shocks:
p h h
X (h) X (h) X
yT +h = Aj yT −j+1 + Cj xT +j + Ψ̃h−j ηT +j (3.3.8)
j=1 j=1 j=1
| {z } | {z }
Forecast in the absence of shocks Dynamic impact of
future structural shocks
In the right-hand side of 3.3.8, the first and second terms are known values (they are just the regular
forecasts), while the third is unknown. Therefore, one may rewrite 3.3.8 as:
h
X
yT +h = ỹT +h + Ψ̃h−j ηT +j (3.3.9)
j=1
with ỹT +h the unconditional forecast value for period T + h. Consider imposing the condition:
yi,T +h = ȳ (3.3.10)
Where yi,T +h is the value of variable i (over the n variables in the model) at period T + h, and ȳ is
any scalar value decided by the statistician. Then, considering row i in 3.3.9, one obtains:
h
X
yi,T +h = ỹi,T +h + Ψ̃h−j,i ηT +j = ȳ (3.3.11)
j=1
where Ψ̃h−j,i denotes row i of the impulse response matrix Ψ̃h−j . This can be rearranged to obtain:
h
X
Ψ̃h−j,i ηT +j = ȳ − ỹi,T +h (3.3.12)
j=1
93
3. Advanced analysis
3.3.12 shows that constraining yT +h to take the fixed value ȳ will imply restrictions on the value of
future structural innovations, up to period T + h. 3.3.12 can be reformulated in linear form as:
η1,T +1
..
.
ηn,T +1
.
(φ̃h−1,i1 · · · φ̃h−1,in ..
}| · · · · · · | φ̃0,i1 · · · φ̃0,in ) = ȳ − ỹi,T +h (3.3.13)
| {z ..
j=1 | {z } | {z } .
j=2,...,h−1 j=h
η1,T +h
..
.
ηn,T +h
where the vectors of restriction and the vector of shocks are of size 1 × s, with s = h × n the total
number of shocks to constrain (n structural shocks for a n-variable VAR, to be constrained over h
periods). φ̃h−j,i1 , . . . , φ̃h−j,in are the n elements of Ψ̃h−j,i .
If one wants to impose v conditions of the type of 3.3.10, then these conditions can be all put in
the linear form 3.3.13 and then stacked to form a linear system:
R η
|{z} = |{z}
r ν ≤ s = nh (3.3.14)
|{z}
ν×s s×1 ν×1
R is the ν × s matrix of linear restrictions, η is the s × 1 vector gathering all the structural shocks
to be constrained for a forecast at horizon T + h, and r is the ν × 1 vector gathering the differences
between the predicted and conditional values.
To make things more concrete, consider the case of a 2-variable VAR with variables y1,t and y2,t
gathered in the vector yt , and assume one wants to produce a forecast for yT +3 , so that the final
forecast horizon h = 3. Assume that one wants to produce this forecast by constraining the first
variable to take specific values over the first two forecast periods, that is: y1,T +1 = ȳ1 and y1,T +2 = ȳ2 .
Then n = 2, h = 3 so that s = h × n = 2 × 3 = 6. Because two restrictions are imposed, ν = 2.
Hence R will be ν × s = 2 × 6, η will be s × 1 or 6 × 1, and r will be ν × 1 or 2 × 1.
Precisely, the stacked linear form system 3.3.14 will be given by:
94
3. Advanced analysis
η
1,T +1
η2,T +1
φ̃ φ̃0,12 0 0 0 0 η1,T +2 ȳ − y
0,11
= 1 1,T +1 (3.3.15)
φ̃1,11 φ̃1,12 φ̃0,11 φ̃0,12 0 0 η ȳ − y
2,T +2 2 2,T +2
η1,T +3
η2,T +3
Once the system 3.3.14 is obtained, it remains to know how to draw the structural disturbances so
that this system of constraint will be satisfied. The main contribution is due to Waggoner and Zha
(1999) who derive a Gibbs sampling algorithm to construct the posterior predictive distribution of
the conditional forecast. In particular they show that the distribution of the restricted future shocks
is normal, and characterised by:
with
0 0
η̄ = R (RR )−1 r (3.3.17)
and
0 0
Γ̄ = I − R (RR )−1 R (3.3.18)
While in theory, one could draw shocks directly from N (η̄, Γ̄), in practice an equivalent but nu-
merically more efficient solution has been proposed by Jarocinski (2010a). It consists in taking the
singular value decomposition of R, that is, in identifying a v × v unitary matrix U , a v × s matrix
Sand s × s unitary matrix V such that R = U SV . Denoting by P the matrix made of the first s
columns of S, by V1 the matrix made of the first s columns of V , and by V2 the matrix made of the
remaining v − s columns of V , Jarocinski (2010a) shows that drawing from 3.3.16 is equivalent to
drawing from:
Once these shocks are drawn, the system of constraints 3.3.14 will be satisfied by construction, and
forecast can be formed by direct application of 3.3.9.
It is then possible to use the traditional Gibbs sampler framework to produce the posterior distribu-
tion of conditional forecasts, as detailed in the incoming algorithm. A note of warning however: the
methodology adopted here is conventional, but is not exactly similar to that proposed by Waggoner
95
3. Advanced analysis
and Zha (1999). These authors suggest that in order to obtain a posterior distribution accounting
for parameter uncertainty in finite samples, the Gibbs sampler algorithm should, at each iteration,
augment the sample of data with the predicted values previously obtained. Doing so, the posterior
distribution will shift away from the one that would be obtained by considering only the sample of
actual data, which is labelled by the authors as a "shift in distribution" phenomenon. The algorithm
developed hereafter does not adopt this specific methodology, as it can suffer from numerical insta-
bility, and produce shifts in distribution that are so large that the implied forecast values may not
have reasonable economic interpretation anymore. Adopting thus a standard approach, the following
algorithm is proposed:
1. define the total number of iterations of the algorithm It − Bu, the forecast horizon h, and the
v conditions : ȳ1 , ȳ2 , ..., ȳv to be imposed on the series.
2. at iteration n, draw β(n) , Σ(n) and D(n) . In practice, recycle draws from the Gibbs sampler.
3. at iteration n, compute first the unconditional forecasts ỹT +1 , ỹT +2 , ..., ỹT +h from β(n) , by iter-
atively using 3.3.4, but excluding shocks.
4. for j = 1, 2..., h, compute the impulse response function matrices Ψj and Ψ̃j from β(n) , Σ(n) and
D(n) .
7. calculate the conditional forecasts using 3.3.9, with the unconditional forecast values obtained
in step 2 and the constrained shocks obtained in step 5.
96
3. Advanced analysis
decision has been taken regardless of GDP. In this case, the increase in the interest rate will be
implemented through monetary shocks, and its expected effect is a negative impact on GDP in the
short run.
The second possibility is that it is actually a fuelling in activity (rise in GDP) that motivated the
rise in interest rate, pushing the central authorities to fight inflationary pressure. In this case the
condition is due to GDP shocks, and one will observe an initial increase in GDP in the short run (the
one generating the policy, before the policy impacts negatively real activity). It then appears that
the observed effect on output will be opposite, depending on which shock originates the constraint.
This simple example suggests that one may want to select carefully the shocks originating the
constraint, in order to produce meaningful economic results. Unfortunately, doing so complicates
substantially the conditional forecast framework, and it is not always possible to implement any
arbitrary choice of shocks generating the conditions.
So, consider again the conditional forecast framework 3.3.11, in which some variable i of the VAR
model takes the value ȳ at forecast horizon T + h:
h
X
yi,T +h = ȳ = ỹi,T +h + Ψ̃h−j,i ηT +j (3.4.1)
j=1
Before one enters into the computational details, some definitions are stated. First, a shock in ηT +h
(the vector of all structural shocks at period T + h) is said to be constructive for yi,T +h if it is used to
generate the condition yi,T +h = ȳ. If it is not used to generate this condition, the shock is labelled as
non-constructive. Shocks can only be constructive for conditions on their own periods. Secondly, one
defines a block of variables for period T + h as the set of all variables on which there is a condition for
this period, and for which the conditions are generated by the same shocks. A single variable may
perfectly constitute a block by itself, if its condition is generated by shocks that are not constructive
for any other variables.
Using a concrete example is probably the simplest way to illustrate the methodology and the
concepts used in conditional forecasts generated by specific shocks. Consider for instance a 3-variable
VAR model for which forecasts are produced up to horizon T + 3, and for which conditions are set
over the first two periods.
At period T +1, conditions are set on variables 1 and 2 : y1,T +1 = ȳ1 and y2,T +1 = ȳ2 . It is assumed
that these conditions are generated by structural shocks 1 and 2 for both variables.
97
3. Advanced analysis
They hence constitute the constructive shocks for y1,T +1 and y2,T +1 , while structural shock 3 is
non-constructive. Also, because the conditions on y1,T +1 and y2,T +1 are generated by the same shocks,
variables 1 and 2 constitute a block (actually, the unique block for T + 1). At period T + 2, only
one condition is set, on variable 3: y3,T +2 = ȳ3 . This condition is generated by shock 3. Variable
3 therefore constitutes the unique block for period T + 2, associated with the unique constructive
shock 3. Structural shocks 1 and 2 are non-constructive. Finally, at period 3, there are no conditions
at all. Therefore, all the shocks are non-constructive and there are no blocks.
The next paragraph illustrates the procedure used to identify the values of the structural shocks,
both constructive and non-constructive, that will fulfil the conditions placed on every forecast period.
The general idea is to split the initial problem into separate problems (one for each forecast period),
and then solve in a recursive way, starting with the first period, up to the final forecast period. To
start the resolution, first recover the linear constraint system 3.3.14 corresponding to the complete
conditional forecast problem:
η
1,T +1
η2,T +1
η3,T +1
φ̃ φ̃0,12 φ̃0,13 0 0 0 0 0 0 η1,T +2 ȳ1 − ỹ1,T +1
0,11
φ̃0,21 φ̃0,22 φ̃0,23 0 0 0 0 0 0 η = ȳ2 − ỹ2,T +1 (3.4.2)
2,T +2
φ̃1,31 φ̃1,32 φ̃1,33 φ̃0,31 φ̃0,32 φ̃0,33 0 0 0 η ȳ − ỹ
3,T +2 3 3,T +2
η1,T +3
η2,T +3
η3,T +3
Then start solving recursively, period by period:
Period T+1: First, because only period T + 1 is of concern for now, one can retain only the rows
of system 3.4.2 related to this period and obtain a modified system:
98
3. Advanced analysis
η
1,T +1
η2,T +1
η3,T +1
η1,T +2
φ̃
0,11
φ̃0,12 φ̃0,13 0 0 0 0 0 0
ȳ1 − ỹ 1,T +1
η2,T +2 = (3.4.3)
φ̃0,21 φ̃0,22 φ̃0,23 0 0 0 0 0 0 ȳ2 − ỹ2,T +1
η3,T +2
η1,T +3
η2,T +3
η3,T +3
One can actually go further: because the shocks corresponding to future periods are irrelevant for
period T + 1 (see the 0 coefficients corresponding to shocks in periods T + 2 and T + 3), one may
take them out of 3.4.3, and reformulate it as:
η1,T +1
φ̃
0,11
φ̃0,12 φ̃0,13 ȳ1 − ỹ 1,T +1
η2,T +1 = (3.4.4)
φ̃0,21 φ̃0,22 φ̃0,23 ȳ2 − ỹ2,T +1
η3,T +1
The advantage of formulation 3.4.4 over 3.4.3 is that it is much faster to solve in computational
applications.
• Consider then the non-constructive shocks. Here only structural shock 3 is non-constructive, so
draw η3,T +1 from its distribution. Once its value is known, note that it is possible to produce
a modified but equivalent formulation of 3.4.4 which integrates the impact of this shock by
transferring it on the right-hand side.
η1,T +1
φ̃
0,11
φ̃0,12 0 ȳ 1 − ỹ 1,T +1 − φ̃0,13 η3,T +1
η2,T +1 = (3.4.5)
φ̃0,21 φ̃0,22 0 ȳ2 − ỹ2,T +1 − φ̃0,23 η3,T +1
η3,T +1
The interest of system 3.4.4 is that it integrates the value of the non-constructive shocks into
the conditions on the right hand side. Hence, when one will draw the subsequent shocks, they
will account for the already known value of η3,T +1 .
• Consider then the constructive shocks for block 1 in period T + 1. These shocks must ensure
that the conditions y1,T +1 = ȳ1 and y2,T +1 = ȳ2 hold. To do so, draw them for The Waggoner
and Zha (1999) distribution 3.3.16-3.3.18, using the modified matrices R and r defined in 3.4.5.
These shocks ensure that the two conditions will be met. Retain only the shocks η1,T +1 and
99
3. Advanced analysis
η2,T +1 since η3,T +1 has already been drawn. Note that discarding the draw of η3,T +1 is of no
consequence on the constraint as it is a non-constructive shock.
There is then no need to go further for period T +1: all the shocks (constructive and non-constructive)
have been drawn, and the constructive shocks have taken into account the values of the non-
constructive shocks, so that the conditions y1,T +1 = ȳ1 and y2,T +1 = ȳ2 hold.
Period T+2:
• Similarly to period 1, because only period T + 2 is now of interest, one may consider only the
rows of 3.4.2 which are related to this period, ignore coefficients on shocks beyond T + 2 and
obtain a modified system:
η
1,T +1
η2,T +1
η3,T +1
φ̃1,31 φ̃1,32 φ̃1,33 φ̃0,31 φ̃0,32 φ̃0,33
= (ȳ3 − ỹ3,T +2 ) (3.4.6)
η1,T +2
η2,T +2
η3,T +2
• Since the shocks η1,T +1 ,η2,T +1 and η3,T +1 are already known, they become constant values
that have to be integrated to the conditioning set (the right-hand side of 3.4.6). Therefore,
reformulate 3.4.6 by transferring the impact of previous shocks to the right-hand side:
η
1,T +1
η2,T +1
η3,T +1
0 0 0 φ̃0,31 φ̃0,32 φ̃0,33 = ȳ3 − ỹ3,T +2 − φ̃ η − φ̃ η − φ̃ η
1,31 1,T +1 1,32 2,T +1 1,33 3,T +1
η1,T +2
η2,T +2
η3,T +2
(3.4.7)
Again, for computational purposes, it is suitable to reduce the system further and take out of
the system the zero columns corresponding to shocks of period T + 1, now that they have been
taken into account:
100
3. Advanced analysis
η
1,T +2
φ̃0,31 φ̃0,32 φ̃0,33 η2,T +2 = ȳ3 − ỹ3,T +2 − φ̃1,31 η1,T +1 − φ̃1,32 η2,T +1 − φ̃1,33 η3,T +1 (3.4.8)
η3,T +2
• Then draw the non-constructive shocks. Here they are η1,T +2 and η2,T +2 . Draw these shocks
from their distributions, then, again, transfer the impact to the right-hand side to update the
condition set:
η
1,T +2
0 0 φ̃0,33 η = ȳ3 − ỹ3,T +2 − φ̃1,31 η1,T +1 − φ̃1,32 η2,T +1 − φ̃1,33 η3,T +1 − φ̃0,31 η1,T +2 − φ̃0,32 η2,T +
2,T +2
η3,T +2
(3.4.9)
• Then draw the constructive shock η3,T +2 for period T + 2, from the Waggoner and Zha (1999)
distribution, using the modified matrices R and r defined in 3.4.9. Discard all the shocks
obtained from this draw except η3,T +2 , which is the only constructive shock. This shock guar-
antees that the condition is respected. All the shocks are drawn for period , and the unique
condition holds. There is nothing more to be done.
Period T+3:
• Because there are no conditions at period T + 3, there is no linear system to create. So the
only thing to do is:
• Draw the three non-constructive shocks η1,T +3 , η2,T +3 and η3,T +3 from their distributions. Note
once again that the values of these shocks is of no consequence for past conditions, since these
shocks are non-impacting for past values (see all the 0 coefficients of in 3.4.2). This finishes
the process. A vector of shocks η for all forecast periods has been drawn, which ensures that
all the conditions hold, and that all the non-constructive shocks are just random values drawn
from their distributions.
This example illustrates the methodology to follow. It is however a simplified exercise, since it
features only one block per period. In general, the full methodology to determine the shocks for a
conditional forecast exercise at horizon T + h , with an arbitrary number of blocks for each period is
as follows:
101
3. Advanced analysis
1. For each forecast period T +i, with i = 1, 2, . . . , h, decide the set of conditions, the constructive
shocks and the blocks.
3. At period T + i : consider only the rows of the linear system Rη = r which are related to
T + i and obtain a restricted system. Reformulate the system to make it smaller by ignoring
columns of R and shocks related to periods beyond T + i .
4. Then, update the system by transferring the impact of all the previous shocks ηT +1 , ηT +2 , . . . , ηT +(i−1)
on the right-hand side. This again makes the system smaller as it permits to supress all the
shocks and columns of R related to periods preceding T + i.
At this point, the system has been reduced so that it only accounts for the current shocks and
conditions: in the system Rη = r, R is of dimension νi × n, with νi the number of conditions
for period T + i, η is of dimension n and comprises only current period shocks, and r is νi × 1 .
5. Draw now the non-constructive shocks (if any) from their distributions. Transfer their effects
to the right-hand-side of the system. This updates R and r in the linear system.
6. Draw the constructive shocks corresponding to the first block from the Waggoner and Zha
(1999) distribution, using the updated matrices R and r. Discard all the shocks which are
non-constructive for block 1. The retained constructive shocks ensure that the conditions in
block 1 hold. Transfer their effects to the right-hand-side of the system. This updates R and
r in the linear system.
7. Then draw the constructive shocks corresponding to the second block from the Wagonner-Zha
distribution, using the updated matrices R and r. Discard all the shocks which are non-
constructive for block 2. The retained constructive shocks ensure that the conditions in block
2 hold. Transfer their effects to the right-hand-side of the system. This updates R and r in the
linear system.
8. At period T + 1: repeat with all the other blocks. When all the blocks have been treated,
a vector of shocks ηT +i has been produced that allows for all the period conditions to hold.
Update η with the values ηT +i , and go for the next period.
9. Repeat steps 3-8 for all periods, until ηT +h is calculated. This produces the complete vector of
shocks η allowing for every condition at every period to hold.
102
3. Advanced analysis
One would wish that this is the end of the story. Unfortunately, it is not. Things do not necessarily
go as smoothly as algorithm 3.4.1 suggests. In fact, algorithm 3.4.1 may often fail, and produce
nonsense values. It will actually produce correct conditional forecasts only when the conditions,
shocks and blocks have been designed so that conditional forecasts are well defined. Otherwise,
conditional forecasts simply don’t exist. To see why, it is once again better to use examples. Of the
three following examples, one works, and two fail. This helps illustrating the potential pitfalls one
may face when trying to use conditional forecasts.
For example 1, consider a simple VAR model with 3 variables, where conditional forecasts have
only to be produced for T + 1. There is a condition on variable 1, so that y1,T +1 = ȳ1 , and this
condition is generated by shock 1. This constitutes block 1. Block 2 is made of variable 2 with
y2,T +1 = ȳ2 , generated by shocks 2 and 3. Implement algorithm 3.4.1 for this example. Generate
first the linear system:
η1,T +1
φ̃
0,11
φ̃0,12 φ̃0,13 ȳ1 − ỹ 1,T +1
η2,T +1 = (3.4.10)
φ̃0,21 φ̃0,22 φ̃0,23 ȳ2 − ỹ2,T +1
η3,T +1
Because there are no non-constructive shocks, draw directly the constructive shock η1,T +1 for block
1 from the Waggoner and Zha (1999) distribution, and transfer its impact on the right-hand side of
3.4.10:
η1,T +1
0 φ̃0,12 φ̃0,13 ȳ 1 − ỹ1,T +1 − φ̃ η
0,11 1,T +1
η2,T +1 = (3.4.11)
0 φ̃0,22 φ̃0,23 ȳ2 − ỹ2,T +1 − φ̃0,11 η1,T +1
η3,T +1
This shock ensures that the condition y1,T +1 = ȳ1 holds (implying that row 1 on the right-hand side
of 3.4.11 is now equal to 0). Then go for the second block: draw the constructive shocks η2,T +1 and
η3,T +1 for block 2 from the Waggoner and Zha (1999) distribution, using the updated system 3.4.11,
and transfer their impact on the right-hand side:
η
1,T +1
0 0 0 ȳ 1 − ỹ 1,T +1 − φ̃ η
0,11 1,T +1 − φ̃ η
0,12 2,T +1 − φ̃ η
0,13 3,T +1
η2,T +1 =
(3.4.12)
0 0 0 ȳ2 − ỹ2,T +1 − φ̃0,11 η1,T +1 − φ̃0,22 η1,T +1 − φ̃0,23 η3,T +1
η3,T +1
This draw ensures that the condition on block 2 y2,T +1 = ȳ2 holds. However, the first condition
y1,T +1 = ȳ1 may not hold anymore. Indeed compare row 1 in the right-hand sides of 3.4.11 with that
of 3.4.12: there is additional term −φ̃0,12 η2,T +1 − φ̃0,13 η3,T +1 due to the impact of the subsequent draw
of shocks for block 2. Hence, y1,T +1 = ȳ1 will not hold anymore (that is, row 1 in the right-hand side
103
3. Advanced analysis
of 3.4.11 will not be equal to 0 anymore), except if the additional term −φ̃0,12 η2,T +1 − φ̃0,13 η3,T +1 is
equal to 0. By chance, it turns out that this is true when the structural matrix D is lower triangular
(which is the case when D is identified by Choleski or triangular factorisation). Indeed, since Ψ̃0 = D
(see 2.2.14), then φ̃0,12 = φ̃0,13 = 0.
However, there is no necessity for the system to yield such a favourable result. Consider, as a
second example, the same setting, except that block 1 is now made of variable 1 with y1,T +1 = ȳ1 ,
generated by shock 3, while block 2 is made of variable 2 with y2,T +1 = ȳ2 , generated by shocks 1
and 2. The linear system is again 3.4.10. Start by drawing the constructive shock η3,T +1 for block 1,
then transfer its effect on the right-hand side:
η1,T +1
φ̃
0,11
φ̃0,12 0 ȳ 1 − ỹ1,T +1 − φ̃ η
0,13 3,T +1
η2,T +1 = (3.4.13)
φ̃0,21 φ̃0,22 0 ȳ2 − ỹ2,T +1 − φ̃0,23 η3,T +1
η3,T +1
This guarantees that the condition for block 1 holds, so that row 1 in the right-hand side of 3.4.13 is
equal to 0. Then, draw now the constructive shocks η1,T +1 and η2,T +1 for block 2 from the Waggoner
and Zha (1999) distribution using the updated system 3.4.13, and transfer their impact on the right-
hand side:
η
1,T +1
0 0 0 ȳ 1 − ỹ 1,T +1 − φ̃ η
0,13 3,T +1 − φ̃ η
0,11 1,T +1 − φ̃ η
0,12 2,T +1
η2,T +1 =
(3.4.14)
0 0 0 ȳ2 − ỹ2,T +1 − φ̃0,23 η3,T +1 − φ̃0,21 η1,T +1 − φ̃0,22 η2,T +1
η3,T +1
The condition on block 2 y2,T +1 = ȳ2 now holds, but the condition y1,T +1 = ȳ1 will not hold anymore,
except if −φ̃0,11 η1,T +1 − φ̃0,12 η2,T +1 = 0. When the structural matrix D is lower triangular, φ̃0,11 will
not be equal to 0: if one naively implements algorithm 3.4.1, the first condition will not hold: it is
actually impossible to obtain conditional forecasts with this setting. The impossibility here is due to
the fact that the two blocks are conflicting, and that the structural matrix Ψ̃0 does not correct for
the conflict.
The third example is even worse: it shows that the system may fail even if there is only one block
and hence no possible issue of conflict between blocks. For example 3, consider again the same VAR
model, but consider now that there is only one condition on variable 1, y1,T +1 = ȳ1 , generated by
shock 2. The linear system is now:
η
1,T +1
φ̃0,11 φ̃0,12 φ̃0,13 η2,T +1 = ȳ1 − ỹ1,T +1 (3.4.15)
η3,T +1
104
3. Advanced analysis
Applying algorithm 3.4.1, there are two non-constructive shocks, η1,T +1 and η3,T +1 , so draw these
shocks and transfer their impacts to the right-hand side:
η
1,T +1
0 φ̃0,12 0 η = ȳ − ỹ − φ̃ η − φ̃ η (3.4.16)
2,T +1 1 1,T +1 0,11 1,T +1 0,13 3,T +1
η3,T +1
Now, one would like to draw the constructive shock η1,T +2 from the Waggoner and Zha (1999)
distribution, using the updated system (15.14). But with a conventional lower triangular structure
on D, this is not possible. The reason is that the matrix R in 3.4.16 is entirely made of zeros. Indeed,
Ψ̃0 = D , and since D is lower triangular, φ̃0,12 = 0 . In this case, the Waggoner and Zha (1999)
distribution is not even defined. Another way to see the issue is to say that whatever the value
selected for η1,T +2 , since R is entirely made of zeros, the shock will have no impact on the system:
η
1,T +1
!
ȳ 1 − ỹ1,T +1 − φ̃0,11 η1,T +1 − φ̃0,13 η3,T +1 − φ̃0,13 η3,T +1
0 0 0 η = (3.4.17)
2,T +1 | {z }
=0
η3,T +1
Then there is no way to select a shock value η2,T +1 that will satisfy the condition. The impossibility
here is due to the fact that the impact φ̃0,12 on the shock η2,T +1 used to build the condition is null.
The general conclusion of these three examples is that there is no automatic guaranty for a condi-
tional forecast setting to be identified. In general, a particular setting for conditional forecasts will be
identified only if the design of shocks (constructive and non-constructive), blocks, and the structure
of are consistent. And since there exists no automatic verification procedure, there is no choice but
to verify the consistence of the setting manually before conditional forecasts are estimated.
Such verifications can be a hassle. Fortunately, there exist general conditions to identify settings
that will always fail, and settings that will always work. The list is not exhaustive however, and for
settings which do not comply with these categories, manual verification is still required. This is true
in particular for risks of conflicting blocks, for which preliminary verification remains pretty much
the only method available.
Outline of conditions for conditional forecasts genetared by specific shocks Failure conditions:
these conditions describe settings that will always result in non-identification of the conditional
forecast.
1. There are more variables in a block than shocks generating their conditions. Example: block 2
is made of variables 2,3 and 4, and the conditions on these variables are generated by shocks
105
3. Advanced analysis
3 and 4 only (3 variables, only 2 shocks). Solution: blocks should have at least as may shocks
as variables. More shocks than variables is fine, but less is not possible. Proof : see Appendix
K for an example.
2. The same shock generate conditions on different blocks. Example: block 1 is made of variables
1 and 2 whose conditions are generated by shocks 1 and 2; block 2 is generated by variable 3,
generated by shock 2 as well (shock 2 is shared by blocks 1 and 2).
Solution: different blocks should have different shocks.
Proof : see Appendix K for an example.
3. For some block, the conditions on the variables are generated only by shocks further away in
the ordering than the variables, and is lower triangular. Example: variables 1 and 3 constitutes
block 1. Their conditions are generated by shock 4 and 5. D is defined by Choleski factorisation.
Solution: choose either shocks preceding the variables in the ordering, or the variable’s own
shocks. Proof : direct consequence of example 3.
Success condition: satisfying these conditions will ensure that conditional forecasts are well identified,
conditional of course on the fact that no failure conditions are met.
1. There is only one block, and for all variables in this block, the conditions are generated by their
own shocks (and possibly other shocks); D is lower triangular. Example: Block 1 is the only
block, made by variables 1, 2 and 3, and the conditions are generated by shocks 1, 2 and 3. D
is defined by triangular factorisation. Proof : Because there is only block, no conflict between
blocks may arise. Because each variable is determined (at least) by its own shock, the impact
is given by φ̃0,11 , which is non-zero since D is lower triangular.
2. There are several blocks, but each block is identified by its own shocks. In addition, the order
of the blocks is consistent with the order of the variables, and D is lower triangular. Example:
Block 1 is made of variables 1 and 2, defined by shocks 1 and 2; block 2 is made of variable
4, defined by shock 4. Counter-example: Block 1 is made of variable 4, defined by shock 4;
block 2 is made of variables 1 and 2, defined by shocks 1 and 2; this will fail. Proof : Direct
consequence of example 1: conflicts between shocks avoided or not avoided thanks to the lower
triangular structure of D.
Note finally that the general conditional forecast framework introduced in subsection 3.3 corresponds
to success condition 1 (there is only one block, in which the constraints are generated by all the
shocks). Therefore, it is guaranteed to be always well identified. Now that the framework has been
exhaustively developed, it is possible to introduce the Gibbs algorithm used for conditional forecasts
when conditions are generated by specific shocks:
106
3. Advanced analysis
1. Define the total number of iterations It − Bu of the algorithm, the forecast horizon h, and the
ν conditions: ȳ1 , ȳ2 , . . . , ȳν to be imposed on the series. For each forecast period, decide which
shocks generate which conditions (i.e., define the blocks). Check that conditional forecasts are
identified, either manually, or using the conditions above.
3. At iteration n, compute first the unconditional forecasts ỹT +1 , ỹT +2 , . . . , ỹT +h by iteratively
using 3.3.4, but excluding shocks.
4. For j = 1, 2 . . . , h, compute the impulse response function matrices Ψj and Ψ̃j from β(n) , Σ(n)
and Dn .
5. Run algorithm 3.4.1 to identify the shocks that will satisfy the conditions.
6. Calculate the conditional forecasts, using 3.3.9 with the unconditional forecast values obtained
in step 3 and the constrained shocks obtained in step 4.
107
3. Advanced analysis
The relative entropy methodology is now formally introduced. The presentation starts with the
general method, applicable to any random variable. It will then be straightforward to show how the
method adapts to the specific case of conditional forecasts. So, consider any random variable y, with
an associated density function f (y). Note that this random variable can be multivariate, in which
case y will be a vector. If y contains n variables, then:
y
1
y2
y=
..
(3.5.1)
.
yn
The analytical form of the density function f (y) may or may not be known, but it is assumed that it
is possible to sample from the distribution numerically, using computer applications. Therefore, it is
n oN
possible to obtain a series of N draws y (i) on y, together with a series of weights (π1 , π2 , ...πN )
i=1
attributed to each draw. Naturally, when N draws are realized from a computer application, the
weights are just 1/N for all πi .
The idea underlying the relative entropy method is the following: imagine that there is some addi-
tional or new information available, which is not taken into account by the distribution f (y). Ideally,
if this information is relevant, one would like to account for it, but of course, that would result in
a new distribution, say f ∗ (y), which would necessarily be different from f (y), as the latter ignores
this information. The fundamental problem is: how to recover f ∗ (y)? Robertson et al. (2005) simply
n oN
notice that if one keeps the same draws y (i) , but alters the weights attributed to them, (that is,
i=1
∗ ∗ ∗
a new series of weights (π1 , π2 , ...πN ) is now used for the draws), a modified, or "tilted" distribution
will be obtained. The idea is then that it is possible to define those new weights (π1∗ , π2∗ , ...πN
∗
) so as
to obtain a distribution that will be compliant with the new information. An obvious issue is that
there may exist several (and potentially, an infinite number of) distributions compliant with this
information, and hence several possible sets of new weights (π1∗ , π2∗ , ...πN∗
). However, for consistency
reasons, the new distribution should also be designed to be as close as possible to the original distri-
bution. From this principle, as will be detailed hereafter, a unique set of new weights (π1∗ , π2∗ , ...πN ∗
)
can be obtained.
The technical aspects of the methodology are now considered. Assume thus that some new infor-
mation is available about the distribution of the random variable y, and that this information can
be expressed as the expectation of some function g(y) of the random variable y. Assume also that
this expectation is equal to some known value ḡ. That is, the information takes the form:
108
3. Advanced analysis
Z ∞
E (g(y)) = g(y)f ∗ (y)dy = ḡ (3.5.2)
−∞
Note that the expectation is taken with respect to f ∗ (y), the modified density, and not f (y), the
original density. In practice, because the analytical form of the density f ∗ (y) may not be known, one
uses the equivalent approximation, based on a sample of draws from f ∗ (y):
N
g y (i) πi∗ = ḡ
X
E (g(y)) = (3.5.3)
i=1
While just any function g(y) is permitted, in practice one typically wants to use a function g(y) that
defines quantities which are relevant for a distribution such as moments or quantiles. These two
cases are now detailed.
Start with moments. To express the information that the rth moment of some yj ∈ y is equal to
x̄, define:
This yields:
Z ∞
(yj )r f ∗ (yj )dy = x̄ (3.5.5)
−∞
N
(i) r
(yj ) πi∗ = x̄
X
(3.5.6)
i=1
When r is equal to 1, one simply determines the mean of the distribution, and g(y) is trivially defined
as g(y) = yj . Note however that 3.5.3 can only define basic moments: central moments (like the
variance) cannot be directly obtained since g y (i) would then require the value E ∗ (yj ) which is
unknown.
The second principal object of interest for a distribution is quantiles. Defining quantiles can be
done easily. To generate the information that the αth quantile of yj is equal to x̄, define:
where 1 (.) denotes the indicator function, which takes a value of 1 if the condition holds, and 0
otherwise. Then, 3.5.2 becomes:
109
3. Advanced analysis
Z x̄
f ∗ (yj )dyj = α (3.5.8)
−∞
This says that the distribution function of yj at x̄, F ∗ (x̄), is equal to α , which is equivalent to saying
that x̄ is the αth quantile of yj . In practice, one uses:
(i)
yj ≤x̄
πi∗ = α
X
(3.5.9)
Note that there can be several elements of information to integrate. If there exists L such pieces of
new information to integrate, then 3.5.3 becomes:
N
g1 y (i) πi∗ = ḡ1
P
i=1
N
g2 y (i) πi∗ = ḡ2
P
i=1 (3.5.10)
..
.
N
gL y (i) πi∗ = ḡL
P
i=1
Once the functions g1 (y), g2 (y), ...., gL (y) and the values ḡ1 , ḡ2 , ...., ḡL are defined, the next step in the
procedure consists in determining how to derive the set of new weights (π1∗ , π2∗ , ...πN ∗
) that will define
the new distribution. This is done by noticing that the objective of the new weights is twofold: first,
they should result in a distribution satisfying the new information; and second, the new distribution
should be as close as possible to the original one. To achieve these objectives, Robertson et al. (2005)
use a criterion known as the Kullback-Leibler Information Criterion (or KLIC), which represents a
measure of the distance between the initial weights and the new weights. The criterion is defined as:
N
πi∗
!
∗
πi∗
X
K(π, π ) = log (3.5.11)
i=1 πi
The greater the value of K(π, π ∗ ), the greater the overall distance between the series of initial weights
π and the series of new weights π ∗ , and the further the new distribution from the initial one. It is
now possible to formulate the problem completely: one wants to find a new set of weights π ∗ that
will minimize K(π, π ∗ ) and satisfy the new information. Formally, the program is:
N
π∗
!
∗
πi∗ log i
X
min K(π, π ) = (3.5.12)
∗
π
i=1 πi
subject to the constraints:
110
3. Advanced analysis
N
πi∗ = 1
X
(3.5.14)
i=1
and
N
g1 y (i) πi∗ = ḡ1
P
i=1
N
g2 y (i) πi∗ = ḡ2
P
i=1 (3.5.15)
..
.
N
gL y (i) πi∗ = ḡL
P
i=1
The first two conditions are justified by the fact that the weights represent probabilities, while 3.5.15
states that the new distribution must be compliant with the additional information. Using the
method of Lagrange, the solution can be written as:
πi exp λ, g y (i)
πi∗ = N
(3.5.16)
exp (λ, g (y (i) ))
P
πi
i=1
with
λ g1 y (i)
1
(i)
λ2
(i)
g2 y
.. and g y
λ= = .
(3.5.17)
.
..
λL gL y (i)
and where λ denotes the L×1 vector of Lagrange multipliers associated with the constraints in 3.5.15
. It can then be shown that it is possible to obtain the values of λ as the solution of the following
minimization problem:
N h i
πi exp λ̃, g y (i) − ḡ
X
λ = arg min (3.5.18)
λ̃ i=1
with
ḡ
1
ḡ2
ḡ =
..
(3.5.19)
.
ḡL
111
3. Advanced analysis
Note that for numerical softwares, a reformulation of 3.5.16 and 3.5.18 may prove convenient. Start
with 3.5.18 :
N h i N h i,
πi exp λ̃, g y (i) − ḡ g y (i) − ḡ λ̃
X X
= πi exp
i=1 i=1
λ̃
1
N
X
h i λ̃2
πi exp g1 y (i) − ḡ1 g2 y (i) − ḡ2 · · · gL y (i) − ḡL
= ..
i=1
.
λ̃L
(1)
g 1 y − ḡ1 g2 y (1) − ḡ2 · · · gL y (1) − ḡL λ̃
1
(2)
− ḡ1 g2 y (2) − ḡ2 · · · gL y (2)
− ḡL λ̃2
g1 y
= π1 π2 · · · πN exp . . .. .. ..
.. . . .
(N )
− ḡ1 g2 y (N ) − ḡ2 · · · gL y (N ) − ḡL λ̃L
g1 y
n o
= π , × exp . Gλ̃ (3.5.20)
with:
π g1 y (1) − ḡ1 g2 y (1) − ḡ2 · · · gL y (1) − ḡL
1
(2)
π2
g1 y
− ḡ1 g2 y (2) − ḡ2 · · · gL y (2) − ḡL
.. and G =
π=
. .. ..
(3.5.21)
. .. . .
πN g1 y (N ) − ḡ1 g2 y (N ) − ḡ2 · · · gL y (N ) − ḡL
The notation 00 exp .00 expresses element-wise exponentiation. Proceed similarly for 3.5.16 :
112
3. Advanced analysis
πi exp λ, g y (i)
πi∗ = N
πi exp (λ, g (y (i) ))
P
i=1
,
πi exp g y (i) λ
= N ,
πi exp (g(y (i) ) λ)
P
i=1
−1
(1)
1g y g2 y (1) · · · gL y (1) λ
1
(1) (1) (1)
· · · gL y λ2
g1 y g2 y
= π
1 π2 · · · πN exp . .. .. .. ..
.
. . .
(1) (1) (1)
· · · gL y λL
g1 y g2 y
λ
1
h i λ 2
× πi exp g1 y (1) g2 y (1) · · · gL y (1)
..
.
λL
This implies:
−1
π∗ g1 y (1) g2 y (1) · · · gL y (1)
λ
1
1
∗ (2) (2) (2)
· · · gL y
π2 g1 y g2 y λ2
= π π ··· π
.. N exp . .. .. .. ..
1 2
.
. . . .
∗
πN g1 y (N ) g2 y (N ) · · · gL y (N ) λL
(1)
π 0 ··· 0 g 1 y g2 y (1) · · · gL y (1) λ
1
1
(2) (2) (2)
··· · · · gL y
0 π2 0 g1 y g2 y λ2
×
.. .. .. .. × . exp .
.. .. .. ..
. . . . .
. . .
(N )
0 0 · · · πN g2 y (N ) · · · gL y (N ) λL
g1 y
or
with:
113
3. Advanced analysis
π∗ π 0 ··· 0 g1 y (1) g2 y (1) · · · gL y (1)
1 1
∗ (2)
π2 0
π2 · · · 0
g1 y
g2 y (2) · · · gL y (2)
π ∗ = . , Iπ =
..
.. . . .. and g =
.. .. ..
(3.5.23)
.. . . . .
. . .
∗
πN 0 0 · · · πN g1 y (N ) g2 y (N ) · · · gL y (N )
The program then reduces to obtaining the vector of Lagrange multipliers λ by minimizing 3.5.20 ,
and recovering the vector of new weights π ∗ from 3.5.22 .
Once π ∗ is obtained, there still remains some work to do. Indeed the new weights are useful to
define the updated distribution. But in practical applications, what one wants to obtain is not the
new distribution itself, but rather a series of draws from this new distribution. To obtain those
draws, one has to sample from f (y) with weights π ∗ rather than with weights π.
This can be done using the multinomial resampling algorithm of Gordon et al. (1993), which is now
introduced. The procedure is simple in essence: it amounts to noticing that the series of updated
∗
weights π ∗ = (π1∗ , π2∗ , ...πN ) represent probabilities, and can thus be interpreted as the chance of
n oN
drawing a given value of y (i) for each draw we want to realize. Let us say then that one wants
i=1
to obtain N draws from the new distribution (setting N ∗ > N helps to improve the precision of the
∗
process). It is then possible to consider the drawing process as a multinomial experiment with N ∗
∗
independent draws, and probabilities π ∗ = (π1∗ , π2∗ , ...πN ) assigned to each draw. The methodology is
then straightforward:
1. Define the total number of draws N ∗ to be realized from the new distribution, preferably with
N∗ > N.
,
2. Realise a draw d from the multinomial distribution: d = d1 d2 · · · dN ∼ mn (N ∗ , π1∗ , π2∗ , ...πN
∗
)
∗
This defines N integer values d1 , d2 , ..., dN , such that d1 + d2 +. . . +dN = N .
3. Generate the new sample of size N ∗ from the updated distribution by gathering d1 copies of
y (1) , d2 copies of y (2) , . . . , dN copies of y (N ) .
114
3. Advanced analysis
1. Consider the random variable y, with an associated density function f (y), possibly unknown.
n oN
Obtain a sample of N draws y (i) on y, together with a series of weights (π1 , π2 , ...πN )
i=1
attributed to each draw (typically: πi = 1/N for all i ).
2. Define the functions g1 (y), g2 (y), ..., gL (y) and the values ḡ1 , ḡ2 , ..., ḡL in order to integrate the
new information in the form of 3.5.10.
3. Build the vector π and the matrix G, defined in 3.5.21. Then, obtain the series of Lagrange
multipliers, from the minimization problem 3.5.18, reformulated as 3.5.20:
n o
λ = arg min π , × exp . Gλ̃
λ̃
4. Build the matrices Iπ and g, defined in 3.5.23. Recover the vector of new weights π ∗ from
3.5.22.
5. Obtain a sample of draws from the updated distribution by applying algorithm 3.5.1.
It is now possible to show how to adapt this procedure to the case of conditional forecasts. Algorithm
2.1.1 in subsubsection 2.1 provides a way to obtain draws from the posterior predictive distribution
f (yT +1:T +h |yT ), that is, to obtain draws from the posterior distribution of unconditional forecasts.
For a model with n endogenous variable, a horizon of h forecast periods, and It − Bu draws obtained
(i)
from the Gibbs sampler algorithm, each draw yT +1:T +h will be a vector of size nh × 1 :
(i)
y
1,T +1
..
.
(i)
y
1,T +h
(i) .
yT +1:T +h = .. i = 1, 2, . . . , It − Bu (3.5.24)
(i)
y
n,T +1
..
.
(i)
yn,T +h
As usual, each draw from the Gibbs sampler is given a weight πi = 1/(It−Bu) , for i = 1, 2, ..., It−Bu.
Now assume that one wants to conduct a conditional forecast exercise. In the tilting context, this
will amount to use the posterior distribution of unconditional forecasts, and tilt it in order to obtain
new distributions compliant with the conditions the user wants to set. The primary object of interest
for conditional forecasts is the median (point estimate) value of the distribution. The second object
of interest are the lower and upper bounds of the confidence interval for this distribution: tight bands
115
3. Advanced analysis
around the median value reflect high certainty about the condition, while looser bands express low
confidence and allows for more variability. All these conditions are easily implemented by the way of
quantiles. For instance, assume that one wants to set the conditions that the posterior distribution
for the first variable at forecast horizon T + 2 will take a median value of x̄1 , and that the 95%
probability bands will take their lower and upper bounds at respectively x̄2 and x̄3 . Then, using
3.5.3 and 3.5.9 , this set of conditions can be expressed as:
(i)
N y1,T +2 ≤x̄1
(i)
g1 y1,T +2 πi∗ = ḡ1 ⇒ πi∗ = 0.5 , using g1 (yT +1:T +h ) = 1 y1,T +2 ≤ x̄1
X X
and ḡ1 = 0.5
i=1
(i)
N y1,T +2 ≤x̄2
(i)
g2 y1,T +2 πi∗ = ḡ2 ⇒ πi∗ = 0.025 , using g2 (yT +1:T +h ) = 1 y1,T +2 ≤ x̄2
X X
and ḡ2 = 0.025
i=1
(i)
N y1,T +2 ≤x̄3
(i)
πi∗ = ḡ2 ⇒ πi∗ = 0.975 , using g3 (yT +1:T +h ) = 1 y1,T +2 ≤ x̄3
X X
g3 y1,T +2 and ḡ3 = 0.975
i=1
(3.5.25)
The same strategy can then be used for any condition on any variable of the model, at any forecast
horizon. The remaining steps in the process consists then in a direct application of the general
methodology. It is thus possible to obtain the following algorithm:
1. Using the Gibbs sampler, obtain a series of (It − Bu) draws from the posterior predictive
(1) (2) (It−Bu)
distribution: yT +1:T +h , yT +1:T +h , ..., yT +1:T +h . Define the weights πi associated to these draws,
typically πi = 1/(It − Bu) for all i .
2. Define the conditions to be set on forecast values. Generate the series of functions g1 (yT +1:T +h ), g2 (yT +1:T +
along with the series of values ḡ1 , ḡ2 , ..., ḡL , to expresses the conditions in the form of 3.5.25.
3. Build the vector π and the matrix G , defined in 3.5.21. Then, obtain the series of Lagrange
multipliers, from the minimization problem3.5.18, reformulated as 3.5.20 :
n o
λ = arg min π , × exp . Gλ̃
λ̃
4. Build the matrices Iπ and g, defined in 3.5.25. Recover the vector of new weights π ∗ from 3.5.22
.
5. Obtain a sample of draws from the conditional forecast distribution by applying algorithm
3.6.1.
116
3. Advanced analysis
3.6. Time Varying Equilibrium VAR and priors for the long run
The main advantage of Bayesian modelling consists in integrating prior information into the model,
allowing the final estimates to reflect (partly) the belief of the researcher about which values the
parameters should take. Yet, if Bayesian VAR models traditionally integrate prior information
about the dynamic coefficients (see the work of Litterman (1986) and section 1.3), they remain most
of the time uninformative on the deterministic components, in particular constant terms. In typical
applications, deterministic terms are given a prior mean of 0 associated with a very large variance
in order to obtain a diffuse prior distribution. This way, the posterior values entirely stem from the
information contained in the data.
This approach presents two disadvantages, which both result from the fact that the long-run, or
steady-state value of a VAR model depends on the deterministic coefficients. The first drawback
is that if the researcher actually has some knowledge about the long run values of the model, not
integrating these values into the model generates a loss of relevant prior information. The second
disadvantage of not integrating this information into the model is that the deterministic coefficients
and, hence, the steady-state will be entirely determined by the data. This may result in long term
forecast grossly at odds with the prior opinion of the researcher. To overcome this issue, there are
several alternative ways to address this. In what follows propose alternative 4 ways how to incorporate
long-run restrictions into the BVAR model. The first option replicates the work of Villani (2009)
where we allow for an informative prior on the steady-state. This option applies to non-stationary
data and a time-invariant steady-state. The second option generalizes this approch by allowing for
time varying deterministic trends in the model. The third option also allows to specify an underlying
economic model for the long-run. [ADD reference to Paolos paper] This approach uses a simulation
smoother for latent processes and requires specific specification for the long-run properties of the
model. Finally, the fourth option is to impose priors on the long-run as in Giannone et al. (2016).
117
3. Advanced analysis
A(L)(yt − F xt ) = εt (3.6.3)
This representation is known as a VAR model on mean-adjusted form. In this representation, A(L)
is a lag polynomial similar to that in model 3.6.2. The p matrices A1 , A2 , . . . , Ap are of dimension
n × n . In addition, F is a n × m matrix of coefficients with respect to the m exogenous variables.
This structure implies that each equation comprises k1 = np coefficients to estimate with respect to
yt , and m coefficients with respect to xt , leaving a total of q2 = nk1 = n2 p coefficients to estimate
for the full model with respect to yt , and q2 = nm coefficients with respect to xt .
The advantage of model 3.6.3 is clear in terms of long-term or steady-state values: taking expec-
tations on both sides and rearranging, one obtains:
E(yt ) = F xt (3.6.4)
That is, the long-run value of the VAR is simply the deterministic of exogenous component of the
model. This representation is particularly convenient when the exogenous components comprise only
constant terms, since then F xt reduces to a vector of constants, say µ, so that E(yt ) = µ. In other
words, the steady-state values for the data are just the constants in µ. This is in contrast with model
3.6.2, where C does not represent the long-term values, and has no direct interpretation. Hence, if the
researcher has at his disposal information about the long run values for the model, this information
can be integrated directly into the model through the prior mean of µ.
The main inconvenient of model 3.6.3, however, it that it is intractable as it is. While the variable
of interest in the model is yt , 3.6.3 is expressed as a complicated and non-linear function of it, so
that yt cannot be calculated directly. It is thus necessary to convert first the mean-adjusted model
into a tractable standard form, which fortunately can be done easily. To do so, start from 3.6.3 and
rearrange:
118
3. Advanced analysis
A(L)(yt − F xt ) − εt
⇔ A(L)yt − A(L)F xt = εt
⇔ A(L)yt = A(L)F xt = εt
⇔ yt = A1 yt−1 + A2 yt−2 + · · · + Ap yt−p + A(L)F xt + εt
⇔ yt = A1 yt−1 + A2 yt−2 + · · · + Ap yt−p + F xt − A1 F xt−1 · · · − Ap F xt−p + εt (3.6.5)
3.6.5 shows that a mean-adjusted VAR is simply a VAR in standard form integrating additional
lagged values of exogenous variables in its deterministic component. In this modified model, there
are still k1 and q1 parameters to estimate for yt , but now the model comprises k3 = m(p + 1)
coefficients in each equation with respect to xt , and thus q3 = nk3 = nm(p + 1) coefficients in total.
Actually, one can go further and convert 3.6.5 into more convenient matrix forms equivalent to
1.1.7 and 1.1.12. First, rewrite 3.6.5 in transpose form:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
yt = yt−1 A1 + yt−2 A2 · · · + yt−p Ap + xt F − xt−1 F A1 − · · · − xt−p F Ap + ε (3.6.6)
0 0 0 0
y y0 y y
10 0
−1 1−p
0 0
y2 y1 y0 0 y2−p 0
0
= A + A +··· +
.. .. .. |{z} .. Ap
1 2
. . . . |{z}
|{z}
n×n n×n n×n
0 0 0 0
yT yT −1 yT −2 yT −p
| {z } | {z } | {z } | {z }
T ×n T ×n T ×n T ×n
0 0 0 0
x x0 x ε
10 0
1−p 10
0
x2 0 x1 x ε
0 0
F A − · · · − 2−p F 0 A0 + 2
F −
+ . |{z} .. | {z 1} .. p . (3.6.7)
.. . . | {z } ..
m×n
m×n m×n
0 0 0 0
xT xT −1 xT −p εT
| {z } | {z } | {z } | {z }
T ×m T ×m T ×m T ×n
119
3. Advanced analysis
0 0 0 0 0 0 0 0 0 0
y y0 y−1 . . . y1−p A x −x0 . . . −x1−p F ε
10 0 0 0
10 10 0 0
0 0 10
y2
y1 y0 . . . y2−p A2 x2 −x1
. . . −x2−p F A1 ε2
= +
.. .. .. .. .. .. .. .. .. .. .. + .. (3.6.8)
. . . . .
. . . . . . .
0 0 0 0 0 0 0 0 0 0 0
yT yT −1 yT −2 . . . yT −p Ap xT −xT −1 . . . −xT −p F Ap εT
| {z } | {z } | {z } | {z }| {z } | {z }
T ×n T ×k1 k1 ×n T ×k1 k3 ×n T ×n
Y = XB + Z∆ + E (3.6.9)
with
0 0 0 0 0 0 0
y y y−1 . . . y1−p x −x0 . . . −x1−p
10 00 0 0
10 0 0
y2
y1
y0 . . . y2−p
x
−x1 . . . −x2−p
, Z = 2
Y = . , X = .
.. .. .. .. .. .. ..
.. .. . . . . . . .
0 0 0 0 0 0 0
yT yT −1 yT −2 . . . yT −p xT −xT −1 . . . −xT −p
0 0 0
A F ε
10 0 0 10
A2 F A1 ε2
.. , ∆ = .. , E = ..
B= (3.6.10)
. . .
0 0 0 0
Ap F Ap εT
120
3. Advanced analysis
0 0 0
y0 y−1 . . . y1−p 0 ... 0
y A(1)
1,1
0 0 0 1
..
y1 y0 . . . y2−p ... .
.
. .. .. .. .. .. .
.
. . . .
A(1)
y1,T
0 0 0
p
.
y
T −1 yT −2 . . . yT −p 0 ... 0
.
.. .
=
0 0 0 0 .
... ... 0 y0 y−1 ... y1−p (n)
y
. A
n,1 .. 0 0 0 1
... ... y1 y0 ... y2−p
.. .
..
.
.. .. .. ..
. ... . . .
yn,T A(n)
0 0 0 p
| {z } 0 ... ... 0 yT −1 yT −2 . . . yT −p | {z }
nT ×1 | {z } k1 ×n
T ×k1
0 0 0
x0 x−1 . . . x1−p 0 ... 0
(1)
F ε1,1
0 0 0
x1 x0 . . . x2−p ... .. ..
.. .. ... .. ..
. .
. . . .
(1)
(F Ap ) ε1,T
0 0 0
x
T −1 xT −2 . . . xT −p 0 ... 0 ..
.
0 0 0
. + .
. (3.6.11)
0 ... ... 0 x0 y−1 ... x1−p
F (n) ε
. n,1
.. ... ... x1
0
x0
0
...
0
x2−p
.
.
.
.
. .
.. .. .. ..
. ... . . .
(F A )(n) ε
0 0 0 p n,T
0 ... ... 0 xT −1 xT −2 . . . xT −p | {z } | {z }
| {z } q2 ×1 nT ×1
T ×k1
with:
In practical applications, it is either the form 3.6.9 or the form 3.6.12 which will be used, rather than
3.6.3. A decomposition which proves useful to recover ∆ in 3.6.12 is the following:
Inm
Im ⊗ A1
0
vec(∆ ) = vec(F A1 F . . . Ap F ) = .. vec(F ) = U ψ (3.6.14)
.
Im ⊗ Ap
with:
121
3. Advanced analysis
Inm
Im ⊗ A1
U =
.. (3.6.15)
.
Im ⊗ Ap
and
ψ = vec(F ) (3.6.16)
β ∼ N (β0 , Ω0 ) (3.6.17)
In practice, the prior parameters β0 and Ω0 are set just as for the Minnesota prior. For ψ, the prior
is a bit more complicated. Setting a flat prior on ψ as would be the case for the exogenous variables
in a Minnesota scheme is not possible, for two reasons. The first reason is that the very purpose of
a mean-adjusted VAR is to explicitly integrate prior information about the exogenous variables into
the estimation process. If no such information is available, or is lost anyway in a flat prior, there
is no point into using a mean-adjusted model. The second reason is technical: Villani (2009) shows
that when an uninformative prior is used for exogenous variables, the Gibbs sampler may behave
badly and generate draws for ψ that are remote from the actual posterior. To avoid this, a prior that
is at least moderately informative is required. The simplest solution is then for the researcher to
specify a (subjective) 95% probability interval for the prior values, and to calculate the prior mean
and variance retrospectively from this interval.
122
3. Advanced analysis
Turn now to the derivation of the posterior distribution. Similarly to the normal-diffuse prior,
there exist no analytical posterior distributions for β, Σ and ψ. It is however possible to derive
conditional posterior distributions, and integrate them to the usual Gibbs sampler process.
To derive the posterior distribution, define first the demeaned data vector ŷt as :
ŷt = yt − F xt (3.6.20)
A(L)ŷt = εt (3.6.21)
Villani (2009) then remarks that 3.6.21 is just a standard form VAR for ŷt = yt − F xt . Therefore,
conditional on F (that is, on ψ ), the conditional posterior distributions for β and Σ are simply those
obtained with a normal-diffuse prior. Therefore, the conditional posteriors are similar to 1.6.7 and
1.6.9 and given by:
with
0
Ω̄ = [Ω−1
0 +Σ
−1
⊗ X̂ X̂]−1 (3.6.23)
and
0
β̄ = [Ω−1
0 β0 + (Σ
−1
⊗ X̂ )ŷ] (3.6.24)
where X̂ and ŷ are defined as X and y in 3.6.10 and 3.6.13, using ŷt rather than yt .
with
S̃ = (Ŷ − X̂B)0 (Ŷ − X̂B) (3.6.26)
Deriving the posterior distribution of ψ is more complex, but Villani (2009) shows (See Appendix
A. in Villani (2005) for a complete derivation) that it is given by:
123
3. Advanced analysis
with
0 0
Λ̄ = [Λ−1 −1
0 + U (Z Z ⊗ Σ )U ]
−1
(3.6.28)
and
0 0
ψ̄ = Λ̄[Λ−1 −1
0 ψ0 + U vec(Σ (Y − XB) Z)] (3.6.29)
With these values, it is now possible to introduce the Gibbs algorithm used to estimate a mean-
adjusted VAR:
1. Define the number of iterations It of the algorithm, and the burn-in sample Bu .
2. Define initial values β(0) , B(0) and Σ(0) for the algorithm. Obtain the initial value for U from
β(0) .
3. At iteration n , draw ψ( n) conditional on β(n−1) and Σ(n−1) . Draw ψ(n) from a multivariate
normal with mean ψ̄ and covariance matrix Λ̄:
π(ψ|β(n−1) Σ(n−1) , y) ∼ N (ψ̄, Λ̄)
with
0 0
Λ̄ = [Λ−1 −1
0 + U (Z Z ⊗ Σ(n−1) )U ]
−1
and
0 0
ψ̄ = Λ̄[Λ−1 −1
0 ψ0 + U vec(Σ(n−1) (Y − XB(n−1) )Z)]
5. Draw the value Σ(n) , conditional on B(n−1) and ψ(n) . Draw Σ(n) from an inverse Wishart
distribution with scale matrix S̃ and degrees of freedom T :
π(Σ(n) |B(n−1) , ψ(n) , y) ∼ IW(S̃, T )
with:
0
S̃ = (Ŷ − X̂B(n−1) ) (Ŷ − X̂B(n−1) )
6. Finally, draw β(n) conditional on Σ(n) and ψ(n) , and reshape into B(n) . Draw β(n) from a
multivariate normal with mean β̄ and covariance matrix Ω̄:
π(β(n) |Σ,(n) ψ(n) , y) ∼ N (β̄, Ω̄)
124
3. Advanced analysis
0
with Ω̄ = [Ω−1 −1
0 + Σ(n) ⊗ X̂ X̂]
−1
and
0
β̄ = [Ω−1 −1
0 β0 + (Σ(n) ⊗ X̂ )ŷ]
7. Repeat until It iterations are realized, then discard the first Bu iterations.
125
4. Bayesian Panel VARs
The terminology of Panel VAR models is now introduced. The approach followed in this subsec-
tion and the incoming ones owes much to Canova and Ciccarelli (2013), and additional references
can be found in this survey paper. Formally, a panel VAR model comprises N entities or “units”,
which can be countries, economic sectors or industries, firms, and so on. As for a standard VAR,
each unit includes n endogenous variables, and p lags, defined over T periods. Only balanced panels
are considered, that is, panels for which the n variables are the same for each units, and defined over
the same T time periods. The model also includes m exogenous variables, assumed to be common
across units.
In its most general form, the panel VAR model for unit i (with i = 1, 2, . . . , N ) writes as:
126
4. Bayesian Panel VARs
p
N X
Akij,t yj,t−k + Ci,t xt + εi,t
X
yi,t =
j=1 k=1
= A1i1,t y1,t−1 + . . . + Api1,t y1,t−p
+A1i2,t y2,t−1 + . . . + Api2,t y2,t−p
+...
+A1iN,t yN,t−1 + . . . + ApiN,t yN,t−p
+Ci,t xt + εi,t (4.1.1)
y ak akij,12,t · · · akij,1n,t
i1,t ij,11,t
k k
yi2,t
aij,21,t aij,22,t · · · akij,2n,t
Akij,t
with: yi,t = .
=
.. .. ... ..
.. . . .
k k
yin,t aij,n1,t aij,n2,t · · · akij,nn,t
| {z } | {z }
n×1 n×n
c ci1,2,t · · · ci1,m,t x ε
i1,1,t 1,t i1,t
ci2,1,t ci2,2,t
· · · ci2,m,t
x2,t
εi2,t
Ci,t =
.. .. .. . xt = .
εi,t = .
(4.1.2)
. . . .. ..
..
cin,1,t cin,2,t · · · cin,m,t xm,t εin,t
| {z } | {z } | {z }
n×m m×1 n×1
yi,t denotes a n × 1 vector comprising the n endogenous variables of unit i at time t, while yij,t is the
j th endogenous variables of unit i. Akij,t is a n × n matrix of coefficients providing the response of
unit i to the k th lag of unit j at period t. For matrix Akij,t , the coefficient akij,lm,t gives the response of
variable l of unit i to the k th lag of variable m of unit j. xt is the m × 1 vector of exogenous variables,
and Ci,t is the n × m matrix relating the endogenous variables to these exogenous variables. For
Ci,t , the coefficient cij,l,t gives the response of endogenous variable j of unit i to the lth exogenous
variable. Finally, εi,t denotes a n × 1 vector of residuals for the variables of unit i, with the following
properties:
127
4. Bayesian Panel VARs
with:
ε σ σii,12,t · · · σii,1n,t
i,1,t ii,11,t
εi,2,t ,
σii,21,t σii,22,t
· · · σii,2n,t
= E(εi,t ε,i,t ) = E , ,
Σii,t ε
.. i,1,t ε i,2,t · · · ε i,n,t =
. .. .. .. (4.1.4)
. .. . . .
εi,n,t σii,n1,t σii,n2,t · · · σii,nn,t
| {z }
n×n
εi,t is assumed to be non-autocorrelated, so that E(εi,t ε,i,t ) = Σii,t , while E(εi,t ε,i,s ) = 0 when t 6= s.
Note that in this general setting the variance-covariance matrix for the VAR residuals is allowed to
be period-specific, which implies a general form of heteroskedasticity.
For each variable in unit i, the dynamic equation at period t contains a total of k = N np + m
coefficients to estimate, implying q = n(N np + m) coefficients to estimate for the whole unit. Stack-
ing over the N units, the model reformulates as:
p
Akt yt−k + Ct xt + εt
X
yt =
k=1
= A1t yt−1 + . . . + Apt yt−p + Ct xt + εt (4.1.5)
or:
y A1 A112,t · · · A11N,t y
1,t 11,t 1,t−1
1
y2,t
A A122,t · · · A12N,t y2,t−1
= 21,t
.. .. .. .. .. .. + · · ·
.
.
. . . .
yN,t A1N 1,t A1N 2,t · · · A1N N,t yN,t−1
Ap Ap12,t · · · Ap1N,t y C ε
11,t 1,t−p 1,t 1,t
p
A21,t Ap22,t p
· · · A2N,t y2,t−p C2,t
ε
+ + xt + 2,t (4.1.6)
.. .. .. .. .. .. ..
.
. . . . .
.
ApN 1,t ApN 2,t p
· · · AN N,t yN,t−p CN,t εN,t
with:
128
4. Bayesian Panel VARs
y Ak Ak12,t · · · Ak1N,t C ε
1,t−p 11,t 1,t 1,t
k
y2,t−p
A21,t Ak22,t k
· · · A2N,t
C
ε
k
yt = . At = Ct = 2,t εt = 2,t (4.1.7)
.. .. .. .. .. ..
.. . . . . . .
yN,t−p AkN 1,t AkN 2,t k
· · · AN N,t CN,t εN,t
| {z } | {z } | {z } | {z }
N n×1 N n×N n N n×m N n×1
εt ∼ N (0, Σt ) (4.1.8)
with:
ε Σ Σ12,t · · · Σ1N,t
1,t 11,t
ε2,t ,
Σ21,t
Σ22,t · · · Σ2N,t
Σt = E(εt ε,t ) = E , ,
ε
.. 1,t ε 2,t · · · ε N,t = ..
.. .. .. (4.1.9)
. . . . .
εN,t ΣN 1,t ΣN 2,t · · · ΣN N,t
| {z }
N n×N n
The assumption of absence of autocorrelation is then extended to the whole model: E(εt ε,t ) = Σt
while E(εt ε,s ) = 0 when t 6= s. Formulation (4.1.6) of the model now implies that there are
h = N q = N n(N np + m) coefficients to estimate.
This is the most general form of the panel VAR model. Under this form, it is characterised by
four properties:
1. Dynamic interdependencies: the dynamic behaviour of each unit is determined by lagged val-
ues of itself, but also by lagged values of all the other endogenous variables of all other units. In
other words, Akij,t 6= 0 when i 6= j.
2. Static interdependencies: the εi,t are allowed to be correlated across units. That is, in gen-
eral, Σij,t 6= 0 when i 6= j.
3. Cross-subsectional heterogeneity: the VAR coefficients and residual variances are allowed to
be unit-specific. In other words, Alik,t 6= Aljk,t , Ci,t 6= Cj,t and Σii,t =
6 Σjj,t when i 6= j.
129
4. Bayesian Panel VARs
4. Dynamic heterogeneity: the VAR coefficients and the residual variance-covariance matrix are
allowed to be period-specific. In other words, Akij,t =
6 Akij,s and Σij,t 6= Σij,s when t 6= s.
In practice, this general form may be too complex to produce accurate estimates. As it consumes
many degrees of freedom, if one has legitimate reasons to assume that some of the properties will
not hold, better estimates can be obtained by relaxing them and opt for less degrees-of-freedom
consuming procedures. For instance, if one considers a group of countries that are very homogenous
and tend to react in a similar way to structural economic shocks, it may be reasonable to relax
property 3. For the sake of convenience, the incoming developments will thus present the models by
increasing order of complexity, from the simplest one (all properties relaxed) to the most complex
one (all properties satisfied).
Example
Before turning to the different estimation methodologies, it may be useful to provide a simple ex-
ample. Assume a panel VAR model with 2 units so that N = 2, 2 endogenous variables per unit so
that n = 2, one common exogenous variable so that m = 1, and p = 1 lag. This implies that for
each period, every individual equation comprises k = N np + m = 2 × 2 × 1 + 1 = 5 coefficients to
estimate. Each unit then implies q = n(N np + m) = 2 × (2 × 2 × 1 + 1) = 2 × 5 = 10 coefficients to
estimate, and the full model comprises h = N k = 2 × 10 = 20 coefficients.
130
4. Bayesian Panel VARs
y
11,t
a1
11,11,t
a111,12,t a111,21,t a111,22,t y11,t−1 c11,1,t ε
11,t
1
y12,t a a112,12,t a112,21,t a112,22,t y c ε
12,t−1 + 12,1,t x 12,t
= 12,11,t
1,t +
1
y21,t a21,11,t a121,12,t a121,21,t 1
a21,22,t y c ε21,t
21,t−1 21,1,t
y22,t a122,11,t a122,12,t a122,21,t a122,22,t y22,t−1 c22,1,t ε22,t
In the Pesaran and Smith framework, it is assumed that the N units of the model are charac-
terised by heterogenous VAR coefficients, but that these coefficients are random processes sharing a
common mean. Therefore, the parameters of interest are the average, or mean effects of the group.
If the same assumption is formed about the residual variance-covariance matrix, namely that it is
heterogenous across units but is characterised by a common mean, then a single and homogenous
VAR model is estimated for all the units. Hence, in this model, the four panel properties are relaxed.
131
4. Bayesian Panel VARs
Start from the general formulation (4.1.6). Given these assumptions, one obtains:
y A1 0 ··· 0 y
1,t 1 1,t−1
1
y2,t
0 A2
··· 0 y2,t−1
.. + · · ·
=
.. .. .. ... ..
. . . . .
yN,t 0 0 · · · A1N yN,t−1
Ap 0 ··· 0 y C ε
1 1,t−p 1,t 1,t
p
0 A2
··· 0 y2,t−p C2,t
ε
+ . + xt + 2,t (4.2.1)
.. .. .. .. ..
..
.. . . . . . .
0 0 · · · ApN yN,t−p CN,t εN,t
and
Σ 0 ··· 0
1
0 Σ2
··· 0
..
.. ... .. (4.2.2)
. . .
0 0 · · · ΣN
Because each unit only responds to itself, the double subscripts ii in Alii and Σii can be dropped
without ambiguity in favour of Ali and Σi . Consider individual unit i. From (4.2.1), one obtains:
with:
εi,t ∼ N (0, Σi ) (4.2.4)
Transpose (4.2.3):
, , ,
yi,t = yi,t−1 (A1i ), + · · · + yi,t−p (Api ), + x,t Ci, + ε,i,t (4.2.5)
In compact form:
(A1 ),
i
.
,
, , ..
,
yi,t = yi,t−1 · · · yi,t−p x,t
p , + εi,t
(4.2.6)
(Ai )
Ci,
132
4. Bayesian Panel VARs
or:
Yi = Xi Bi + Ei (4.2.8)
with:
y, ,
yi,0 ,
· · · yi,1−p x,1 (A1 ), ε,
i,1 i i,1
..
, , ,
yi,2
yi,1 · · · yi,2−p x,2 .
,
εi,2
Yi =
..
Xi =
.. .. . . Bi = Ei =
..
(4.2.9)
.
. . .. ..
(Api ),
.
, , , ,
yi,T yi,T −1 · · · yi,T −p xT Ci, ε,i,T
| {z } | {z } | {z } | {z }
T ×n T ×(np+m) (np+m)×n T ×n
Using A.8 and A.12, the model (4.2.8) reformulates in vectorised form as:
or:
1(1)
y
, ,
Ai ε
i1,1 yi,0 ··· yi,1−p x,1 0 ··· ··· 0 ..
i,1,1
yi1,2 .. .. .. εi,1,2
, , .
..
y
i,1 · · · yi,2−p x,2 . . .
p(1) ..
. . .. .. .. .. .. .. Ai .
.
. . . . . . . (1)
yi1,T C εi,1,T
i
,
.
yi,T −1 · · · yi,T −p x,T
,
0 ··· ··· 0 .
.
.. .. ..
...
= + (4.2.11)
, ,
0 ··· ··· 0 yi,0 · · · yi,1−p x,1
1(n)
y A ε
in,1 . .. .. i i,n,1
.. , , ,
y
. . yi,1 · · · yi,2−p x2 ..
ε
.
in,2 i,n,2
.. .. .. .. .. .. ..
.. . . . . . . . ..
p(n)
. Ai .
,
0 ··· ··· 0 yi,T · · · yi,T −p x,T
,
−1 (n)
yin,T | {z } Ci εi,n,T
| {z } nT ×n(np+m) | {z } | {z }
nT ×1 n(np+m)×1 nT ×1
k(j) (j)
where Ai and Ci respectively denote the transpose of row j of matrix Aki and Ci . (4.2.10) makes
133
4. Bayesian Panel VARs
it clear that each unit comprises a total of q = n(np + m) coefficients to estimate. (4.2.10) rewrites:
yi = X̄i βi + εi (4.2.12)
with:
yi = vec(Yi ) X̄i = (In ⊗ Xi ) βi = vec(Bi ) εi = vec(Ei ) (4.2.13)
| {z } | {z } | {z } | {z }
nT ×1 nT ×q q×1 nT ×1
Consider the VAR model written in the form (4.2.12). The mean-group estimator model assumes
that for each unit i, βi can be expressed as:
β i = b + bi (4.2.15)
with b a k × 1 vector of parameters and bi ∼ N (0, Σb ). (4.2.15) implies that the coefficients of the
VAR in different units will differ, but have similar means and variances. In the Pesaran and Smith
approach, the main parameter of interest is the average or mean effect b. To obtain it, Pesaran and
Smith propose the following strategy. First, obtain an estimate of βi for each unit by standard OLS.
That is, obtain:
−1
β̂i = X̄i, X̄i X̄i, yi (4.2.16)
As for the standard OLS VAR, it may be more efficient to obtain a similar estimator by using (4.2.8)
rather than (4.2.12). Then what is estimated is:
β̂i can then be obtained by vectorising B̂i . Once the estimator β̂i is obtained for all units, the
mean-group estimator for b in (4.2.15) is simply obtained from the following formula:
N
1 X
b̂ = β̂i (4.2.18)
N i=1
The standard error for the mean-group estimator is then given by:
N
1
(β̂i − b̂)(β̂i − b̂),
X
Σ̂b = (4.2.19)
N (N − 1) i=1
134
4. Bayesian Panel VARs
A similar strategy is followed for the mean-group estimate of the residual variance-covariance matrix
Σ. For each unit i, an estimate of Σi is obtained from:
1
Σ̂i = E , Ei (4.2.20)
T −k−1 i
N
1 X
Σ̂ = Σ̂i (4.2.21)
N i=1
This concludes the subsection dedicated to OLS panel VAR models. The incoming subsections will
discuss panel VAR models from a Bayesian perspective only. Once again, treatement is done by
increasing order of complexity: from the simplest model (all properties relaxed) to the most complex
one (all properties satisfied).
y A1 0 ... 0 y
1,t 1,t−1
1
y2,t 0 A ... 0 y2,t−1
=
.. .. .. .. .. .. + . . .
.
.
. . . .
1
yN,t 0 0 ... A yN,t−1
Ap 0 ... 0 y C ε
1,t−p 1,t
p
0 A ... 0 y2,t−p C ε
+ . + xt + 2,t (4.3.1)
.. ... .. .. ..
..
.. . . . . .
0 0 . . . Ap yN,t−p C εN,t
where both units and time subscripts have been dropped from the Akij,t coefficient matrices since
the dynamic coefficients are homogenous across units, and coefficients are time-invariant. The zero
135
4. Bayesian Panel VARs
entries reflect the fact that each unit is determined only by its own variables, and is independent
from the other units. Also, relaxing property 2 and 3 implies that:
The c subscript in Σc emphasises the fact that that the value is both time invariant and common to
all units. Then, from (4.1.9):
Σ Σ12t · · · Σ1Nt Σ 0 ··· 0
11t c
Σ21t
Σ22t · · · Σ2Nt 0 Σc
··· 0
Σt =
.. .. .. .. = .. .. .. = IN ⊗ Σc
.. (4.3.3)
.
. . .
. . . .
ΣN 1t ΣN 2t · · · ΣN Nt 0 0 · · · Σc
Take transposes:
, , ,
y1,t = y1,t−1 (A1 ), + · · · + y1,t−p (Ap ), + x,t C , + ε,1,t
, , ,
y2,t = y2,t−1 (A1 ), + · · · + y2,t−p (Ap ), + x,t C , + ε,2,t
..
.
, , ,
yN,t = yN,t−1 (A1 ), + · · · + yN,t−p (Ap ), + x,t C , + ε,N,t (4.3.5)
136
4. Bayesian Panel VARs
or:
Y t = X t B + Et (4.3.7)
with:
y, y, ,
· · · y1,t−p x,t (A1 ), ε,
1,t 1,t−1 1,t
..
, , , , ,
y2,t y2,t−1 · · · y2,t−p xt . ε2,t
Yt = . Xt = .
. . . B=
Et =
..
(4.3.8)
.. .. .. .. .. (Ap ), .
, , ,
yN,t yN,t−1 · · · yN,t−p x,t C, ε,N,t
or:
Y = XB + E (4.3.10)
As usual, using A.8 , it is possible to reformulate the model in vectorised form as:
or:
y = X̄β + ε (4.3.12)
This model is smaller in dimension than the general model. As a single VAR is estimated for the
whole set of units, each equation in the model only implies k = np + m coefficients to estimate,
implying h = q = n(np + m) coefficients to estimate at the unit scale (and thus for the entire model).
In this model, there are two object of interest to identify: B, defined in (4.3.7) (or its vectorised
equivalent in (4.3.12)), and Σc , defined in (4.3.2).
137
4. Bayesian Panel VARs
In essence, the model described by (4.3.10) and (4.3.12) is just a conventional VAR model. As
such, standard estimation techniques for the derivation of the posterior apply. Here, a traditional
normal-Wishart identification strategy is adopted.
Start by the likelihood function. Given (4.3.12) and (4.3.13), it is given by:
1
−1/2
,
f (y Σ̄) ∝ Σ̄ exp − (y − X̄β) Σ̄−1 (y − X̄β) (4.3.14)
2
β ∼ N (β0 , Σc ⊗ Φ0 )
Φ0 is defined similarly to 1.4.7, except that the residual variance terms σ12 , σ22 , ..., σn2 are now de-
fined over pooled sample of variables. That is, σ12 is estimated by pooling the samples for variable 1
over units 1, 2, · · · , N , and then estimating an autoregressive model over this pooled series. σ22 , ..., σn2
are defined similarly. The prior density is given by:
1
π(β) ∝ |Σc |−k/2 exp − (β − β0 ), (Σc ⊗ Φ0 )−1 (β − β0 ) (4.3.15)
2
Σc ∼ IW (S0 , α0 )
Similarly to Φ0 , S0 is defined as in 1.4.11, but with residual variance terms σ12 , σ22 , ..., σn2 defined
over pooled sample of variables. The prior density is given by:
1 n
o
π(Σc ) ∝ |Σc |−(α0 +n+1)/2 exp − tr Σ−1
c S0 (4.3.16)
2
Using Baye’s rule 1.2.5, one combines the likelihood function with the prior distributions and rear-
range to obtain the posterior distribution:
1 n
, −1
h io
−k/2
π(β, Σc |y ) ∝ |Σc | exp − tr Σ−1 (B − B̄) Φ̄ (B − B̄)
2 c
1 n −1 o
−(ᾱ+n+1)/2
× |Σc | exp − tr Σc S̄ (4.3.17)
2
138
4. Bayesian Panel VARs
with:
h i−1
Φ̄ = Φ−1 ,
0 +X X (4.3.18)
h i
B̄ = Φ̄ Φ−1 ,
0 B0 + X Y (4.3.19)
ᾱ = N T + α0 (4.3.20)
S̄ = Y , Y + S0 + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (4.3.21)
and:
π(B |y ) ∼ M T (B̄, S̄, Φ̄, α̃) (4.3.23)
with:
α̃ = ᾱ − n + 1 = N T + α0 − n + 1 (4.3.24)
y A1 0 ··· 0 y
1,t 1 1,t−1
1
y2,t
0 A2
··· 0 y2,t−1
.. + · · ·
=
.. .. .. ... ..
. . . . .
yN,t 0 0 · · · A1N yN,t−1
Ap 0 ··· 0 y C ε
1 1,t−p 1 1,t
p
0 A2
··· 0 y2,t−p C2
ε
+ + xt + 2,t (4.4.1)
.. .. ... .. .. .. ..
. . . . . .
0 0 · · · ApN yN,t−p CN εN,t
139
4. Bayesian Panel VARs
and
Σ 0 ··· 0
1
0 Σ2
··· 0
Σ=
.. .. .. .. (4.4.2)
. . . .
0 0 · · · ΣN
Because each unit only responds to itself, a single subscript i can be used without ambiguity in Alii
and Σi . Consider individual unit i. From (4.4.1), one obtains:
with:
εi,t ∼ N (0, Σi ) (4.4.4)
Transpose:
, , ,
yi,t = yi,t−1 (A1i ), + · · · + yi,t−p (Api ), + x,t Ci, + ε,i,t (4.4.5)
In compact form:
(A1 ),
i
.
,
..
yi,t ,
= yi,t−1 ,
· · · yi,t−p x,t + ε, (4.4.6)
i,t
(Api ),
Ci,
Stack over the T time periods:
y, y, ,
· · · yi,1−p x,0 (A1 ), ε,
i,1 i,0 i i,1
, , , . ,
yi,2 y · · · yi,2−p x,1 .. εi,2
= i,1
.. .. .. .. .. p , + . (4.4.7)
. . . . . (Ai ) ..
, , , , , ,
yi,T yi,T −1 · · · yi,T −p xT Ci εi,T
or:
Yi = Xi Bi + Ei (4.4.8)
140
4. Bayesian Panel VARs
with:
y, y, ,
· · · yi,1−p x,0 (A1 ), ε,
i,1 i,0 i i,1
..
, , ,
yi,2 yi,1 · · · yi,2−p x,1 ,
ε
Bi = . Ei = i,2
Yi = . Xi =
.. .. .. .. .. (4.4.9)
..
p ,
.
. . .
(Ai )
.
, , , , , ,
yi,T yi,T −1 · · · yi,T −p x T C i ε i,T
| {z } | {z } | {z } | {z }
T ×n T ×k k×n T ×n
Using A.8 and A.12, model (4.4.8) reformulates in vectorised form as:
or:
1(1)
y
, ,
Ai ε
i1,1 yi,0 ··· yi,1−p x,1 0 ··· ··· 0 ..
i1,1
yi1,2 .. .. .. εi1,2
, , .
..
y
i,1 · · · yi,2−p x,2 . . .
p(1) ..
. . .. .. .. .. .. .. A .
. i
. . . . . . . (1)
yi1,T C ε
i
, i1,T
.
yi,T −1 · · · yi,T −p x,T
,
0 ··· ··· 0 . .
.. .. ..
...
= + (4.4.11)
, ,
0 ··· ··· 0 yi,0 ··· yi,1−p x,1
1(n)
y A ε
in,1 . .. .. , i
in,1
.. , ,
y
. . yi,1 · · · yi,2−p x2 ..
ε
.
in,2 in,2
.. .. .. .. .. .. ..
.. . . . . . . . p(n) ..
. .
Ai
, , ,
0 ··· ··· 0 yi,T · · · yi,T −p xT
−1 (n)
yin,T | {z } Ci εin,T
| {z } nT ×n(np+m) | {z } | {z }
nT ×1 n(np+m)×1 nT ×1
k(j) (j)
where Ai and Ci respectively denote the transpose of row j of matrices Aki and Ci . (4.4.11)
shows that each unit comprises q = n(np + m) coefficients to estimate, implying h=Nq=Nn(np+m)
coefficients to estimate for the whole model. (4.4.11) can reformulate as:
yi = X̄i βi + εi (4.4.12)
with:
yi = vec(Yi ), X̄i = (In ⊗ Xi ), βi = vec(Bi ), εi = vec(Ei ) (4.4.13)
| {z } | {z } | {z } | {z }
nT ×1 nT ×q q×1 nT ×1
141
4. Bayesian Panel VARs
Consider the VAR model written in the form (4.4.12). The random coefficient model assumes that
for each unit i, βi can be expressed as:
β i = b + bi (4.4.15)
βi ∼ N (b, Σb ) (4.4.16)
(4.4.16) implies that the coefficients of the VAR will differ across units, but are drawn from a dis-
tribution with similar mean and variance. From this setting, different identification strategies are
possible, typically treating (4.4.16) as an exchangeable prior in order to derive the posterior distri-
bution. Two of these strategies are now described: the Zellner and Hong (1989) approach, and the
hierarchical prior approach developed by Jarocinski (2010b).
142
4. Bayesian Panel VARs
y X̄1 0 ··· 0 β
1 .. 1
.
X̄2 . .
y2 0 . β2
y= X̄ = β=
.. .. ..
.
.. ..
.
. . . 0
yN 0 ··· 0 X̄N βN
| {z } | {z } | {z }
N nT ×1 N nT ×h h×1
ε Σ̄1 0 ··· 0
1 ..
.
Σ̄2 . .
ε2 0 .
,
ε= Σ̄ = E (εε ) = (4.5.1)
.. ..
.
.. ..
. . . 0
εN 0 ··· 0 Σ̄N
| {z } | {z }
N nT ×1 N nT ×N nT
and:
b Σb 0··· 0
. ..
Σb . .
b 0 .
b̄ = 1N ⊗ b = ..
Σ̄b = IN ⊗ Σb =
.. ... ...
(4.5.2)
.
. 0
b 0 ··· 0 Σb
| {z } | {z }
h×1 h×h
It follows directly from (4.5.1) and (4.5.2) that the model as a whole may rewrite as:
y = X̄β + ε (4.5.3)
with:
ε ∼ N 0, Σ̄ (4.5.4)
β ∼ N b̄, Σ̄b (4.5.5)
Zellner and Hong assume a simple form for Σb and the series of Σi :
Σb = λ1 σε2 Iq (4.5.6)
and
Σi = σε2 In ∀i (4.5.7)
143
4. Bayesian Panel VARs
σε2 is a residual variance term, assumed to be similar across units and endogenous variables, and λ1
represents an overall tightness parameter. It then follows from (4.4.14), (4.5.1) and (4.5.2) that:
Σ̄ = σε2 IN nT (4.5.8)
and:
Σ̄b = λ1 σε2 Ih (4.5.9)
Zellner and Hong then derive a posterior distribution for the model by adopting a Minnesota frame-
work. That is, they assume a fixed and known value for the residual covariance matrix Σ̄, obtained
directly from (4.5.8). Thus, only β remains to be estimated by the model, and (4.5.5) is used as
a prior distribution, conditional on known values for b̄ and Σ̄b . Σ̄b is defined from (4.5.9). Then,
conditional on Σ̄, the likelihood function for the data is given by:
1
,
f (y |β ) ∝ exp − y − X̄β Σ̄−1 y − X̄β (4.5.10)
2
1
,
π(β) ∝ exp − (β − b̄) Σ̄−1
b (β − b̄) (4.5.11)
2
Then, using Bayes rule 1.2.3 and rearranging, one obtains the posterior for β as:
1
,
π(β |y ) ∝ exp − (β − β̄) Ω̄−1
b (β − β̄) (4.5.12)
2
with:
−1
Ω̄b = σε2 λ−1 ,
1 Ih + X̄ X̄ (4.5.13)
and:
−1
β̄ = λ−1 ,
1 Ih + X̄ X̄ X̄ , y + λ−1
1 b̄ (4.5.14)
This is the kernel of a multivariate normal distribution with mean β̄ and covariance matrix Ω̄b .
The marginal posterior distribution for each βi can then be obtained from (4.5.1), by marginalising
over the (βi )’s. From B.7, each βi then follows a multivariate normal distribution with mean β̄i and
covariance matrix Ω̄bi , where β̄i and Ω̄bi are respectively q ×1 partitions of β̄ and q ×q partitions of Ω̄b .
The only remaining question is how to define b and σε2 , which are respectively required to obtain b̄
from (4.5.2), and Ω̄b from (4.5.13). For b, Zellner and Hong use a pooled estimator, which allows to
144
4. Bayesian Panel VARs
integrate average sample information into the prior distribution. It is defined as:
N
!−1 N
!
X̄i, X̄i X̄i, yi
X X
b= (4.5.15)
i=1 i=1
For σε2 , a simple solution is to substitute b̄ (as defined in (4.5.2)) into (4.5.3) to obtain:
ε = y − X̄ b̄ (4.5.16)
π (β, Σ, b, Σb |y ) (4.6.2)
145
4. Bayesian Panel VARs
Using an approach similar to that described in subsection 1.2, it is straightforward to show that it
is given by:
π (β, b, Σb , Σ |y ) ∝ π (y |β, Σ) π (β |b, Σb ) π (b) π (Σb ) π (Σ) (4.6.3)
In other words, the full posterior distribution is equal to the product of the data likelihood function
π (y |β, Σ ) with the conditional prior distribution π (β |b, Σb ) for β and the prior π (Σ) for Σ, along
with the two hyperpriors π (b) and π (Σb ).
The specific forms selected for the likelihood and the priors are now detailed. Unlike the Zellner
and Hong approach, it proves more convenient here not to aggregate the data across units. Start
with the likelihood function. Given (4.4.12) and (4.4.14), it obtains as:
1
YN −1/2 , −1
π (y |β, Σ) ∝ Σ̄i exp − yi − X̄i βi Σ̄i yi − X̄i βi (4.6.4)
i=1 2
Following (4.4.16), the vectors of coefficients βi follow a normal distribution, with common mean b
and common variance Σb :
βi ∼ N (b, Σb ) (4.6.5)
1
YN
−1/2
π (β |b, Σb ) ∝ |Σb | exp − (βi − b), (Σb )−1 (βi − b) (4.6.6)
i=1 2
For the hyperparameters b and Σb , the assumed hyperpriors are the following. For b, the selected
form is simply a diffuse (improper) prior:
π (b) ∝ 1 (4.6.7)
For Σb , the adopted functional form is designed to replicate the VAR coefficient covariance matrix
of the Minnesota prior. It relies on a covariance matrix Ωb , which is a diagonal matrix of dimension
q × q, defined as follows:
1. For parameters in β relating endogenous variables to their own lags, the variance is given by:
2
1
σa2ii = (4.6.8)
l λ3
146
4. Bayesian Panel VARs
As for the Minnesota prior, σi2 and σj2 represent scaling parameters controlling for the relative coeffi-
cient sizes on variables i and j. They are obtained by fitting autoregressive models by OLS for the n
endogenous variables of the model, and computing their standard deviations. Because the variance
is assumed to be common across units, the autoregressive models are computed by pooling the data
of all the units, for each endogenous variable.
λ2 , λ3 and λ4 have an interpretation which is similar to that of the Minnesota prior. Compar-
ing (4.6.8)-(4.6.10) with (1.3.5)-(1.3.7), one can see that the terms are similar, save for the overall
tightness parameter λ1 . The full covariance matrix is then defined as:
Σb = (λ1 ⊗ Iq ) Ωb (4.6.11)
(λ1 ⊗ Iq ) is a q × q diagonal matrix with all its diagonal entries being equal to λ1 . This way, Σb in
(4.6.11) corresponds to the Minnesota prior covariance matrix 1.3.8, except that the value of λ1 in
the present case corresponds to (λ1 )2 in the Minnesota prior1 . Considering Ωb as fixed and known,
but treating λ1 as a random variable conveniently reduces the determination of the full prior for Σb
to the determination of the prior for the single parameter λ1 .
Note the implications of the value of λ1 . When λ1 = 0, prior variance is null and (4.4.16) im-
0
plies that all the βi s will take the identical value b: data is fully pooled and the obtained estimate
is simply the pooled estimator. As λ1 is growing larger, coefficients are allowed to differ more and
more across units, and get closer to the respective single unit estimates. In the limit case λ1 → ∞,
the prior becomes uninformative on b and no sharing of information is applied between units, so that
the coefficients for each unit become their own individual estimates. In-between values for λ1 imply
1
It turns out that it is more practical to work with λ1 rather than (λ1 )2 in order to derive the conditional posterior
distribution for λ1 . Nevertheless, it is straightforward to establish the equivalence with the actual Minnesota prior:
to obtain the λ1 overall tightness value of the Minnesota, simply take the square root of λ1 in this model.
147
4. Bayesian Panel VARs
some degree of information sharing between units, and ideally λ1 should be designed so as to provide
a good balance between individual and pooled estimates. To achieve this result, a traditional choice
for the prior distribution of λ1 is an inverse Gamma distribution with shape s0 /2 and scale v0 /2:
This implies:
v0
s0
− −1
π (λ1 |s0 /2, v0 /2) ∝ λ 2 exp − (4.6.13)
2λ1
However, Jarocinski (2010b) and Gelman (2006) show that such a prior can be problematic as
the results can be quite sensitive to the choice of values for s0 /2 and v0 /2. When the number of
units is greater than 5, those authors advocate either the use of the uniform uninformative prior
−1/2
π (λ1 ) ∝ λ1 , or to make the prior a weakly informative prior by using low values for s0 and v0 ,
such as s0 , v0 ≤ 0.001. The latter solution will be retained for the present model.
Finally, the prior distribution for Σi is simply the classical diffuse prior given by:
And this implies that the prior full density for Σ is given by:
YN
π (Σ) ∝ i=1
|Σi |−(n+1)/2 (4.6.15)
This concludes the description of the model. The likelihood function is given by (4.6.4), while the
prior distributions for the 4 set of parameters of the model (β, b, λ and Σ) are respectively given by
(4.6.6), (4.6.7), (4.6.13) and (4.6.15). Substituting for these expressions in (4.6.3), one may obtain
the full posterior distribution. This posterior distribution however does not allow for any analytical
derivations of the marginal posteriors as the parameters are too much interwoven. One has then
to rely on the numerical methods provided by the Gibbs sampler framework. In this respect, it is
necessary to obtain the conditional posterior distributions for each parameter. The simplest way to
do so is to start from (4.6.3) and marginalise.
Start with the full conditional distribution for βi . Note first that the conditional posterior is propor-
tional to the joint posterior (4.6.3). Thus, any term in the product which does not involve βi can be
148
4. Bayesian Panel VARs
where β−i is used to denote the set of all β coefficients less βi . Combining (4.6.4) and (4.6.6) in (4.6.16)
and rearranging, it is straightforward to show that the posterior for βi is conditionally multivariate
normal:
π (βi |β−i , y, b, Σb , Σ) ∼ N (β̄i , Ω̄i ) (4.6.17)
with:
h i−1
, −1
Ω̄i = Σ−1
i ⊗ Xi Xi + Σ b (4.6.18)
and:
h i
, −1
β̄i = Ω̄i Σ−1
i ⊗ Xi y i + Σ b b (4.6.19)
Because of conditional independence, it is possible to draw each βi in turn by sampling from the
corresponding conditional posterior.
Turn now to the conditional distribution of b. Starting again from (4.6.3) and relegating any term
not involving b to the proportionality constant yields:
1
−1
π (b |y, β, Σb , Σ) ∝ exp − (b − βm ), N −1 Σb (b − βm ) (4.6.21)
2
with βm = N −1 N
P
i=1 βi denoting the arithmetic mean over the βi vectors. This is the kernel of a
multivariate normal distribution with mean βm and covariance matrix N −1 Σb :
π (b |y, β, Σb , Σ) ∼ N βm , N −1 Σb (4.6.22)
Obtain now the conditional posterior for Σb . Using once again (4.6.3) and relegating to the normal-
ising constant any term not involving Σb , one obtains:
149
4. Bayesian Panel VARs
Substituting (4.6.6) and (4.6.13) into (4.6.23) and rearranging, one may eventually obtain:
v̄ 1
− s̄ −1
π (Σb |y, β, b, Σ) ∝ λ1 2 exp − (4.6.24)
2 λ1
with:
s̄ = h + s0 (4.6.25)
and
N n o
(βi − b), Ω−1
X
v̄ = v0 + b (βi − b) (4.6.26)
i=1
s̄
This is the kernel of a inverse Gamma distribution with shape 2
and scale v̄2 :
s̄ v̄
π (Σb |y, β, b, Σ) ∼ IG , (4.6.27)
2 2
Eventually, obtain the conditional posterior distribution for the set of residual covariance matrices
Σ = {Σ1 , Σ2 , ..., ΣN }. Once again relegating to the proportionality constant any term not involving
Σi in (4.6.3), one obtains:
1 h
i
π (Σi |Σ−i , y, β, b, Σb ) ∝ |Σi |−(T +n+1)/2 exp − tr Σ−1
i S̃i (4.6.29)
2
with:
S̃i = (Yi − Xi Bi ), (Yi − Xi Bi ) (4.6.30)
This is the kernel of an inverse Wishart distribution with scale S̃i and degrees of freedom T :
π (Σi |Σ−i , y, β, b, Σb ) ∼ IW S̃i , T (4.6.31)
Because of conditional independence, it is possible to draw each Σi in turn by sampling from the
corresponding conditional posterior.
With these elements, it is eventually possible to define the Gibbs sampler procedure allowing to
derive the posterior distribution for the model:
150
4. Bayesian Panel VARs
(n) (n)
3. At iteration n, draw Σb . To do so, draw λ1 from an inverse Gamma distribution:
(n)
λ1 ∼ IG 2s̄ , v̄2
with:
s̄ = h + s0
and:
N n (n−1) ,
(n−1)
o
− b(n) Ω−1 − (n)
P
v̄ = v0 + βi b β i b
i=1
(n)
Then obtain Σb from:
(n) (n)
Σb = λ1 ⊗ Iq Ωb
n o
(n) (n) (n)
4. At iteration n, draw β (n) = β1 , β2 , ..., βN from a multivariate normal distribution:
(n)
βi ∼ N β̄i , Ω̄i
with:
−1
(n−1) −1 (n) −1
,
Ω̄i = Σi ⊗ Xi Xi + Σb
and:
(n−1) −1 (n) −1 (n)
,
β̄i = Ω̄i Σi ⊗ Xi yi + Σb b
n o
(n) (n) (n)
5. At iteration n, draw Σ(n) = Σ1 , Σ2 , ..., ΣN from an inverse Wishart distribution:
(n)
Σi ∼ IW S̃i , T
with:
(n) ,
(n)
S̃i = Yi − Xi Bi Yi − Xi Bi
151
4. Bayesian Panel VARs
Start from the general formulation (4.1.5). Allowing for cross-subsectional heterogeneity, static
interdependency and dynamic interdependency, but ignoring dynamic heterogeneity, one obtains the
dynamic equation for the full model at period t as:
Take transpose:
yt, = yt−1
, ,
(A1 ), + · · · + yt−p (Ap ), + x,t C , + ε,t (4.7.2)
or:
yt, = Xt B + ε,t (4.7.4)
with:
(A1 ),
..
,
,
.
Xt = yt−1 · · · yt−p x,t B=
p ,
(4.7.5)
(A )
| {z }
1×k
C,
| {z }
k×N n
152
4. Bayesian Panel VARs
or:
yt = X̄t β + εt (4.7.7)
with:
X̄t = (IN n ⊗ Xt ) β = vec(B) (4.7.8)
| {z } | {z }
N n×h h×1
Because one allows for static interdependency in the model, the variance-covariance matrix of the
residual term εt does not have to be block diagonal anymore. In addition, a higher degree of flexibility
is permitted by assuming that the error term εt follows the following distribution:
σ Σ̃11 σ Σ̃12 · · · σ Σ̃1N Σ11 Σ12 · · · Σ1N
|{z} |{z}
n×n n×n
εt ∼ N (0, Σ) Σ = σ Σ̃ = σ Σ̃21
σ Σ̃22 ··· σ Σ̃2N
= Σ21
Σ22 ··· Σ2N
(4.7.9)
.. .. .. .. .. .. .. ..
. . . . . . . .
σ Σ̃N 1 σ Σ̃N 2 · · · σ Σ̃N N ΣN 1 ΣN 2 · · · ΣN N
| {z }
N n×N n
Therefore, the error term follows a distribution which is a mixture of normal and inverse Gamma,
and this can be shown to be actually a Student-t distribution. This formulation thus allows for fat
tail distributions for the error terms, which makes it more flexible than the usual normal assumption.
(4.7.7) takes the form of a standard linear model and could in principle be estimated by any stan-
dard OLS or Bayesian methods. However, it suffers from the curse of dimensionality: the number of
coefficients is likely to be larger than the size of the data set, which renders estimation untractable.
For instance, a complete data set corresponding to model (4.7.7) would contain N nT elements, while
the number of coefficients to estimate is h = N n(N np + m). Estimation using standard methods
is then possible only if T > N np + m, which may not be easily satisfied. Even if the condition is
satisfied, with only few degrees of freedom left, estimation is likely to be of poor quality.
153
4. Bayesian Panel VARs
For this reason, it is necessary to find an alternative approach where the dimensionality of the
problem is reduced. Canova and Ciccarelli (2006) propose to simplify the problem by assuming that
the h elements of the vector of coefficients β can be expressed as a linear function of a much lower
number r of structural factors:
r
X
β = Ξ1 θ1 + Ξ2 θ2 + ... + Ξr θr = Ξi θi (4.7.11)
i=1
yt = X̄t β + εt
= X̄t Ξθ + εt
= (X̄t Ξ)θ + εt
or:
yt = X̃t θ + εt (4.7.14)
with:
X̃t = X̄t Ξ (4.7.15)
| {z }
N n×d
To identify the model, one may then define the following structural factors:
154
4. Bayesian Panel VARs
This parsimonious approach then conveniently reduces the number of coefficients to estimate from
h = N n(N np + m) for a traditional VAR to d = d1 + d2 + d3 + d4 + d5 = 1 + N + n + (p − 1) + m =
N + n + p + m with the factor approach. Using the example of a moderate size panel VAR model
with N = 8 units, n = 6 endogenous variables, p = 5 lags and m = 1 exogenous variable, a standard
VAR formulation 1.1.12 would involve h = N n(N np + m) = 11568 coefficients to be estimated. On
the other hand, the retained factor approach only requires d = N + n + p + m = 20 elements to
estimate, a much smaller number indeed. Even with additional factors, the number of elements to
estimate would remain significantly lower than with a traditional approach.
The remaining question is then how one should define the series of matrices Ξ1 , Ξ2 , Ξ3 , Ξ4 and Ξ5 .
The easiest way to do so is probably to use an example. Hence, consider the case of a panel VAR
model with N = 2 units, n = 2 endogenous variables, p = 2 lags and m = 1 exogenous variable:
y
11,t
a1
11,11
a111,12 a112,11 a112,12 y11,t−1
1
y12,t a a111,22 a112,21 a112,22 y
= 11,21 12,t−1
1
y21,t a21,11 a121,12 a122,11 1
a22,12 y
21,t−1
y22,t a121,21 a121,22 a122,21 a122,22 y22,t−1
a2
11,11
a211,12 a212,11 a212,12 y11,t−2 c1,11 ε
11,t
1
a11,21 a111,22 a112,21 1
a12,22 y c ε
12,t−2 + 1,21 (x1,t ) + 12,t
+
1 (4.7.16)
a21,11 a121,12 a122,11 a122,12 y c ε21,t
21,t−2 2,11
a121,21 a121,22 a122,21 a122,22 y22,t−2 c2,21 ε22,t
155
4. Bayesian Panel VARs
matrices are: Ξ1 is h × d1 or 36 × 1, Ξ2 is h × d2 or 36 × 2, Ξ3 is h × d3 or 36 × 2, Ξ4 is h × d4 or
36 × 1, and Ξ5 is h × d5 or 36 × 1.
Consider the explained variable y11,t . As it belongs to unit 1 and represents endogenous variable
1, a representation consistent with the adopted factor structure would be to express its value as:
y11,t = (y11,t−1 + y12,t−1 + y21,t−1 + y22,t−1 + y11,t−2 + y12,t−2 + y21,t−2 + y22,t−2 + x1,t )θ11
+ (y11,t−1 + y12,t−1 + y11,t−2 + y12,t−2 )θ21
+ (y11,t−1 + y21,t−1 + y11,t−2 + y21,t−2 )θ31
+ (y11,t−1 + y12,t−1 + y21,t−1 + y22,t−1 )θ41
+ (x1,t )θ51 + ε11,t (4.7.17)
or:
y11,t = Z11,t θ11 + Z21,t θ21 + Z31,t θ31 + Z41,t θ41 + Z51,t θ51 + ε11,t (4.7.18)
Pursuing the same way with the other equations, one obtains:
y
11,t
Z
11,t
Z
21,t
0 Z31,t 0 Z41,t
y12,t Z Z 0 θ 0 Z32,t θ Z
= 11,t (θ11 ) + 21,t 21 + 31 + 41,t (θ41 )
y21,t Z11,t 0 Z22,t θ22 Z31,t 0 θ32 Z41,t
y22,t Z11,t 0 Z22,t 0 Z32,t Z41,t
Z
51,t
ε
11,t
Z51,t ε12,t
+
θ51 +
(4.7.19)
Z51,t ε21,t
Z51,t ε22,t
156
4. Bayesian Panel VARs
with:
Z22,t = y21,t−1 + y22,t−1 + y21,t−2 + y22,t−2
Z32,t = y12,t−1 + y22,t−1 + y12,t−2 + y22,t−2
or:
y t = Zt θ + ε t (4.7.21)
with:
Z
11,t
Z21,t 0 Z31,t 0 Z41,t Z51,t
Z11,t Z21,t 0 0 Z32,t Z41,t Z51,t
Zt = (4.7.22)
Z11,t 0 Z22,t Z31,t 0 Z41,t Z51,t
Z11,t 0 Z22,t 0 Z32,t Z41,t Z51,t
Comparing (4.7.14) with (4.7.21), one obtains:
X̄t Ξ = Zt (4.7.23)
Therefore, the series of matrices Ξ must be defined so that (4.7.23) holds. For the VAR model used
as an example, the series of matrices Ξ1 , Ξ2 , Ξ3 , Ξ4 and Ξ5 must be defined as:
1
9
v
1
09 v
3
09 v
5
v
6
19 v1 09 0 v4 v v
Ξ1 = Ξ3 = 9 Ξ4 = 5 Ξ5 = 6
Ξ2 = (4.7.24)
19 09 v2 v3 09 v5 v6
19 09 v2 09 v4 v5 v6
157
4. Bayesian Panel VARs
Where 1n and 0n respectively denote a n×1 vector of ones and zeros, and v1 , v2 , v3 and v4 are defined
as:
1
0
1
0
1
0
1 0 0 1 1 0
0 1 1 0 1 0
0 1 0 1 1 0
v1 = 1 v2 = 0 v3 = 1 v4 = 0 v5 = 0 v6 = 0 (4.7.25)
1 0 0 1 0 0
0 1 1 0 0 0
0 1 0 1 0 0
0 0 0 0 0 1
Hence:
1
9
v1 09 v3 09 v5 v6
19 v1 09 09 v4 v5 v6
Ξ= (4.7.26)
19 09 v2 v3 09 v5 v6
19 09 v2 09 v4 v5 v6
Using (4.7.8), It can be readily verified that:
X̄t Ξ
= (I4 ⊗ Xt ) Ξ
= I4 ⊗ y11,t−1 y12,t−1 y21,t−1 y22,t−1 y11,t−2 y12,t−2 y21,t−2 y22,t−2 x1,t
1
9
v1 09 v3 09 v5 v6
19 v1 09 09 v4 v5 v6
×
19 09 v2 v3 09 v5 v6
19 09 v2 09 v4 v5 v6
Z
11,t
Z21,t 0 Z31,t 0 Z41,t Z51,t
Z11,t Z21,t 0 0 Z32,t Z41,t Z51,t
=
Z11,t 0 Z22,t Z31,t 0 Z41,t Z51,t
Z11,t 0 Z22,t 0 Z32,t Z41,t Z51,t
= Zt (4.7.27)
The procedure can then be extended to any VAR model with an arbitrary number of units, lags,
endogenous and exogenous variables.
This concludes the description of the factor approach. Because X̃t can be computed for each period
158
4. Bayesian Panel VARs
t once Ξ is defined, it is possible to stack (4.7.14) over the T periods and estimate the model directly
by OLS methods. From a Bayesian perspective, the objective is to recover the posterior distribution
for the three parameters of interest: θ, Σ̃ and σ. Once this is done, it is possible to draw values for
θ, and thus to recover draws for β from (4.7.13). Also, combining a draw for Σ̃ with a draw for σ,
one may recover a draw for Σ. This allows to recover draws from the original model (4.7.7).
To compute the posterior distribution, obtain first an expression for Bayes rule. Relying on a stan-
dard independence assumption between θ, Σ̃ and σ, 1.2.5 yields:
π(θ, Σ̃, σ |y ) ∝ f (y θ, σ, Σ̃)π(θ)π(Σ̃)π(σ) (4.7.28)
by π(θ)π(σ) and π(Σ̃). Start with the likelihood function. Given (4.7.9), it is given by:
T
1
−T /2 Y
,
−T N n/2
f (y θ, Σ̃, σ) ∝ (σ) Σ̃ exp − σ −1 (yt −1
− X̃t θ) Σ̃ (yt − X̃t θ) (4.7.29)
t=1 2
Consider next the prior distributions for θ, Σ̃ and σ. The prior for θ is a multivariate normal
distribution with mean θ0 and covariance Θ0 :
1
π(θ |θ0 , Θ0 ) ∝ exp − (θ − θ0 ), Θ−1
0 (θ − θ0 ) (4.7.30)
2
Because there is no obvious identification strategies for θ0 and Θ0 , one simply sets θ0 as a vector of
zeros while Θ0 is set as a diagonal matrix with large values to produce an uninformative prior. For
Σ̃, an uninformative (diffuse) prior is used:
−(N n+1)/2
π(Σ̃) ∝ Σ̃ (4.7.31)
α0 δ0
Finally, as already stated,σ follows an inverse Gamma distribution with shape 2
and scale 2
:
!
−
α0
−1 −δ0
π(σ) ∝ σ 2 exp (4.7.32)
2σ
Using Bayes rule (4.7.28), and combining the likelihood (4.7.29) with the priors (4.7.30), (4.7.31)
159
4. Bayesian Panel VARs
T
!
1 −δ0
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
Y
f (θ, Σ̃, σ |y) ∝ × exp
t=1 2 2σ
1
−(T +N n+1)/2
×(σ)−(N nT +α0 )/2−1 × Σ̃ × exp − (θ − θ0 ), Θ−1 (θ − θ )
0 0
2
(4.7.33)
As often, the parameters are so interwoven that it is not possible to integrate out the posterior
distributions analytically. One has then to turn to numerical methods. Obtain first the conditional
posterior distributions for θ, Σ̃ and σ. For the conditional posterior of θ, start from (4.7.33) and
relegate any term not involving θ to the proportionality constant. Then, rearranging, one obtains:
1
,
π(θ y, σ, Σ̃) ∝ exp − (θ − θ̄) Θ̄−1 (θ − θ̄) (4.7.34)
2
with:
−1
Θ̄ = X̃IΣ X̃ , + Θ−1
0 (4.7.35)
and
θ̄ = Θ̄ X̃IΣ y + Θ−1
0 θ0 (4.7.36)
with:
Σ−1 0 · · · 0 y
1
−1
0
Σ−1 0
y2
X̃ = X̃1, X̃2, · · · X̃T,
IΣ = (IT ⊗ Σ ) = .
.. .. y=
.. (4.7.37)
.. . . .
| {z }
d×N nT
0 0 · · · Σ−1 yT
| {z } | {z }
N nT ×N nT N nT ×1
This is the kernel of a multivariate normal distribution with mean θ̄ and covariance matrix Θ̄:
π(θ y, σ, Σ̃) ∼ N (θ̄, Θ̄) (4.7.38)
Then obtain the conditional posterior for Σ̃. Relegating to the proportionality constant any term
not involving Σ̃ in (4.7.33) and rearranging, one obtains:
1 n
−(T +N n+1)/2 o
π(Σ̃ |y, θ, σ ) ∝ Σ̃ exp − tr Σ̃−1 S̄ (4.7.39)
2
with:
,
S̄ = σ −1 Y − ẌIθ Y − ẌIθ (4.7.40)
160
4. Bayesian Panel VARs
where:
θ 0 ··· 0
0 θ 0
Y = y1 y2 · · · yT Ẍ = X̃1 X̃2 · · · X̃T Iθ = (IT ⊗ θ) =
.. .. (4.7.41)
..
| {z } | {z } . . .
N n×T
N n×T d
0 0 ··· θ
| {z }
T d×T
This is the kernel of an inverse Wishart distribution with scale S̄ and T degrees of freedom:
Finally, obtain the conditional posterior for σ. Relegating to the proportionality constant any term
not involving σ in (4.7.33), then rearranging, one obtains:
!
− ᾱ −1 δ̄
π(σ y, θ, Σ̃) ∝ (σ) 2 exp − (4.7.43)
2σ
with:
ᾱ = N nT + α0 (4.7.44)
and:
h i
δ̄ = tr (Y − ẌIθ )(Y − ẌIθ ), Σ̃−1 + δ0 (4.7.45)
ᾱ
This is the kernel of an inverse Gamma distribution with shape 2
and scale 2δ̄ :
!
ᾱ δ̄
π(σt y, θ, Σ̃) ∼ IG , (4.7.46)
2 2
With these elements at hand, it is eventually possible to derive the Gibbs sampling algorithm for the
posterior distribution of the full model:
Algorithm 4.7.1 (Gibbs sampling algorithm for a panel VAR model with a factor approach):
1. Define starting values θ(0) , Σ̃(0) and σ (0) . For θ(0) , use the OLS value θ̂. For Σ̃(0) , use (4.7.14)
T
to obtain εt = yt − X̃t θ̂, and obtain Σ̃(0) = 1/T εt ε,t . For σ (0) , the value is set to 1 , which
P
t=1
(0) −1 (0)
implies Σ(0) = Σ̃(0) . Then compute IΣ = IT ⊗ (Σ(0) ) and Iθ = IT ⊗ θ(0) .
2. At iteration n, draw Σ̃(n) from π Σ̃(n) y, θ(n−1) , σ (n−1) ∼ IW (S̄, T ), with:
−1 (n−1) ,
(n−1)
S̄ = (σ (n−1) ) Y − ẌIθ Y − ẌIθ
161
4. Bayesian Panel VARs
ᾱ δ̄
3. At iteration n, draw σ (n) from π σ (n) y, θ(n−1) , Σ̃(n) ∼ IG ,
2 2
, with:
ᾱ = N nT + α0
and:
h
(n−1) (n−1) , −1 i
δ̄ = tr (Y − ẌIθ )(Y − ẌIθ ) (Σ̃(n) ) + δ0
(n) −1
4. At iteration n, compute Σ(n) = σ (n) Σ̃(n) , and use it to compute IΣ = IT ⊗ (Σ(n) ) .
(n)
5. At iteration n, draw θ(n) from π θ(n) y, σ (n) , Σ̃ ∼ N (θ̄, Θ̄), with:
−1
(n)
Θ̄ = X̃IΣ X̃ , + Θ−1
0
and
−1
(n)
θ̄ = Θ̄ X̃IΣ y + Θ−1
0 θ0
(n)
6. At iteration n, compute Iθ = IT ⊗ θ(n) .
Start again from the general formulation 4.1.5, but do not relax dynamic heterogeneity. The dynamic
equation for the model at period t is then given by:
162
4. Bayesian Panel VARs
Take transpose:
,
yt, = (A1t ) yt−1
,
+ · · · + (Apt ), yt−p
,
+ (Ct ), x,t + ε,t (4.8.2)
,
(A1 )
t
.
..
yt, = yt−1
, ,
· · · yt−p x,t
,
p , + εt
(4.8.3)
(At )
(Ct ),
or:
yt, = Xt Bt + ε,t (4.8.4)
with:
,
(A1 )
t
..
,
,
.
Xt = yt−1 · · · yt−p x,t Bt =
p ,
(4.8.5)
| {z } (At )
1×k
(Ct ),
| {z }
k×N n
or:
yt = X̄t βt + εt (4.8.7)
with:
X̄t = (IN n ⊗ Xt ) βt = vec(Bt ) (4.8.8)
| {z } | {z }
N n×h h×1
A general form of heteroskedasticity is introduced for the error. Precisely, it is assumed that the
error term is independently distributed across periods according to:
163
4. Bayesian Panel VARs
Hence:
Σ̃11 Σ̃12 · · · Σ̃1N
|{z}
n×n
Σt = E (εt ε,t ) = exp(ζt )Σ̃ =
exp(ζt ) Σ̃21 Σ̃22 ··· Σ̃2N
(4.8.10)
| {z } .. .. .. ..
. . . .
1×1
Σ̃N 1 Σ̃N 2 · · · Σ̃N N
| {z }
N n×N n
ζt = γζt−1 + υt (4.8.11)
υt ∼ N (0, ϕ) (4.8.12)
The initial value of the process ζ0 is set to be 0 with a variance of ϕ, in order to imply initial
homoscedasticity. A final layer of uncertainty is integrated by assuming that ϕ is also a random
variable, which follows an inverse Gamma distribution:
!
α0 δ0
ϕ ∼ IG , (4.8.13)
2 2
Note the implications of the setting. Thanks to (4.8.11), heteroskedasticity is modelled in a flexible
fashion: when γ = 0, ζt is determined by a white noise process, so that the residuals are heteroskedas-
tic in a purely random way. When 0 < γ < 1, the model allows for inertia in heteroskedasticity which
then resembles that of a traditional ARCH model. Finally, when γ = 1 the residual follow a random
walk form of heteroskedasticity, implying permanent jumps on the volatility of the disturbances. The
random variable ϕ determines if there exists heteroskedasticity altogether: a value of 0 implies that
all υt shocks endorse the mean value of 0, so that exp(ζt ) = 1 for all t and the model is homoscedastic.
Then the larger ϕ, the larger the disturbance volatility implied by the setting.
This basically concludes the description of the model. (4.8.7) is a standard linear model which
suffers however from the same curse of dimensionality issue than its static counterpart. The problem
is actually made even worse in a time-varying context: because the model is period-specific, there
are h = N n(N np + m) coefficients to estimate, but only N n data points available. This renders
estimation impossible with classical methods. Canova and Ciccarelli (2013) thus propose to adopt
a structural factor approach similar to that developed in the previous subsection. Concretely, the
164
4. Bayesian Panel VARs
Once again, θ1,t , θ2,t , ..., θr,t are vectors of dimension d1 ×1, d2 ×1, · · · , dr ×1 containing the structural
factors, while Ξ1 , Ξ2 , · · · , Ξr are selection matrices of dimension h × d1 , h × d2 , · · · , h × dr with all
their entries being either 0 or 1 picking the relevant elements in θ1,t , θ2,t , · · · , θr,t . Unlike the static
version of the model, all the factors are now allowed to be time-varying. A compact form of the
factor decomposition can be obtained as:
βt = Ξθt (4.8.15)
with:
θ
1,t
θ2,t
Ξ = Ξ1 Ξ2 · · · Ξr and θt = .
(4.8.16)
..
| {z }
h×d
θr,t
| {z }
d×1
yt = X̄t βt + εt
r
!
X
= X̄t Ξi θi,t + εt
i=1
r
!
X
= X̄t Ξi θi,t + εt
i=1
r
X
= X̄t Ξi θi,t + εt
i=1
or:
yt = X̃1,t θ1,t + X̃2,t θ2,t + · · · + X̃r,t θr,t + εt (4.8.17)
with:
X̃i,t = X̄t Ξi , i = 1, 2, · · · , r (4.8.18)
yt = X̃t θt + εt (4.8.19)
with:
X̃t = X̄t Ξ (4.8.20)
165
4. Bayesian Panel VARs
Finally, define the law of motion of θt . A simple form is the general autoregressive process:
with:
ηt ∼ N (0, B) (4.8.22)
0 ≤ ρ ≤ 1 determines the persistence of the process, while the constant term θ̄ represents the long-
run value of the model. This form is flexible and allows for many particular representations . For
instance, a common special case nested in this general specification is the random walk, corresponding
to ρ = 1:
θt = θt−1 + ηt (4.8.23)
B is a block diagonal matrix for which each block i = 1, 2, · · · , r corresponds to one of the r structural
factors and is of dimension di . It is defined as:
B1 0 ··· 0 b1 Id1 0 ··· 0
. .. .. ..
B2 . .
0 . 0 b2 Id2 . .
B= = (4.8.24)
.. .. .. .. .. ..
. . . 0
. . . 0
0 ··· 0 Br 0 ··· 0 br Idr
This concludes the time varying factor approach. The models comprises 5 sets of parameters of inter-
est to be estimated: the factor coefficients θ = {θt }Tt=1 , the set of VAR coefficient variances b = {bi }ri=1 ,
the homoskedastic residual covariance matrix Σ̃, the set of dynamic coefficients ζ = {ζt }Tt=1 , and the
heteroskedasticity variance coefficient ϕ. The considered setting is hierarchical, since θ is obtained
conditional on b, and ζ obtains conditional on ϕ.
Obtaining the prior for θ = {θt }Tt=1 is troublesome since (4.8.21) implies that each term depends
on the previous period value θt−1 . The strategy to obtain a simple joint formulation relies on the
sparse matrix approach by Chan and Jeliazkov (2009)2 . It essentially consists in noticing that every
value θt ultimately depends on the initial condition θ0 , the long-run value θ̄, and the set of shocks
ηt , t = 1, 2, · · · , T . (4.8.21) can be reformulated for all the periods simultaneously as:
HΘ = Θ̃ + η (4.8.25)
2
The authors are grateful to Aubrey Poon (Australian National University) and Matteo Ciccarelli (European
Central Bank) for suggesting this approach.
166
4. Bayesian Panel VARs
with:
Id 0 0 ··· 0 θ
1
−ρId Id 0 ··· 0
θ2
..
H=
0 −ρId Id . θ3
Θ=
. ..
. .. ..
.
. . . 0
0 ··· 0 −ρId Id θT
| {z } | {z }
T d×T d T d×1
(1 − ρ)θ̄ + ρθ0 η
1
(1 − ρ)θ̄ η2
Θ̃ = (1 − ρ)θ̄ η = η3 (4.8.26)
..
..
. .
(1 − ρ)θ̄ ηT
| {z } | {z }
T d×1 T d×1
And from B.9, (4.8.27) and (4.8.28), one can eventually conclude that:
,
Θ ∼ N (H −1 Θ̃, H −1 B̃(H −1 ) ) or Θ ∼ N (Θ0 , B0 ) (4.8.29)
with:
,
Θ0 = H −1 Θ̃ and B0 = H −1 B̃(H −1 ) (4.8.30)
Thus the prior distribution for the whole series θ = {θt }Tt=1 can be expressed in stacked form as:
1
π(θ |b ) ∝ |B0 | exp − (Θ − Θ0 ), B0−1 (Θ − Θ0 ) (4.8.31)
2
It remains to determine the values for θ0 and θ̄. These two values are set as the OLS estimate of the
static version of (4.8.19).
167
4. Bayesian Panel VARs
a0 b0
The prior distribution for each bi is inverse Gamma with scale 2
and shape 2
:
!
−(
a0
)−1 −b0
π (bi |a0 , b0 ) ∝ bi 2
exp (4.8.32)
2bi
The prior for ζ = {ζt }Tt=1 faces the same dynamic dependence as θ, so that the same identification
strategy is retained. Reformulate (4.8.11) simultaneously for all periods as:
GZ = υ (4.8.34)
with:
1 0 0 · · · 0 ζ υ
1 1
−γ 1 0 · · · 0
ζ2 υ2
..
G=
0 −γ 1 . Z = ζ3 υ = υ3 (4.8.35)
. .. ..
. ... ... . .
. 0
0 · · · 0 −γ 1 ζT υT
| {z } | {z } | {z }
T ×T T ×1 T ×1
where use has been made of the fact that ζ0 = 0. Assuming independence between the errors υt , it
follows from (4.8.12) that:
υ ∼ N (0, ϕIT ) (4.8.36)
Then (4.8.34) implies that Z = G−1 υ, and from (A.2.5) one concludes that:
,
Z ∼ N (0, G−1 ϕIT (G−1 ) ) (4.8.37)
or:
Z ∼ N (0, Φ0 ) with Φ0 = ϕ(G, G)−1 (4.8.38)
The prior distribution for the whole series ζ = {ζt }Tt=1 can thus be expressed in stacked form as:
1
π(Z |ϕ) ∝ |Φ0 |−1/2 exp − Z , Φ−1
0 Z (4.8.39)
2
168
4. Bayesian Panel VARs
This formulation will prove useful to derive the conditional posterior distribution of ϕ. For the
conditional posterior of the individual components of ζ = {ζt }Tt=1 however, this formulation will
prove unsuitable. It is then preferable to adopt a period-by-period approach. Using conditional
densities, it is easy to show that the joint density π(Z |ϕ) can be rewritten as:
T
Y
π(Z |ϕ) ∝ π(ζt |ζt−1 , ϕ) (4.8.40)
t=1
To obtain the posterior distribution, obtain first an expression for Bayes rule. Relying on a standard
independence assumption between θ, Σ and ζ, and following the hierarchical setting described in
subsection 1.2 one obtains:
π(θ, b, Σ̃, ζ, ϕ |y ) ∝ f (y θ, Σ̃, ζ )π(θ |b)π(b)π(Σ̃)π(ζ |ϕ )π(ϕ) (4.8.43)
Given (4.8.9) and (4.8.19), the likelihood function π(y |θ, Σ, ζ ) is given by:
T n
!
−T /2 1X ,
o
f (y θ, Σ̃, ζ) ∝ Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt (4.8.44)
2 t=1
169
4. Bayesian Panel VARs
From Bayes rule (4.8.43), the likelihood (4.8.44) and the priors (4.8.31), (4.8.32), (4.8.33), (4.8.39)
and (4.8.42), one can derive the full posterior distribution:
T n
!
−T /2 1X ,
o
π(θ, b, Σ̃, ζ, ϕ |y ) ∝Σ̃
exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2 t=1
1
, −1
× |B0 | exp − (Θ − Θ0 ) B0 (Θ − Θ0 )
2
r
!
Y −(a0 /2)−1 −b0
× bi exp
i=1 2bi
−(N n+1)/2
×Σ̃
1
×|Φ0 |−1/2 exp − Z , Φ−1 Z
2 !0
−δ0
×ϕ−α0 /2−1 exp (4.8.45)
2ϕ
The complexity of the formula makes any analytical marginalisation intractable, so that one relies
as usual on the numerical framework provided by the Gibbs sampler.
Obtain the full set of conditional posterior distributions. Derive first the conditional posterior for
θ = {θt }Tt=1 . Given Bayes rule (4.8.43), relegate to the proportionality constant any term that does
not involve θ to obtain:
π(θ y, b, Σ̃, ζ, ϕ) ∝ f (y θ, Σ̃, ζ )π(θ |b) (4.8.46)
However, because the prior for θ is formulated in terms of Θ (defined in (4.8.26)), the likelihood
must also be reformulated in terms of Θ in order to derive the posterior. This can be done easily by
considering a stacked form of (4.8.19):
y = X̃Θ + ε (4.8.47)
with:
y X̃ 0 ··· 0 ε
1 1 1
y2 0 X̃2 ε2
y=
..
X̃ =
.. .. .. ε=
..
(4.8.48)
. . . . .
yT 0 · · · X̃T εT
| {z } | {z } | {z }
N nT ×1 N nT ×T d N nT ×1
170
4. Bayesian Panel VARs
Also, from (4.8.9), the error terms εt are independently distributed so that:
Σ 0 ··· 0
1
0 Σ2
ε ∼ N (0, Σ) with Σ=
.. .. .. (4.8.49)
. . .
0 · · · ΣT
| {z }
N nT ×N nT
The likelihood function for the full model may then rewrite as:
1
,
−1/2
f (y Θ, Σ̃, ζ) ∝ |Σ| exp − (y − X̃Θ) Σ−1 (y − X̃Θ) (4.8.50)
2
From (4.8.46), one combines the likelihood (4.8.50) with the prior (4.8.31), and rearranges to obtain:
1
,
π(θ y, b, Σ̃, ζ, ϕ) ∝ exp − (Θ − Θ̄) B̄ −1 (Θ − Θ̄) (4.8.51)
2
with:
−1
B̄ = X̃ , Σ−1 X̃ + B0−1 (4.8.52)
and:
Θ̄ = B̄ X̃ , Σ−1 y + B0−1 Θ0 (4.8.53)
This is the kernel of a multivariate normal distribution with mean Θ̄ and covariance B̄:
Obtain then the conditional posterior for b = {bi }ri=1 . Because the bi s are conditionally indepen-
dent, the posteriors can be derived individually. Using Bayes rule (4.8.43) and relegating to the
proportionality constant any term not involving bi yields:
Using (4.8.55) to combine (4.8.22)-(4.8.23) with (4.8.32) and then rearranging eventually yields:
!
−
āi
−1 b̄i
π(bi |y, θ, b−i , Σ̃, ζ, ϕ) ∝ bi 2
exp − (4.8.56)
2bi
with:
āi = T di + a0 (4.8.57)
171
4. Bayesian Panel VARs
and:
T
(θi,t − θi,t−1 ), (θi,t − θi,t−1 ) + b0
X
b̄i = (4.8.58)
t=1
ā
This is the kernel of an inverse Gamma distribution with shape 2
and scale 2b̄ :
!
āi b̄i
π(bi |y, θ, b−i , Σ̃, ζ, ϕ) ∼ IG , (4.8.59)
2 2
Obtain the conditional posterior for Σ̃. Starting from Bayes rule (4.8.43) and relegating to the
proportionality constant any term not involving Σ̃, one obtains:
1 n
−(T +N n+1)/2 o
π(Σ̃ |y, θ, b, ζ, ϕ) ∝ Σ̃ exp − tr Σ̃−1 S̄ (4.8.61)
2
with:
T
X ,
S̄ = (yt − X̃t θt ) exp(−ζt )(yt − X̃t θt ) (4.8.62)
t=1
This the kernel of an inverse Wishart distribution with scale S̄ and degrees of freedom T :
Compute the conditional posterior for ϕ. Starting from Bayes rule (4.8.43) and relegating to the
proportionality constant any term not involving ϕ yields:
π(ϕ y, θ, b, Σ̃, ζ ) ∝ π(ζ |ϕ )π(ϕ) (4.8.64)
with:
ᾱ = T + α0 (4.8.66)
and:
δ̄ = Z , G, GZ + δ0 (4.8.67)
172
4. Bayesian Panel VARs
ᾱ
This is the kernel of an inverse Gamma distribution with scale 2
and shape 2δ̄ :
!
ᾱ δ̄
π(ϕ y, θ, b, Σ̃, ζ ) ∼ IG , (4.8.68)
2 2
Obtain finally the conditional posterior for each term ζt . Consider Bayes rule (4.8.43) and the
reformulated prior 4.8.40, then relegate to the proportionality constant any term not involving ζt :
π(ζt y, θ, b, Σ̃, ϕ) ∝ f (y θ, Σ̃, ζ )π(ζt |ζt−1 , ϕ)π(ζt+1 |ζt , ϕ) (4.8.69)
1n
o
,
∝ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2( )!
1 (ζt − ζ̄)2
× exp − (4.8.70)
2 ϕ̄
with:
ϕ
ϕ̄ = (4.8.71)
1 + γ2
and:
γ(ζt−1 + ζt+1 )
ζ̄ = ϕ̄ (4.8.72)
ϕ
and slightly different values of ϕ̄ and ζ̄ when t = T (see Appendix).
(Q.31) is problematic: it does not correspond to a known distribution. Because its form is non-
standard, it is not possible to sample directly from it, which renders the Gibbs sampler methodology
inapplicable. There exists a solution to solve this issue, but this comes at the cost of additional tech-
nical complications. The methodology to be used in this case is known as the Metropolis-Hastings
algorithm, and it can be shown to be a generalisation of the Gibbs sampler, applicable even in cases
where the posterior distribution takes an unknown form. The technical details behind the method-
ology are beyond the scope of this manual so that only the principles will be introduced3 .
The idea of the Metropolis-Hastings methodology is the following: while for the Gibbs sampler
a new draw from the conditional distribution was obtained and accepted at every iteration of the
algorithm, with the Metropolis-Hastings algorithm a new draw will only be accepted with a certain
3
Readers interested in a more formal treatment may find valuable content in Greenberg (2008), chapters 6 and 7,
and Chib and Greenberg (1995).
173
4. Bayesian Panel VARs
Concretely, the algorithm works as follows: consider any parameter θ for which one wants to obtain
draws from the posterior distribution. The analytical formula π(θ) corresponding to the posterior
distribution is identified so that one can calculate the density value (as in the case of (4.8.71)), but
this formula does not correspond to a known distribution, so that it is not possible to sample di-
rectly from π(θ). One has then to define what is known as a transition kernel q(θ(n−1) , θ(n) ), which
is a distribution establishing how to obtain at iteration n a value θ(n) from the previous iteration
value θ(n−1) . Since many distributions can be used as a possible transition kernel, the choice has to
be made based on convenience. Finally, given π(θ) and q(θ(n−1) , θ(n) ), one has to define a function
α(θ(n−1) , θ(n) ) which determines the probability that the draw obtained in the current iteration will
be accepted. This function is always the same and given by:
n (n) (n) (n−1) )
o
min 1, π(θ )q(θ ,θ if π(θ(n) )q(θ(n) , θ(n−1) ) 6= 0
π(θ(n−1) )q(θ(n−1) ,θ(n) )
α(θ(n−1) , θ(n) ) = (4.8.73)
0 otherwise
It can then be shown that given the chosen transition kernel q(θ(n−1) , θ(n) ), the distribution obtained
from α(θ(n−1) , θ(n) ) corresponds to the unconditional posterior distribution for θ. The Gibbs sampler
can thus be seen as a special case of the Metropolis-Hastings algorithm where the acceptance prob-
ability α(θ(n−1) , θ(n) ) for the current draw is always equal to 1. The general algorithm then goes as
follows:
3. Start iterating over θ values: at iteration n, obtain a candidate value θ̃ from the transition
kernel q(θ(n−1) , θ(n) ).
6. If x ≤ α(θ(n−1) , θ(n) ), then the draw is accepted: define θ(n) = θ̃. If x > α(θ(n−1) , θ(n) ), the draw
is rejected, keep the former value: define θ(n) = θ(n−1) .
7. Return to step 3 and repeat until the desired number of iterations is realised.
174
4. Bayesian Panel VARs
The Metropolis-Hastings algorithm can be integrated to a wider setting. If there are several blocks
of parameters (for instance, in the present model: θ, b, Σ̃ and ϕ in addition to ζ), it is possible to run
the Metropolis-Hastings only for the blocks characterised by posterior distributions with unknown
forms. For the blocks with known forms, a standard Gibbs sampling approach can be applied. All
the draws, from the Gibbs sampler or from the Metropolis-Hastings algorithm, have to be realised
conditional on the other block values.
The final question is then the determination of the transition kernel q(θ(n−1) , θ(n) ). Ideally, a good
kernel should allow for sufficient variability in the value of θ between two iterations. This ensures that
a large part of the support of π(θ) will be covered by the iterations of the algorithm, which improves
the mixing between iterations and the quality of the posterior. However, larger differences between
θ(n) and θ(n−1) typically imply larger differences between π(θ(n) ) and π(θ(n−1) ), which increases the
probability of rejection from (4.8.73). Then some values may be repeated often and the algorithm
may perform poorly. The kernel must thus be chosen to generate the most efficient compromise
between these two aspects.
with ω an error term with a known distribution. Another common choice is the independent kernel,
defined as:
θ(n) = θ (4.8.75)
with θ some random variable with known distribution. In this case, at every iteration n a value θ(n)
is sampled directly from the candidate distribution, independently of the previous value θ(n−1) , hence
the name independent kernel.
The independent kernel is retained as the transition kernel for the present model. The question is
then which distribution should be used to sample the candidate values. Looking at Q.31, it appears
immediately that the second row is the kernel of a normal distribution with mean ζ̄ and variance ϕ̄.
A natural strategy then consists in using N (ζ̄, ϕ̄) as the independent kernel. With this choice for the
175
4. Bayesian Panel VARs
This completes the derivations of the model. It is finally possible to derive the full algorithm for the
posterior distribution:
2. At iteration n, draw Σ̃(n) from π(Σ̃(n) |y , θ(n−1) , b(n−1) , ζ (n−1) , ϕ(n−1) ) ∼ IW (S̄, T ), with:
T (n−1) (n−1) (n−1) ,
(yt − X̃t θt )(yt − X̃t θt
P
S̄ = ) exp(−ζt )
t=1
(n)
3. At iteration n, draw ζt , t = 1, · · · , T by using the Metropolis-Hastings algorithm (4.8.1). The
candidate is drawn from:
(n)
ζt ∼ N (ζ̄, ϕ̄) with:
ϕ
ϕ̄ = 1+γ 2
and
ζ̄ = ϕ̄ γ(ζt−1ϕ+ζt+1 )
And the acceptance function is:
176
4. Bayesian Panel VARs
4. At iteration n, draw ϕ(n) from π(ϕ(n) y, θ(n−1) , b(n−1) , Σ̃(n) , ζ (n) ) ∼ IG( ᾱ2 , 2δ̄ ), with:
ᾱ = T + α0
and:
,
δ̄ = (Z (n) ) G, GZ (n) + δ0
(n) r
n o
5. At iteration n, draw b(n) = bi from π(bi y, θ(n−1) , Σ̃(n) , ζ (n) , ϕ(n) ) ∼ IG( ā2i , b̄2i ), with:
i=1
āi = T di + a0
and:
T (n−1) (n−1) , (n−1) (n−1)
(θi,t − θi,t−1 ) (θi,t − θi,t−1 ) + b0
P
b̄i =
t=1
(n) T
n o
6. At iteration n, draw θ(n) = θt from π(θ y, b(n) , Σ̃(n) , ζ (n) , ϕ(n) ) ∼ N (Θ̄, B̄), with:
−1 t=1
,
B̄ = X̃ Σ X̃ + −1
B0−1
and:
Θ̄ = B̄ X̃ , Σ−1 y + B0−1 Θ0
where:
(n)
exp(ζ1 )Σ̃(n) 0 ··· 0
(n) (n)
0 exp(ζ2 )Σ̃
Σ= .. .. ..
. . .
(n)
0 · · · exp(ζT )Σ̃(n)
and
,
B0 = H −1 IT ⊗ B (n) (H −1 )
177
4. Bayesian Panel VARs
units are interacting is estimated. As all these models are of standard form, producing forecasts can
be realised by direct application of the forecast algorithm 2.1.1 for regular Bayesian VAR models,
and the presentation will not enter into further details.
The case of the dynamic factor model however is more complicated. In this case, it is not pos-
sible to apply naively the methodology proposed for a static model since the usual methodology
ignores the possibility that the VAR coefficients and residual covariance matrix may evolve across
time. It is however possible to extend directly the static approach to time-varying models by inte-
grating the laws of motion for the parameters into the sampling process. The equations of interest
for the time-varying factor approach are stated again for the sake of convenience:
yt = X̄t βt + εt (4.9.1)
βt = Ξθt (4.9.4)
Σ̃, ϕ and B are static parameters for which posterior draws have been obtained from the Gibbs sam-
pling process. The trick then consists in noticing that thanks to ϕ and B it is possible to draw series
of disturbances υt and ηt for any forecast period, and then to use the laws of motion (4.9.3) and
(4.9.5) to evaluate sequentially ζT +1 , ..., ζT +h and θT +1 , ..., θT +h . Concretely, the following adaptation
of algorithm 2.1.1 to dynamic models is developed:
Algorithm 4.9.1 (forecasts with a panel VAR model (dynamic factor approach):
1. define the number of iterations (It − Bu) of the algorithm, and the forecast horizon h.
3. at iteration n, draw Σ(n) from its posterior distributions. To do so, recycle draw n from the
Gibbs sampler.
4. at iteration n, draw ϕ(n) from its posterior distributions. To do so, recycle draw n from
(n) (n)
the Gibbs sampler. Then draw υT +1 from υT +1 ∼ N (0, ϕ(n) ). Finally, obtain ζT +1 from
(n) (n) (n)
ζT +1 = γζT + υT +1 .
(n) (n) (n)
5. obtain ΣT +1 = exp(ζT +1 )Σ̃(n) . Draw the simulated residual ε̃T +1 .
178
4. Bayesian Panel VARs
6. at iteration n, draw B(n) from its posterior distributions. To do so, recycle draw n from
(n) (n) (n)
the Gibbs sampler. Then draw ηT +1 from ηT +1 ∼ N (0, B(n) ). Finally, obtain θT +1 from
(n) (n) (n)
θT +1 = (1 − ρ)θ̄ + ρθT + ηT +1 .
(n) (n)
7. at iteration n, obtain βT +1 = ΞθT +1 .
(n) (n) (n)
8. at iteration n, obtain yT +1 = X̄T +1 βT +1 + εT +1
10. repeat steps 2-10 until (It − Bu) iterations are realised. This produces:
n oIt−Bu
(n) (n) (n)
ỹT +1 |yT , ỹT +2 |yT , ..., ỹT +h |yT
n=1
a sample of independent draws from the joint predictive distribution which can be used for
inference and computation of point estimates.
The logic for impulse response functions and forecast error variance decomposition is rigorously
similar to that of forecasts and is not developed further. In the case of impulse response functions
standard identification schemes apply. Two standard choices are the usual Choleski and triangular
factorisation.
179
4. Bayesian Panel VARs
For the present purpose, it is convenient to reformulate the model in companion form, that is, to
reformulate it as a VAR(1) model:
yt A1 A2t · · · Atp−1 Apt y C ε
t t−1 t t
yt−1
IN n
0 ··· 0 0 yt−2 0
0
..
.. ..
.
. = 0 IN n 0 .
0 . + . (xt ) + (4.10.2)
|{z} .
.. .. .. ..
yt+2−p . . . .
yt+1−p 0
m×1 0
yt+1−p 0 0 · · · IN n 0 yt−p 0 0
| {z } | {z }| {z } | {z } | {z }
N np×1 N np×N np N np×1 N np×m N np×1
or:
ȳt = At ȳt−1 + C̄t x̄t + ε̄t (4.10.3)
The advantage of formulation (4.10.3) over formulation (4.10.1) is that an AR(1) model makes it a
lot easier to solve for past values by backward substitution. Thus, use (4.10.3) to obtain a general
formulation for ȳt :
Note that similarly to 3.2.10, the first two terms represent the contribution of deterministic variables
(exogenous variables and initial conditions), while the final term represents the contribution of the
residuals:
t−1 t−1 i t−1 i
!
Y X Y X Y
ȳt = At−i ȳ0 + At+1−j C̄t−i x̄t−i + At+1−j ε̄t−i (4.10.5)
i=0 i=0 j=1 i=0 j=1
| {z } | {z }
historical contribution of deterministic variables historical contribution
of residuals
180
4. Bayesian Panel VARs
It is thus convenient to simplify (4.10.5) by defining the whole deterministic contribution as d¯(t) , and
then rewrite as:
t−1
¯(t)
X
ȳt = d + Ψ̄t,i ε̄t−i (4.10.6)
i=0
However, ȳt , d¯(t) and Ψ̄t,i represents elements of model (4.10.3), while what is of interest is the original
model (4.10.1). In order to recover the original elements, use the following selection matrix:
J = IN n 0 0 · · · 0 (4.10.7)
| {z }
N n×N np
Therefore, premultiplying both sides of (4.10.6) by J and manipulating, this rewrites as:
Also, using the period-specific structural matrix Dt , recovered from the period-specific residual co-
variance matrix Σt , one obtains:
This formulation is similar to 3.2.11, except for the facts that the impulse response functions are
now period-specific. (4.10.12) can thus be used to recover the historical decomposition in a standard
way, simply accounting for time-specificity. The following algorithm is thus proposed:
Algorithm 4.10.1 (historical decomposition for the dynamic factor panel model):
1. define the number of iterations (It − Bu) of the algorithm. Then run the algorithm:
181
4. Bayesian Panel VARs
(n) (n)
2. At iteration n, draw θt and Σt from their posterior distributions, for t = 1, 2, · · · , T . Simply
recycle draws from the Gibbs sampler.
(n) (n) (n)
3. Recover βt from βt = Ξθt , and use it to obtain At from (4.10.2), for t = 1, 2, · · · , T .
!
i
At+1−j J , , for t = 1, 2, · · · , T .
Q
4. Calculate Ψt,i = J
j=1
5. Obtain the structural matrix Dt from Σt , and compute Ψ̃t,i = Ψt,i Dt , for t = 1, 2, · · · , T .
or:
ȳt = At ȳt−1 + C̄t x̄t + ε̄t (4.11.3)
182
4. Bayesian Panel VARs
Then consider forecasting for period T +h. Rather than iterating backward as in the case of historical
decomposition, forward iteration is used. Consider period T + 1:
The first two terms give the predicted values in the absence of shocks and hence represent the regular
forecasts. The final term represents the dynamic impact of past residuals at period T + h. It then
represents the series of impulse response functions specific to this period. Therefore, (4.11.7) can be
written as:
h h h−1 h h−1
!
Y X Y X Y
ȳT +h = At+1+h−i ȳT + AT +h+i−j C̄T +i x̄T +i + AT +h+i−j ε̄T +i (4.11.8)
i=1 i=1 j=i i=1 j=i
| {z } | {z }
Forecast in the absence of shocks Dynamic impact of residuals
or:
h
ȳT +h = ȳ˜T +h +
X
Ψ̄T +h,h−i ε̄T +i (4.11.9)
i=1
183
4. Bayesian Panel VARs
Because this formula provides values for ȳT +h , while only yT +h is of interest, define the selection
matrix:
J = IN n 0 0 · · · 0 (4.11.10)
| {z }
N n×N np
h
ȳT +h = ȳ˜T +h +
X
Ψ̄T +h,h−i ε̄T +i
i=1
h
⇔ J ȳT +h = J ȳ˜T +h + J Ψ̄T +h,h−i J , J ε̄T +i
X
i=1
h
X
⇔ yT +h = ỹT +h + ΨT +h,h−i εT +i (4.11.11)
i=1
Also, using the period-specific structural matrix DT +h , recovered from the period-specific residual
covariance matrix ΣT +h , one obtains:
h
X
yT +h = ỹT +h + Ψ̃T +h,h−i ηT +i (4.11.15)
i=1
It can be seen that (4.11.15) is similar to 3.4.1, save for the fact that the impulse response functions
are period-specific. Therefore, (4.11.15) can be used to recover conditional forecasts in a standard
way, simply accounting for time-specificity. The following algorithm is thus proposed:
184
4. Bayesian Panel VARs
Algorithm 4.11.1 (conditional forecasts for the dynamic factor panel model):
1. define the number of iterations (It − Bu) of the algorithm. Then run the algorithm:
(n) (n)
2. At iteration n, draw θT , ζT , Σ̃(n) and B (n) from their posterior distributions. Simply recycle
draws from the Gibbs sampler.
(n)
3. At iteration n, obtain recursively θT +i from:
(n) (n) (n) (n)
θT +i = (1 − ρ)θ̄ + ρθT +i−1 + ηT +i with: ηT +i ∼ N (0, B (n) ) , for i = 1, 2, . . . , h.
(n) (n) (n) (n)
4. At iteration n, obtain βT +i = ΞθT +i and use it to obtain AT +i and C̄T +i from (4.11.2), for
i = 1, 2, · · · , h.
(n)
5. At iteration
"
n, obtain the
!
unconditional forecast!ỹT +h from:#
(n) h
Q (n) Ph h−1
Q (n) (n)
ỹT +h = J At+1+h−i ȳT + AT +h+i−j C̄T +i x̄T +i
i=1 i=1 j=i
(n)
7. At iteration n, obtain recursively ζT +i from:
(n) (n) (n) (n)
ζT +i = γζT +i−1 + υT +i with υT +i ∼ N (0, ϕ(n) ) , for i = 1, 2, . . . , h
(n) (n) (n)
8. At iteration n, obtain ΣT +h = exp(ζT +h )Σ̃(n) , then obtain the structural matrix DT +h from
(n)
ΣT +h .
9. At iteration n, obtain the structural impulse response functions Ψ̃T +h,h−i from:
Ψ̃T +h,h−i = ΨT +h,h−i DT +h , for i = 1, 2, . . . , h
185
5. Bayesian VARs with stochastic volatility
The model includes n endogenous variables, m exogenous variables and p lags, and is estimated over
T time periods. In compact form, it writes:
εt ∼ N (0, Σt ) (5.1.3)
Unlike a traditional VAR, the residuals here are independently but not identically distributed across
time. Their variance-covariance matrix Σt is allowed to be period-specific, hence rendering volatility
stochastic and introducing heteroskedasticity.
yt = X̄t β + εt (5.1.4)
with:
186
5. Bayesian VARs with stochastic volatility
, , ,
X̄t = In ⊗ Xt , Xt = yt−1 yt−2 · · · yt−p x,t (5.1.5)
| {z } | {z }
n×n(np+m)
1×(np+m)
and:
A,1
,
A2
.
β = vec(B) , B = .. (5.1.6)
| {z }
,
n(np+m)×1 Ap
C,
| {z }
(np+m)×n
Σt = F Λt F , (5.2.1)
F is a lower triangular matrix with ones on its main diagonal, while Λt is a period-specific diagonal
matrix with diag(Λt ) = (s̄1 exp(λ1,t ), s̄2 exp(λ2,t ), · · · , s̄n exp(λn,t )). That is:
1 0 ··· ··· 0 s̄1 exp(λ1,t ) 0 ··· ··· 0
.. .. .. ..
. .
f21
1 .
0 s̄2 exp(λ2,t ) .
.. .. .. .. . ..
s̄3 exp(λ3,t ) . .
F = f
31 f32 1 . . Λt =
. . .
.. .. . . .. .. .. ..
. . . . 0 . . . 0
fn1 fn2 · · · fn(n−1) 1 0 ··· ··· 0 s̄n exp(λn,t )
| {z } | {z }
n×n n×n
(5.2.2)
s̄1 , s̄2 , · · · , s̄n are known scaling terms, while λ1,t , λ2,t , · · · , λn,t are dynamic processes generating the
heteroskedasticity of the model. Specifically, it is assumed that the λi,t terms are characterized by
the following autoregressive process:
where the shocks υi,t are i.i.d across periods t = 1, · · · , T . Note that from (2.5.1), representation
(5.2.1) ensures that Σt is uniquely identified.
187
5. Bayesian VARs with stochastic volatility
This concludes the presentation of the model. The parameters of interest to be estimated are: the
n o
VAR coefficients β; the elements f −1 = fi−1 : i = 2, · · · , n related to the F matrix (the notation
will become clear shortly); the set of dynamic coefficients λ = {λi,t : i = 1, · · · , n ; t = 1, · · · , T };
and the heteroskedasticity parameters φ = {φi : i = 1, · · · , n}.
Assuming independence between the parameters β, f −1 and λ, and relying on the hierarchical setting
introduced in section 1.2 to address the dependence between λ and φ, Bayes rule obtains as:
n n n
! ! !
π(β, f −1 , λ, φ|y) ∝ f (y|β, f −1 , λ)π(β) π(fi−1 )
Y Y Y
π(λi |φi ) π(φi ) (5.2.4)
i=2 i=1 i=1
with λi = {λi,t : t = 1, · · · , T }.
Given (5.1.3), (5.1.4) and (5.2.1), the likelihood function for the data is given by:
T
1
, −1/2 ,
−1
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
f (y|β, f , λ) ∝ |F Λt F | (5.2.5)
t=1 2
The priors for the parameters are set as follows. The prior for the VAR coefficients β is assumed to
be normal with prior mean β0 and covariance matrix Ω0 . Hence:
1
π(β) ∝ exp − (β − β0 ), Ω−1
0 (β − β0 ) (5.2.6)
2
β0 and Ω0 follow a classical Minnesota scheme, and are thus set according to (1.3.4)-(1.3.7).
The prior for the elements of F requires some reformulation: for reasons that will become clear
later, it is easier to work with the elements of F −1 rather than with those of F . The fact that F is
lower triangular with ones on its main diagonal implies by (A.22) that F −1 is also lower triangular
with ones on the main diagonal. That is:
1 0 ··· ··· 0
.. ..
−1
f21
1 . .
.. ..
F −1 =
f −1 −1
f32 1 . . (5.2.7)
31
.. .. ... ...
. . 0
−1 −1 −1
fn1 fn2 · · · fn(n−1) 1
| {z }
n×n
188
5. Bayesian VARs with stochastic volatility
1
,
π(fi−1 ) ∝ exp − fi−1 − fi0−1 Υ−1
i0 f −1
i − f −1
i0 i = 2, 3, · · · , n (5.2.8)
2
There are no obvious prior values for fi0−1 and Υi0 . It is thus simpler to let the data speak and use
a diffuse prior. Following, fi0−1 is set as a vector of zeros, while Υi0 is set as a diagonal matrix with
large diagonal entries.
The prior distributions π(λi |φi ) are not simple to formulate since (5.2.3) implies that each term
λi,t depends on the previous period value λi,t−1 . One solution is to formulate a joint prior for
λi,1 , · · · , λi,T , that accounts for the dependence between the different sample periods. A second pos-
sibility is to separate π(λi |φi ) into T different priors, where the prior for each individual period t
will be conditional on period t − 1, thus accounting for the dependence with the previous sample
period. Though these two solutions produce alternative formulations, they represent the same den-
sity and can be used interchangeably for convenience. The joint formulation is faster and will be
used to obtain the conditional posterior of φi . However, the joint formulation would be inadvisable
to obtain the conditional posterior of λi . Indeed, this joint prior results in a joint posterior which
takes a non-standard form, so that a Metropolis-Hastings step (in the line of section 4.8) is required.
The issue is that the Metropolis-Hastings algorithm performs very poorly with joint distributions
of large dimension, so that a parameter-per-parameter approach is preferable. For this reason, the
conditional posterior for λi will rely on the period-by-period formulation. The two formulations are
now introduced.
The joint formulation relies on the sparse matrix approach of Chan and Jeliazkov (2009). This
approach builds on the fact that from (5.2.3), any value λi,t ultimately depends on the initial value
λi,0 and the set of shocks υi,t , t = 1, 2, · · · , T . It is thus possible to reformulate (5.2.3) simultaneously
for all periods as:
GLi = υi , i = 1, . . . , n (5.2.9)
with:
189
5. Bayesian VARs with stochastic volatility
1 0 0 · · · 0 λ γλ + υi,1
i,1 i,0
−γ 1 0 · · · 0
λi,2 υi,2
..
G=
0 −γ 1 . λi,3
Li = υi = υi,3 (5.2.10)
. .. ..
. .. ..
.
.
. . . 0
0 · · · 0 −γ 1 λi,T υi,T
| {z } | {z } | {z }
T ×T T ×1 T ×1
λi,0 represents the initial value of the process. It cannot be endogenously estimated within the
Bayesian procedure since there is no data available to derive its posterior distribution (by definition,
since λi,0 represents a pre-sample value). It can nevertheless be treated as a regular random variable.
For the sake of convenience, assume thus that λ0 follows the following normal distribution:
!
φi (ω − 1)
λi,0 ∼ N 0, (5.2.11)
γ2
where ω denotes a known variance parameter. The 0 mean is consistent with the long-run value
implied by (5.2.3), while the variance is tailored to obtain a convenient expression for the variance
of λi,1 . Indeed, (5.2.11) implies:
φi (ω − 1)
var(γλi,0 + υi,1 ) = var(γλi,0 ) + var(υi,1 ) = γ 2 var(λi,0 ) + var(υi,1 ) = γ 2 + φi = φi ω (5.2.12)
γ2
Following Cogley and Sargent (2005), ω can then be set to a large value such as ω = 1000 in order
to obtain a diffuse prior for λi,1 and the subsequent periods. From (5.2.3), (5.2.10) and (5.2.12), it
then follows that:
ω ··· ···
0 0
.. ..
.
0 1 .
. . ..
υi ∼ N (0, φi Iω ) Iω =
.
. .. 1 ... . (5.2.13)
.. ... ...
. 0
0 ··· ··· 0 1
| {z }
T ×T
The next step consists in observing that (5.2.9) implies that Li = G−1 υi . Then from (B.9), one
concludes that:
,
Li ∼ N (0, G−1 φi Iω (G−1 ) )
or:
190
5. Bayesian VARs with stochastic volatility
where I−ω denotes the inverse of Iω . From (5.2.13), it is straightforward to obtain that:
ω −1 0 ··· ··· 0
... ..
0 1 .
.. .. . . ..
I−ω =
. . 1 . . (5.2.15)
.. .. ..
. . . 0
0 ··· ··· 0 1
| {z }
T ×T
Hence the joint prior distribution for λi is normal with mean 0 and covariance Φ0 so that:
1
π(λi |φi ) ∝ |Φ0 |−1/2 exp − L,i Φ−1
0 Li (5.2.16)
2
The second formulation for the prior distribution of λi follows a period-by-period approach. Using
the hierarchical framework developed in section (1.2), the joint density π(λi |φi ) can rewrite as:
π(λi |φi ) = π(λi,1 |φi ) × π(λi,2 |λi,1 , φi ) × · · · × π(λi,T −1 |λi,T −2 , φi ) × π(λi,T |λi,T −1 , φi ) (5.2.17)
or:
T
Y
π(λi |φi ) = π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) (5.2.18)
t=2
Note that with this formulation, Bayes rule (5.2.4) rewrites as:
n n T n
! ( )! !
−1 −1
π(fi−1 )
Y Y Y Y
π(β, f , λ, φ|y) ∝ f (y|β, f , λ)π(β) π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) π(φi )
i=2 i=1 t=2 i=1
(5.2.19)
Consider now the formulation of the priors in (5.2.17). For the general case of period t = 2, · · · , T ,
that is, any sample period but the first one, (5.2.3) implies that:
Therefore:
1 (λi,t − γλi,t−1 )2
!
π(λi,t |λi,t−1 , φi ) ∝ exp − (5.2.21)
2 φi
191
5. Bayesian VARs with stochastic volatility
As for the first sample period, it follows immediately from (5.2.3), (5.2.11) and (5.2.12) that its
distribution is :
Therefore:
1 λ2
!
π(λi,1 |φi ) ∝ exp − i,1 (5.2.23)
2 φi ω
α0
Finally, the prior for each heteroskedasticity variance parameter φi is inverse gamma with shape 2
and scale δ20 , implying:
!
−α /2−1 −δ0 /2
π(φi ) ∝ φi 0 exp (5.2.24)
φi
As usual, the prior is made weakly informative by using low values such as α0 = δ0 ≤ 0.001.
Substituting for (5.2.5), (5.2.6), (5.2.8), (5.2.16) and (5.2.24) in (5.2.4), the joint posterior is given
by:
π(β, f −1 , λ, φ |y )
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F |
t=1 2
1
× exp − (β − β0 ), Ω−1 0 (β − β0 )
2
n
1 −1
−1 , −1
−1 −1
Y
× exp − fi − fi0 Υi0 fi − fi0
i=2 2
n
1
|Φi,0 |−1/2 exp − L,i Φ−1
Y
× 0 Li
i=1 2
n
!
Y −α /2−1 −δ0 /2
× φi 0 exp (5.2.25)
i=1 φi
The different terms are too interwoven to yield analytical solutions for the marginals. A standard
Gibbs sampler methodology is thus used.
Obtain first the conditional posterior for β. Relegating to the proportionality constant any term
not involving β in Bayes rule (5.2.4), one obtains:
192
5. Bayesian VARs with stochastic volatility
π(β |y , f −1 , λ, φ)
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F |
t=1 2
1
× exp − (β − β0 ), Ω−1
0 (β − β0 ) (5.2.27)
2
1
−1
π(β |y , f , λ, φ) ∝ exp − (β − β̄), Ω̄−1 (β − β̄) (5.2.28)
2
with:
T
!−1
X̄t, Σ−1 Ω−1
X
Ω̄ = t X̄t + 0 (5.2.29)
t=1
and
T
!
X̄t, Σ−1 Ω−1
X
β̄ = Ω̄ t yt + 0 β0 (5.2.30)
t=1
This is the kernel of a multivariate normal distribution with mean β̄ and covariance Ω̄:
The estimators provided by (5.2.29) and (5.2.30) can be seen to be a linear combination of the prior
estimates and the generalised least squares estimates (against ordinary least squares for a standard
VAR). This is of course due to the presence of generalised heteroskedasticity in the model.
Obtain then the conditional posterior for each fi−1 , i = 2, · · · , n. Relegate to the proportional-
ity constant any term not involving fi−1 in Bayes rule (5.2.4) to obtain:
193
5. Bayesian VARs with stochastic volatility
−1
where f−i denotes the set f −1 without fi−1 . Substituting for (5.2.5) and (5.2.8) yields:
The likelihood function as it is formulated in (5.2.33) is not directly usable since it is formulated
in terms of F , rather than in terms of the series of fi−1 . However, lengthy manipulations allow to
reformulate (5.2.5) as:
f (y|β, f −1 , λ)
T Y
n
1 1
2
−1/2 −1 ,
exp − λi,t exp − s̄−1
Y
= s̄i i exp(−λi,t ) εi,t + (fi ) ε−i,t (5.2.34)
t=1 i=1 2 2
,
where ε−i,t denotes the vector of residuals up to εi−1,t : ε−i,t = (ε1,t ε2,t · · · εi−1,t ) . Note that this
specific expression for the likelihood involves the elements fi−1 of the inverse of F , not the elements
of F . It is for this reason that the priors also have to be defined in terms of the elements of F −1 .
This is however a harmless transformation since there is a one to one correspondence between F and
its inverse. Substituting in (5.2.33) yields:
1
,
× exp − fi−1 − fi0−1 Υ−1
i0 f −1
i − f −1
i0 (5.2.35)
2
The trick consists in noticing that this new formulation isolates the different vectors fi−1 as separate
multiplicative terms. One can then conveniently relegate to the proportionality constant any of those
multiplicative terms which do not involve the specific fi−1 we are interested in. Doing so yields:
1
,
× exp − fi−1 − fi0−1 Υ−1i0 f −1
i − f −1
i0 (5.2.36)
2
This is comparable to formula (5.2.27) obtained for the VAR coefficients. A similar method of
resolution is thus employed, and after some manipulations of (5.2.36), one finally obtains:
194
5. Bayesian VARs with stochastic volatility
1n
,
o
π(fi−1 |y, β, f−i
−1
, λ, φ) ∝ exp − (fi−1 − f¯i−1 ) Ῡ−1 −1
i (fi − f¯i−1 ) (5.2.37)
2
with !−1
T
Ῡi = s̄−1 ε−i,t exp(−λi,t )ε,−i,t + Υ−1
X
i i0 (5.2.38)
t=1
and
T
!
f¯i−1 = Ῡi −s̄−1 Υ−1 −1
X
i ε−i,t exp(−λi,t )εi,t + i0 fi0 (5.2.39)
t=1
This is the kernel of a multivariate normal distribution with mean f¯i−1 and covariance Ῡi :
Obtain now the conditional posterior for each heteroskedasticity parameter φi , i = 1, 2, · · · , n. Rel-
egating to the proportionality constant any term not involving φi in Bayes rule (5.2.4), one obtains:
where φ−i denotes the set φ without φi . Substituting for (5.2.16) and (5.2.24):
!
1 −δ0 /2
−1/2 −α0 /2−1
π(φi |y, β, f −1
, λ, φ−i ) ∝ |Φ0 | exp − L,i Φ−1
0 Li × φi exp (5.2.42)
2 φi
Rearranging, one obtains:
!
−1 − ᾱ −1 δ̄
π(φi |y, β, f , λ, φ−i ) ∝ φi 2 exp − (5.2.43)
2φi
with
ᾱ = T + α0 (5.2.44)
and
195
5. Bayesian VARs with stochastic volatility
Obtain then the conditional posterior for the series of parameters λi,t , i = 1, · · · , n and t = 1, · · · , T .
As already mentioned, the joint formulation for λi would be inefficient in this case, so that the
period-by-period approach is preferred. Following, the relevant version of bayes rule for the purpose
is (5.2.19) rather than (5.2.4). Note also that the formulas will slightly differ according to the con-
sidered time period, be it the first one, the final one, or any period in-between.
Start with the most general case, that of λi,t , t = 2, · · · , T − 1, that is, any period but the first
or last one. to obtain the conditional posterior, consider Bayes rule (5.2.19) and relegate to the
proportionality constant any term not involving λi,t to obtain:
where λ−i,−t denotes λ without λi,t . The likelihood function f (y|β, f −1 , λ) as it is formulated in
(5.2.5) cannot be conveniently used as it involves λi,t only indirectly, through the term Λt . However,
it is possible to use the reformulated likelihood (5.2.34) to obtain a workable conditional posterior.
Substituting thus for (5.2.21) and (5.2.34) in (5.2.47) to obtain:
The likelihood functions contains many multiplicative terms not involving λi,t . Relegate them to the
proportionality constant to obtain:
196
5. Bayesian VARs with stochastic volatility
For the sake of intuition (and also to speed computations), it is useful to reformulate the second row
of (5.2.49). After some manipulations and completing the squares, the expression reformulates as:
with:
φi
φ̄ = (5.2.51)
1 + γ2
and:
γ
λ̄ = (λ + λi,t+1 ) (5.2.52)
1 + γ 2 i,t−1
This formula is non standard and requires a Metropolis-Hastings step. The second row can be recog-
nised as the kernel of a normal distribution with mean λ̄ and variance φ̄. Because this distribution
is computed from the posterior draws λi,t−1 and λi,t+1 in a way consistent with (5.2.3), it is likely to
produce draws λi,t that will come from the posterior as well. For this reason, Cogley and Sargent
(2005) suggest drawing candidates from this distribution for the Metropolis-Hastings algorithm. The
first row on the other hand provides the contribution of the likelihood function and will be used to
determine acceptance or rejection of the candidate depending on consistency with the information
carried by the data. Formally, the acceptance function for the Metropolis-Hastings step is given by:
(n−1) (n)
, λi,t )
α(λi,t
1n
2
−1 ,
o
(n) (n−1)
= exp − exp(−λi,t ) − exp(−λi,t ) s̄−1
i ε i,t + (f i ) ε −i,t
2n
1 (n) o
(n−1)
× exp − λi,t − λi,t (5.2.53)
2
The principle remain the same for the first and last sample periods, with only slight adaptation of
the formulas. For the first period (t = 1), draw a candidate from N ∼ (λ̄, φ̄), with:
γλi,2 φi
λ̄ = and φ̄ = (5.2.54)
ω −1+ γ2 ω −1 + γ2
197
5. Bayesian VARs with stochastic volatility
(n−1) (n)
, λi,1 )
α(λi,1
1n
2
−1 ,
o
(n) (n−1)
= exp − exp(−λi,1 ) − exp(−λi,1 ) s̄−1
i ε i,1 + (f i ) ε −i,1
2n
1 (n) o
(n−1)
× exp − λi,1 − λi,1 (5.2.55)
2
For the last period (t = T ), draw a candidate from N ∼ (λ̄, φ̄), with:
(n−1) (n)
, λi,T )
α(λi,T
1n
2
−1 ,
o
(n) (n−1)
= exp − exp(−λi,T ) − exp(−λi,T ) s̄−1
i ε i,T + (f i ) ε −i,T
2n
1 (n) o
(n−1)
× exp − λi,T − λi,T (5.2.57)
2
It is now possible to introduce the general Gibbs sampling algorithm for the model.
Algorithm 5.2.1 (Gibbs sampler for the standard stochastic volatility model)
1. Determine the initial values for β (0) , f −1(0) , λ(0) and φ(0) . For β (0) , use the OLS estimate β̂.
Then also compute the time invariant OLS estimate Σ̂ of Σt , and compute its triangular factoriza-
tion. That is, identify F̂ and Λ̂ such that Σ̂ = F̂ Λ̂F̂ , , with F̂ a lower triangular matrix with ones
−1(0)
on the main diagonal, and Λ̂ a diagonal matrix. Then compute F̂ −1 and set f2 , · · · , fn−1(0) as the
non-zero and non-one elements of rows 2, · · · , n of F̂ −1 . For λ(0) , set the values to zero for every
(0)
λi,t , i = 1, · · · , n and t = 1, · · · , T , which implies initial homoskedasticity. Finally, for φ(0) , set the
(0)
value of φi to 1 for each i = 1, · · · , n, which corresponds to a standard normal distribution for the
heteroskedasticity disturbances.
2. Determine the values s̄1 , · · · , s̄n . Use the estimated Λ̂ and simply set s̄i as the ith diagonal
entry of Λ̂.
(0) (0)
3. For t = 1, · · · , T , recover Λt , using the series λi,t and the series s̄1 , · · · , s̄n . Then obtain
(0) (0) (0) ,
Σt for t = 1, · · · , T , using Σt = F (0) Λt (F (0) ) .
198
5. Bayesian VARs with stochastic volatility
−1(n)
5. At iteration
n, for i = 2, · · · , n draw fi from:
−1(n) −1(n−1)
π(fi (n)
y, β , f−i ,λ(n−1)
,φ (n−1)
) ∼ N (f¯i−1 , Ῡi ),
with ! −1
T (n) (n−1) (n)
s̄−1 ε−i,t exp(−λi,t )(ε−i,t ), Υ−1
P
Ῡi = i + i0
t=1
and !
T (n) (n−1) (n)
f¯i−1 = Ῡ −s̄−1 Υ−1 −1
P
i i ε−i,t exp(−λi,t )εi,t + i0 fi0 .
t=1
(n) (n) (n)
ε−i,t and εi,t are obtained from εt = yt − X̄t β (n) . Then recover F −1(n) and invert it to obtain F (n) .
(n)
6. At iteration
n, for i = 1, · · · , n draw φi from:
(n) (n−1)
π(φi y, β (n) , f −1(n) , λ(n−1) , φ−i ) ∼ IG ᾱ2 , 2δ̄
with
ᾱ = T + α0
and
(n−1) , , (n−1)
δ̄ = (Li ) G I−ω GLi + δ0 .
(n)
7. At iteration n, for i = 1, · · · , n and t = 1, · · · , T draw a candidate λi,t . Draw the candidate
from N ∼ (λ̄, φ̄).
(n−1) (n)
γλi,2 φi
If t = 1, λ̄ = ω −1 +γ 2
and φ̄ =
ω −1 +γ 2
.
(n)
γ (n−1) (n−1) φi
If t = 2, · · · , T − 1, λ̄ = 1+γ 2 (λi,t−1 +
λi,t+1 ) and φ̄ = 1+γ 2
.
(n−1) (n)
If t = T , λ̄ = γλi,T −1 and φ̄ = φi .
For all t, the acceptance function for the candidate is:
(n−1) (n)
α(λi,t
, λi,t )
n o , (n)
2
(n) (n−1) (n)
= exp − 21 exp(−λi,t ) − exp(−λi,t ) s̄−1
i εi,t + (fi−1 ) ε−i,t
n o
(n) (n−1)
× exp − 12 λi,t − λi,t .
(n) (n) (n)
Then for i = 1, · · · , n, stack λi,1 , · · · , λi,T to obtain Li .
199
5. Bayesian VARs with stochastic volatility
(n)
8. For t = 1, · · · , T , recover Λt , using λ(n) and the series s̄1 , · · · , s̄n .
There are two main limits associated with this representation of volatility. The first one is that
the value of the autoregressive coefficient γ has to be set by the user. But a suitable value is not
necessarily obvious to determine. A value for γ close to 1 implies higher inertia in volatility so that
shifts in volatility take a long time to decay. In the limit case γ = 1, shifts in volatility become
permanent and volatility follows a random walk. For values of γ lower than 1, volatility gradually
reverts to its long-run, stationary value. Cogley and Sargent (2005) solve the issue by adopting the
unit root assumption. Yet this assumption may not be relevant for some economic and financial
variables for which volatility will typically return to some long-run value at some point. For in-
stance, volatility in GDP growth may increase during a period of crisis, but it will clearly return to
a lower, long-run value once the crisis is over. For these reasons, it is desirable to have γ endoge-
nously estimated by the model. The second limit is that (5.3.1) assumes that the value of γ are
the same for all equations. In other words, the inertia in volatility is assumed to be the common to
all the variables included in the model. This may also be an erroneous assumption with serious ad-
verse impact on forecast performance. Ideally, a good model should allow for variable-specific inertia.
This section introduces a extension of the standard model which solves for these two issues by turning
γ into an endogenous variable integrated to the Bayesian estimation process. The base methodology
is the univariate setting proposed by Jacquier et al. (1994), generalised to multivariate VAR models.
The model is now formally introduced. The basis remains unchanged, that it, Σt is still decom-
posed into:
Σt = F Λt F , (5.3.2)
with F a lower triangular matrix with ones on its main diagonal, and Λt a period-specific diagonal
matrix with diag(Λt ) = (s̄1 exp(λ1,t ), s̄2 exp(λ2,t ), · · · , s̄n exp(λn,t )), so that:
200
5. Bayesian VARs with stochastic volatility
1 0 ··· ··· 0 s̄ exp(λ1,t ) 0 ··· ··· 0
1
.. .. .. ..
. .
f21
1 .
0 s̄2 exp(λ2,t ) .
.. .. .. .. . ..
s̄3 exp(λ3,t ) . .
F = f
31 f32 1 . . and Λt =
. . .
.. .. . . .. .. .. ..
. . . . 0 . . . 0
fn1 fn2 · · · fn(n−1) 1 0 ··· ··· 0 s̄n exp(λn,t )
| {z } | {z }
n×n n×n
(5.3.3)
The modification intervenes in the definition of the law of motion of the stochastic volatility processes
λ1,t , · · · , λn,t . It is now assumed that they are characterized by the following auto-regressive process:
(5.3.4) makes it clear that unlike the standard approach, γ is now a variable-specific autoregressive
coefficient. The second change with respect to the standard approach is that each coefficient γi is
now treated itself as a random variable, and will be estimated within the Bayesian procedure.
This requires the definition of a prior distribution for each γi . It may be tempting to choose a
Beta distribution to constrain prior values between 0 and 1, but the Beta offers no conjugacy with
the other distributions of the model. For this reason, and following Jacquier et al. (1994), it is
assumed that the prior for each γi is simply a normal distribution: π(γi ) ∼ N (γ0 , ζ0 ). Following:
1 (γi − γ0 )2
!
π(γi ) ∝ exp − (5.3.5)
2 ζ0
Several alternatives are available to set the values of γ0 and ζ0 . The first one is to set a diffuse prior
to let the data speak, implying γ0 = 0 and some large value for ζ0 such as ζ0 = 1000. The second
alternative is to be informative, using a non-zero mean γ0 and a reasonably small value for ζ0 . For
instance, to set a prior consistent with a random walk behavior, set γ0 = 1 and a small value like
ζ0 = 0.01 for the prior variance, which corresponds to a standard deviation of 0.1. Also, note that
while in theory a normal prior creates the complication of allowing values from −∞ to +∞ for γi ,
in practice the posteriors behave well and generate supports consistent with economic theory.
The fact that γi is now treated as an endogenous random variable involves minor modifications
in the formulation of the remaining parts of the model. As should be clear from (5.3.4), the volatility
process λi,t now depends on the random variable γi . The latter must then be included in the condi-
tioning of λi,t . This affects both the joint and period-specific formulations of the prior distribution
201
5. Bayesian VARs with stochastic volatility
of λi .
Consider first the joint formulation. It is possible to express (5.3.4) simultaneously as:
Gi Li = υi (5.3.6)
with:
1 0 0 ··· 0 λ γ λ + υi,1
i,1 i i,0
−γi 1 0 ··· 0
λi,2 υi,2
..
Gi =
0 −γi 1 . Li = λi,3 υi = υi,3 (5.3.7)
. .. ..
. .. ..
.
.
. . . 0
0 ··· 0 −γi 1 λi,T υi,T
| {z } | {z } | {z }
T ×T T ×1 T ×1
So that:
1
π(λi |φi , γi ) ∝ |Φ0 |−1/2 exp − L−1 Φ−1 Li (5.3.9)
2 i 0
The period-by-period formulation must also be adapted accordingly. Using the hierarchical frame-
work developed in section (1.2), the joint density π(λi |γi , φi ) can rewrite as:
T
Y
π(λi |γi , φi ) = π(λi,1 |φi ) π(λi,t |λi,t−1 , γi , φi ) (5.3.10)
t=2
For the general case of period t = 2, · · · , T , that is, any sample period but the first one, (5.3.4)
implies that:
Therefore:
1 (λi,t − γi λi,t−1 )2
!
π(λi,t |λi,t−1 , γi , φi ) ∝ exp − (5.3.12)
2 φi
As for the first sample period, its distribution is given by:
202
5. Bayesian VARs with stochastic volatility
Therefore:
1 λ2i,1
!
π(λi,1 |φi ) ∝ exp − (5.3.14)
2 φi , ω
The rest of the model is unchanged. With this sole modification, the set of parameters to be estimated
n o
by the model then becomes: the VAR coefficients β; the elements f −1 = fi−1 : i = 2, · · · , n re-
lated to the F matrix; the set of dynamic coefficients λ = {λi,t : i = 1, · · · , n; t = 1, · · · , T }; the
set of autoregressive coefficients γ = {γi : i = 1, · · · , n}; and the heteroskedasticity parameters
φ = {φi : i = 1, · · · , n}. Bayes rule for the model, relying on the joint formulation, is then given
by:
π(β, f −1 , λ, γ, φ |y )
n n n n
! ! ! !
f (y β, f −1 , λ)π(β) π(fi−1 )
Y Y Y Y
∝ π(λi |γi , φi ) π(γi ) π(φi ) (5.3.15)
i=2 i=1 i=1 i=1
π(β, f −1 , λ, γ, φ |y )
n n T
! ( )!
f (y β, f −1 , λ)π(β) π(fi−1 )
Y Y Y
∝ π(λi,1 |φi ) π(λi,t |λi,t−1 , γi , φi )
i=2 i=1 t=2
n n
! !
Y Y
× π(γi ) π(φi ) (5.3.16)
i=1 i=1
Substituting for (5.2.5), (5.2.6), (5.2.8), (5.3.9), (5.3.5) and (5.2.24) in (5.3.15), the joint posterior is
given by:
203
5. Bayesian VARs with stochastic volatility
π(β, f −1 , λ, γ, φ |y )
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F |
t=1 2
1
× exp − (β − β0 ), Ω−10 (β − β0 )
2
n
1 −1
−1 , −1
−1 −1
Y
× exp − fi − fi0 Υi0 fi − fi0
i=2 2
n
1
|Φ0 |−1/2 exp − L,i Φ−1
Y
× 0 L i
i=1 2
n
1 (γi − γ0 )2
!
Y
× exp −
i=1 2 ζ0
n
!
Y −α0 /2−1 −δ0 /2
× φi exp (5.3.17)
i=1 φi
As usual, the parameters are so interwoven in the joint posterior that analytical marginalization is
impossible, leading to use the Gibbs sampling methodology. The conditional posteriors for β and
f −1 are trivial to obtain. Starting from Bayes rule (5.3.15) and relegating to the proportionality
constant any term not involving them, it is immediate to see that their conditional posteriors are
still given respectively by (5.2.26) and (5.2.32). Those conditional posteriors don’t involve γ and are
thus unchanged: they are respectively given by (5.2.31) and (5.2.40).
The conditional posteriors for φ and λ are only marginally modified by the reformulation of the
model. Indeed, computing the conditional posteriors implies treating γ1 , · · · , γn as constant terms.
The derivations are then similar to the standard model, except that occurrences of γ and G are
replaced by γi and Gi respectively. Following, the conditional posteriors for the heteroskedasticity
parameters φi , i = 1, · · · , n obtain as:
!
−1 − ᾱ −1 δ̄
π(φi |y, β, f , λ, γ, φ−i ) ∝ φi 2 exp − (5.3.18)
2φi
with
ᾱ = T + α0 (5.3.19)
and
204
5. Bayesian VARs with stochastic volatility
This is the kernel of an inverse Gamma distribution with shape ᾱ and scale δ̄: π(φi |y, β, f −1 , λ, γ, φ−i ) ∼
IG(ᾱ, δ̄).
Similarly, to obtain the conditional posteriors π(λi,t |y, β, f −1 , λ−i,−t , γ, φ) for λi,t , follow the same
steps as the standard model to obtain:
π(λi,t y, β, f −1 , λ−i,−t , γ, φ)
1
2
−1 ,
∝ exp − s̄−1 i exp(−λ i,t ) ε i,t + (f i ) ε −i,t + λi,t
2 2
1 (λi,t − λ̄)
× exp −
(5.3.21)
2 φ̄
with:
γi λi,2 φi
λ̄ = and φ̄ = for t = 1 (5.3.22)
ω −1 + γi2 ω −1 + γi2
γi φi
λ̄ = (λi,t−1 − λi,t+1 ) and φ̄ = for t = 2, · · · , T − 1 (5.3.23)
1 + γi2 1 + γi2
and:
The candidate values are drawn from π(λi,t ) ∼ N (γ̄, ζ̄), and the acceptance function is still given by:
(n−1) (n)
, λi,t )
α(λi,t
1n
2
−t ,
o
(n) (n−1) −1
= exp − exp(−λi,t ) − exp(−λi,t ) s̄i εi,t + (fi ) ε−i,t
2n
1 (n) (n−1)
o
× exp − λi,t − λi,t (5.3.25)
2
Finally, it remains to determine the conditional posterior for the set of autoregressive coefficients
γ1 , · · · , γn . Start from the period-by-period formulation of Bayes rule (5.3.16) and relegate to the
proportionality constant any term not involving γi to obtain:
T
π(γi y, β, f −1 , λ, γ−i , φ) ∝ π(γi ) ×
Y
π(λi,t |λi,t−1 , γi , φi ) (5.3.26)
t=2
205
5. Bayesian VARs with stochastic volatility
1 (γi − γ0 )2 T
1 (λi,t − γi λi,t−1 )2
! !
π(γi y, β, f −1 , λ, γ−i , φ)
Y
∝ exp − × exp − (5.3.27)
2 ζ0 t=2 2 φi
After some rearrangement, one obtains:
1
π(γi y, β, f −1 , λ, γ−i , φ) ∝ exp − (γi − γ̄)ζ̄ −1 (γi − γ̄) (5.3.28)
2
with:
−1
TX
!−1
ζ̄ = φ−1
i λ2i,t + ζ0−1 (5.3.29)
t=1
and:
T
!
φ−1 ζ0−1 γ0
X
γ̄ = ζ̄ i λi,t λi,t−1 + (5.3.30)
t=2
This is the kernel of a normal distribution with mean γ̄ and variance ζ̄: π(γi |y, β, f −1 , λ, γ−i , φ) ∼
N (γ̄, ζ̄).
It is now possible to introduce the general Gibbs sampling algorithm for the model.
Algorithm 5.3.1 (Gibbs sampler for the model with random inertia)
1. Determine the initial values for β (0) , f −1(0) , λ(0) , γ (0) and φ(0) . For β (0) , use the OLS estimate
β̂. Then also compute the time invariant OLS estimate Σ̂ of Σt , and compute its triangular fac-
torization. That is, identify F̂ and Λ̂ such that Σ̂ = F̂ Λ̂F̂ , , with F̂ a lower triangular matrix with
−1(0)
ones on the main diagonal, and Λ̂ a diagonal matrix. Then compute F̂ −1 and set f2 , · · · , fn−1(0)
as the non-zero and non-one elements of rows 2, · · · , n of F̂ −1 . For λ(0) , set the values to zero for
(0)
every λi,t , i = 1, · · · , n and t = 1, · · · , T , which implies initial homoskedasticity. For γ (0) , set the
(0)
value to γi = 0.85 for each i = 1, · · · , n, implying an initial half-life of about 4 periods for the
(0)
stochastic volatility processes. Finally, for φ(0) , set the value of φi to 1 for each i = 1, · · · , n, which
corresponds to a standard normal distribution for the heteroskedasticity disturbances.
2. Determine the values s̄1 , · · · , s̄n . Use the estimated Λ̂ and simply set s̄i as the ith diagonal
entry of Λ̂.
(0) (0)
3. For t = 1, · · · , T , recover Λt , using the series λi,t and the series s̄1 , · · · , s̄n . Then obtain
206
5. Bayesian VARs with stochastic volatility
−1(n)
5. At iteration
n, for i = 2, · · · , n draw fi from:
−1(n) −1(n−1)
π(fi y, β (n) , f−i , λ(n−1) , γ (n−1) , φ(n−1) ) ∼ N (f¯i−1 , Ῡi ),
with ! −1
T (n) (n−1) (n)
s̄−1 ε−i,t exp(−λi,t )(ε−i,t ), Υ−1
P
Ῡi = i + i0
t=1
and !
T (n) (n−1) (n)
f¯i−1 = Ῡ −s̄−1 Υ−1 −1
P
i i ε−i,t exp(−λi,t )εi,t + i0 fi0 .
t=1
(n) (n) (n)
ε−i,t and εi,t are obtained from εt = yt − X̄t β (n) . Then recover F −1(n) and invert it to obtain F (n) .
(n)
6. At iteration
n, for i = 1, · · · , n draw γi from:
(n) (n−1)
π(γi y, β , f −1(n) , λ(n−1) , γ−i , φ(n−1) ) ∼ N (γ̄, ζ̄)
(n)
with: ! −1
−1 2(n−1)
−1(n−1) TP
ζ̄ = φi λi,t + ζ0−1
t=1
and: !
−1(n−1) PT (n−1) (n−1)
γ̄ = ζ̄ φi λi,t λi,t−1 + ζ0−1 γ0
t=2
(n) (n)
Then use γi to obtain Gi .
(n)
7. At iteration
n, for i = 1, · · · , n draw φi from:
(n) (n−1)
π(φi y, β (n) , f −1(n) , λ(n−1) , γ (n) , φ−i ) ∼ IG ᾱ2 , 2δ̄
with
ᾱ = T + α0
and
(n−1) , (n) (n) (n−1)
δ̄ = (Li ) (Gi ), I−ω Gi Li + δ0 .
(n)
8. At iteration n, for i = 1, · · · , n and t = 1, · · · , T draw a candidate λi,t . Draw the candidate
from N ∼ (λ̄, φ̄).
207
5. Bayesian VARs with stochastic volatility
(n−1) (n)
γi λi,2 φi
If t = 1, λ̄ = ω −1 +γi2
and φ̄ = ω −1 +γi2
.
(n)
γi (n−1) (n−1) φi
If t = 2, · · · , T − 1, λ̄ = 1+γ i
2 (λi,t−1 + λi,t+1 ) and φ̄ = 1+γi 2
.
(n−1) (n)
If t = T , λ̄ = γi λi,T −1 and φ̄ = φi .
For all t, the acceptance function for the candidate is:
(n−1) (n)
α(λi,t
, λi,t )
, (n) 2
n o
(n) (n−1) (n)
= exp − 21 exp(−λi,t ) − exp(−λi,t ) s̄−1
i εi,t + (fi−1 ) ε−i,t
n o
(n) (n−1)
× exp − 12 λi,t − λi,t .
(n) (n) (n)
Then for i = 1, · · · , n, stack λi,1 , · · · , λi,T to obtain Li .
(n)
9. For t = 1, · · · , T , recover Λt , using λ(n) and the series s̄1 , · · · , s̄n .
The details of the model are as follows: similarly to the standard model, it is assumed that Σt
can be decomposed as:
Σt = F Λt F , (5.4.1)
F is unchanged is still defined as in (5.2.2). Λt however takes a simpler form compared to the standard
model. It is now defined as a diagonal matrix with diag(Λt ) = (s̄1 exp(λt ), s̄2 exp(λt ), · · · , s̄n exp(λt )).
That is:
208
5. Bayesian VARs with stochastic volatility
1 0 ··· ··· 0 s̄1 exp(λt ) 0 ··· ··· 0
.. .. .. ..
. .
f21
1 .
0 s̄2 exp(λt ) .
.. .. .. .. . ..
s̄3 exp(λt ) . .
F = f
31 f32 1 . . Λt =
. . .
.. .. . . .. .. .. ..
. . . . 0 . . . 0
fn1 fn2 · · · fn(n−1) 1 0 ··· ··· 0 s̄n exp(λt )
| {z } | {z }
n×n n×n
(5.4.2)
The model still allows for variable-specific scaling terms s̄1 , s̄2 , · · · , s̄n , but unlike the standard model
it now assumes a single common stochastic volatility term λt , which follows the autoregressive process:
Λt = exp(λt )Λ (5.4.4)
where Λ is defined as Λt without the exp(λt ) terms such that diag(Λ) = (s̄1 , s̄2 , · · · , s̄n ). One then
obtains:
with Σ = F ΛF , the time-invariant component of the residual variance-covariance matrix. This for-
mulation isolates exp(λt ) as the only (scalar) period-specific component of Σt .
The choice of a single volatility process can be motivated as follows: because the posterior dis-
tribution of λt must be obtained for each of the T sample periods, assuming a single term rather
than n individual terms λ1,t , λ2,t , · · · , λn,t contributes to save a substantial number of degrees of
freedom. Carriero et al. (2012) show that with large models, the gain in accuracy resulting from
the reduction of parameters to estimate more than compensates for the loss of flexibility involved by
the simplification. This reformulation hence contributes to enhance forecast performances for large
models.
Following, the parameters of interest to be estimated for the model become: the set of VAR co-
efficients β; the elements f (−1) related to the F matrix; the stochastic volatility coefficients λ; and
the heteroskedasticity parameter φ.
209
5. Bayesian VARs with stochastic volatility
The likelihood function for the data is left unchanged and is still given by (5.2.5):
T
1
,
f (y β, f −1 , λ, s) ∝ |F Λt F , |−1/2 exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
(5.4.6)
t=1 2
The prior for the VAR coefficients β represents the second major modification applied to the model.
It is still defined as a multivariate normal distribution, but it takes the following specific structure:
This structure is inspired from the normal-Wishart prior. It involves Σ, the time invariant component
of the residual variance-covariance matrix, and Φ0 , a prior component matrix setting the part of prior
covariance common to all the equations of the model. The latter is defined similarly to equations
(1.4.5)-(1.4.7) in section 1.4 of the guide, and the reader is referred to this section for details. The
motivation for this formulation is that the combination of the Kronecker structure with a single
stochastic volatility parameter will result in a simplified form for the posterior, implying faster
computations. Given (5.4.7), the prior for β is thus given by:
1
π(β) ∝ exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 ) (5.4.8)
2
The priors distributions for the set of elements f2−1 , · · · , fn−1 related to the F matrix are unchanged
and are still given by (5.2.8): fi−1 ∼ N (fi0−1 , Υi0 ), so that:
1
,
π(fi−1 ) ∝ exp − fi−1 − fi0−1 Υ−1
i0 f −1
i − f −1
i0 i = 2, 3, · · · , n (5.4.9)
2
Obtain then the joint formulation for the conditional prior π(λ|φ). From (5.4.3), using the reasoning
of (5.2.9)-(5.2.16), and using the notation L = (λ1 , · · · , λT ), , it follows that the distribution of L is
multivariate normal with mean 0 and covariance matrix Φ0 : L ∼ N (0, Φ0 ), with Φ0 = φ(G, I−ω G)−1 ,
and G and I−ω defined as in (5.2.10) and (5.2.15). Following:
1
π(λ |φ) ∝ |Φ0 |−1/2 exp − L, Φ−1
0 L (5.4.10)
2
It is also useful to obtain a period-by-period formulation for π(λ|φ). To do so, one rewrites the
conditional density π(λ|φ) as:
π(λ|φ)
= π(λ1 |φ) × π(λ2 |λ1 , φ) × · · · × π(λT −1 |λT −2 , φ) × π(λT |λT −1 , φ)
T
Y
= π(λ1 |φ) π(λt |λt−1 , φ) (5.4.11)
t=2
210
5. Bayesian VARs with stochastic volatility
1 (λt − γλt−1 )2
!
π(λt |λt−1 , φ) ∝ exp − (5.4.12)
2 φ
and:
!
1 λ2
π(λ1 |φ) ∝ exp − 1 (5.4.13)
2 φω
α0 δ0
φ is given the usual inverse Gamma prior with shape 2
and scale 2
, implying:
!
−α0 /2−1 −δ0 /2
π(φ) ∝ φ exp (5.4.14)
φ
The prior is made weakly informative by using values such as α0 = δ0 ≤ 0.001.
Assuming independence between the parameters, and using the hierarchical framework introduced
in section 1.2, Bayes rule obtains as:
π(β, f −1 , λ, φ|y)
n
!
−1
π(fi−1 )
Y
∝ f (y|β, f , λ, φ)π(β) π(λ |φ) π(φ) (5.4.15)
i=2
Using the period-by-period formulation (5.4.11) for π(λ|φ), one may also rewrite Bayes rule (5.4.15)
as:
π(β, f −1 , λ, φ|y)
n T
! !
∝ f (y|β, f −1 , λ, φ)π(β) π(fi−1 )
Y Y
π(λ1 |φ) π(λt |λt−1 , φ) π(φ) (5.4.16)
i=2 t=2
211
5. Bayesian VARs with stochastic volatility
Substituting for (5.4.6), (5.4.7), (5.4.9), (5.4.10) and (5.4.14) in (5.4.15) yields:
This joint posterior is too complicated to be analytically marginalized, so that the Gibbs sampling
methodology is used. Obtain first the conditional posterior distribution for β. Starting from (5.4.15)
and relegating to the proportionality constant any term not involving β yields:
π(β|y, f −1 , λ, φ)
T
1
,
|F Λt F , |−1/2 exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝
t=1 2
1
, −1
× exp − (β − β0 ) (Σ ⊗ Φ0 ) (β − β0 ) (5.4.20)
2
After some manipulation and rearrangement, the conditional posterior obtains as:
1 n
,
o
π(β|y, f −1 , λ, φ) ∝ exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄) (5.4.21)
2
with:
T
!−1
Xt, exp(−λt )Xt + Φ−1
X
Φ̄ = 0 (5.4.22)
t=1
and:
T
!
Xt, exp(−λt )yt, + Φ−1
X
B̄ = Φ̄ 0 B0 (5.4.23)
t=1
212
5. Bayesian VARs with stochastic volatility
and where B and B0 respectively denote the k × n matrix rearrangement of β and β0 such that
β = vec(B) and β0 = vec(B0 ). This is the kernel of a matrix normal distribution with location B̄
and scale matrices Σ and Φ̄: π(β|y, f −1 , λ, φ) ∼ MN (B̄, Σ, Φ̄).
(5.4.22) shows the gain obtained from the alternative prior for β. The computation of Φ̄ in this
case only requires inversion of a k × k matrix, against inversion of a nk × nk matrix if a traditional
formulation had been chosen. When n is large, the gain in computation time can be substantial.
Obtain then the conditional posterior for the elements related to the F matrix: fi−1 , i = 1, · · · , n.
Considering the joint posterior (5.4.15) and relegating to the proportionality constant any multi-
plicative term not involving fi−1 yields:
Similarly to the previous sections, this expression is not directly workable since the likelihood function
is not formulated in terms of fi−1 . Following a similar strategy, but accounting for the fact that there
is now only one volatility term λt , the likelihood function can be reformulated as:
f (y|β, f −1 , λ)
( n )( T T Y
) ( Y n )
n 1
2
−1 ,
Y −T /2
exp − exp(−λt )s̄−1
Y
∝ s̄i exp − λt i ε i,t + (f i ) ε −i,t (5.4.26)
i=1 t=1 2 t=1 i=1 2
213
5. Bayesian VARs with stochastic volatility
Relegating to the proportionality constant any term not involving fi−1 yields:
1
,
π(fi−1 |y, β, f−i
−1
, λ, φ) ∝ exp − (fi−1 − f¯i−1 ) Ῡ−1 −1
i (fi − f¯i−1 ) (5.4.29)
2
with:
T
!−1
s̄−1 ε−i,t exp(−λt )ε,−i,t Υ−1
X
Ῡi = i + i0 (5.4.30)
t=1
and:
T
!
f¯i−1 −s̄−1 Υ−1 −1
X
= Ῡi i ε−i,t exp(−λt )εi,t + i0 fi0 (5.4.31)
t=1
This is the kernel of a multivariate normal distribution with mean f¯i−1 and covariance matrix Ῡi :
π(fi−1 |y, β, f−i
−1
, λ, φ) ∼ N (f¯i−1 , Ῡi ).
Obtain then the conditional posterior for the volatility parameter φ. Starting from the joint posterior
(5.4.15) and relegating to the proportionality constant any multiplicative term not involving φ yields:
ᾱ = T + α0 (5.4.35)
214
5. Bayesian VARs with stochastic volatility
and:
δ̄ = L, G, I−ω GL + δ0 (5.4.36)
Obtain eventually the conditional posterior for the heteroskedasticity parameters λ. Similarly to
the previous versions of the model, it is best to work with a period-by-period approach in this case.
Start with the general case of period t = 2, · · · , T − 1. Consider Bayes rule (5.4.16) and relegate to
the proportionality constant any term not involving λt to obtain:
The likelihood function f (y|β, f −1 , λ) as it formulated in (5.4.6) is not convenient since it only involves
λt indirectly through the term Λt . It is however possible to use the reformulated likelihood (5.4.26)
along with (5.4.12) to obtain:
Relegating to the proportionality constant terms not involving λt and rearranging, one obtains:
The second row of (5.4.39) is similar to the second row of (5.2.49). Hence, with a similar method of
resolution consisting in completing the squares, (5.4.39) rewrites as:
215
5. Bayesian VARs with stochastic volatility
with:
φ γ
φ̄ = and λ̄ = (λt−1 + λt+1 ) (5.4.41)
1 + γ2 1 + γ2
This distribution is non standard and requires a Metropolis-Hastings step. Similarly to the previous
versions of the model, the strategy then consists in drawing a candidate from the distribution implied
by the second row of 5.4.40, namely from N (λ̄, φ̄). It follows then immediately that the acceptance
function is given by:
(n−1) (n)
α(λt , λt )
n
!
1n (n) (n−1)
oX
−1
−1 ,
2
= exp − exp(−λt ) − exp(−λt ) s̄i εi,t + (fi ) ε−i,t
2 i=1
n (n)
(n−1)
× exp − {λt − λt } (5.4.42)
2
γλ2
For the case t = 1, the candidate is drawn from N (λ̄, φ̄), with φ̄ = ω−1φ+γ 2 and λ̄ = ω−1 +γ 2
, while
for t = T the candidate is drawn from N (λ̄, φ̄), with φ̄ = φ and λ̄ = γλT −1 . In both cases, the
acceptance function is given by (5.4.42), with respectively t = 1 and t = T .
It is then possible to derive the general Gibbs sampling algorithm for the model:
1. Determine the initial values for β (0) , f −1(0) , λ(0) and φ(0) . For β (0) , use the OLS estimate β̂.
Then also compute the time invariant OLS estimate Σ̂ of Σt , and compute its triangular factoriza-
tion. That is, identify F̂ and Λ̂ such that Σ̂ = F̂ Λ̂F̂ , , with F̂ a lower triangular matrix with ones
−1(0)
on the main diagonal. Set F (0) = F̂ . Then compute F̂ −1 and set f2 , · · · , fn−1(0) as the non-zero
(0)
and non-one elements of rows 2, · · · , n of F̂ −1 . For λ(0) , set λt = 0 for every t = 1, · · · , T , implying
initial homoskedasticity. Finally, for φ(0) , set the value to 1, which corresponds to a standard normal
distribution for the heteroskedasticity disturbances.
2. Determine the values s̄1 , · · · , s̄n . Use the estimated Λ̂ and simply set s̄i as the ith diagonal
entry of Λ̂. Obtain Λ from Λ = diag(s̄1 , · · · , s̄n ). Then set Σ(0) = F (0) Λ(F (0) ), .
(0) (0)
3. For t = 1, · · · , T , recover Λt , using Λ and λ(0) . Then obtain Σt for t = 1, · · · , T , using
(0) (0) ,
Σt = F (0) Λt (F (0) ) .
216
5. Bayesian VARs with stochastic volatility
with !−1
T (n−1)
Xt, Φ−1
P
Φ̄ = exp(−λt )Xt + 0
t=1
and: !
T (n−1) ,
Xt, Φ−1
P
B̄ = Φ̄ exp(−λt )yt + 0 B0
t=1
Then recover β (n) from β (n) = vec(B (n) ).
−1(n)
5. At iteration
n, for i = 2, · · · , n draw fi from:
−1(n) −1(n−1)
π(fi y, β (n) , f−i , λ(n−1) , φ(n−1) ) ∼ N (f¯i−1 , Ῡi )
with: ! −1
T (n) (n−1) (n)
Ῡi = s̄−1 )(ε−i,t ), + Υ−1
P
i ε−i,t exp(−λt i0
t=1
and: !
T (n) (n−1) (n)
f¯i−1 = Ῡ −s̄−1 Υ−1 −1
P
i i ε−i,t exp(−λt )εi,t + i0 fi0 .
t=1
(n) (n)
ε−i,t and εi,t are obtained from εt = yt − X̄t β (n) . Then recover F −1(n) and inverse it to obtain F (n) .
Finally, obtain Σ(n) from Σ(n) = F (n) Λ(F (n) ), .
6. At iteration
n, draw φ(n) from:
π(φ(n) y, β (n) , f −1(n) , λ(n−1) ) ∼ IG ᾱ2 , 2δ̄
with:
ᾱ = T + α0
and:
δ̄ = L, G, I−ω GL + δ0 .
(n)
7. At iteration n, for t = 1, · · · , T , draw a candidate λt . Draw the candidate from N ∼ (λ̄, φ̄).
(n−1)
γλ2 φ(n)
If t = 1, λ̄ = ω −1 +γ 2
and φ̄ = ω −1 +γ 2
.
γ (n−1) (n−1) φ(n)
If t = 2, · · · , T − 1, λ̄ = 1+γ 2
(λt−1 +
λt+1 ) and φ̄ = 1+γ 2
.
(n−1) (n)
If t = T , λ̄ = γλT −1 and φ̄ = φ .
For all t, the acceptance function for the candidate is:
(n−1) (n)
α(λt , λt )
n
(n) (n−1) n
oP
(n) (n)
2
= exp − 21 exp(−λt ) − exp(−λt ) s̄−1 ε i i,t + (fi−1 ), ε−i,t
n o i=1
(n) (n−1)
× exp − n2 λt − λt .
(n) (n)
Then for i = 1, · · · , n, stack λ1 , · · · , λT to obtain L(n) .
(n)
8. For t = 1, · · · , T recover Λt using Λ and λ(n) .
217
5. Bayesian VARs with stochastic volatility
5.5. Forecasts
The Gibbs sampling methodology developed for forecasts under regular Bayesian VAR models is sim-
ple and well established: see algorithm 2.1.1. Nevertheless, when the model is a Bayesian VAR with
stochastic volatility some modifications apply to the structure of the model, which in turn affects the
standard forecast methodology. In particular, the standard VAR relies on a Gibbs sampler that uses
the time-invariant residual covariance matrix Σ, while a stochastic volatility model involves Σt , a
time-varying matrix. This time-varying component must be taken into consideration in order to pro-
duce correct posterior distribution. This is however straightforward to obtain: from (5.2.1)-(5.2.3),
it is clear that the Σt matrix is characterized by an autoregressive process, so that any value at t + 1
can be obtained recursively from the value at period t.
Following, it is possible to propose the following Gibbs sampling algorithm for forecasts with the
stochastic volatility models:
Algorithm 5.5.1 (Gibbs sampler for unconditional forecasts, all stochastic volatility mod-
els)
1. Define the number of iterations (It − Bu) of the algorithm, and the forecast horizon h:
3. At iteration n, draw β (n) and F (n) from their posterior distributions. Simply recycle draw n
from the Gibbs sampler.
218
5. Bayesian VARs with stochastic volatility
with ηt a vector of structural shocks such that ηt ∼ N (0, Γ), and Γ a diagonal matrix so that
the shocks are independently distributed. This resulted in the identification of a structural matrix
D = D0−1 with the fundamental property:
Σ = DΓD, (5.6.2)
An issue arises because a stochastic volatility BVAR involves the time-varying matrix Σt rather than
the time-invariant covariance matrix Σ.
219
5. Bayesian VARs with stochastic volatility
There are two options to solve for this issue. The first is to adopt a time-varying approach of
the structural VAR and to modify (5.6.2) into:
Σt = Dt Γt Dt, (5.6.3)
This is the most general formulation where both the structural matrix D and the variance-covariance
matrix Γ for the structural shocks are treated as time-varying. In practice, only one of the two com-
ponents may integrate time variation, which still results in Σt to be time-varying as a whole. For
instance, decomposition (5.2.1) of Σt into Σt = F Λt F , is consistent with (5.6.3). It defines the time-
invariant structural matrix D = F , which is just a triangular factorization of Σt , and it associates to
it the time-varying covariance matrix for the structural shocks Γt = Λt . On the other hand, it is also
possible to consider the converse time-varying approach where Γ is a time-invariant structural dis-
turbance covariance matrix and Dt is a time-varying structural identification matrix. For instance,
adopting a Choleski decomposition approach for Σt amounts to considering Γ = I and Dt = Ct ,
where Ct is the Choleski factor of Σt such that Ct Ct, = Σt . The time-varying approach of structural
VARs is very rich and may lead to very interesting comparisons. For instance, if one estimates a
stochastic volatility model, it may be of great interest to determine whether the dynamic response
of the model, i.e. the structural impulse response functions has changed over the considered period.
For a sample covering periods t = 1, · · · , T this can be done by computing first the structural IRFs
associated with Σ1 , then those associated with ΣT , and assessing the difference.
While such a time-varying analysis can be very interesting, it is also its limits since it results in
plethoric information. It amounts to estimating applications for every time-period of the sample,
making it difficult to determine how so much information should be interpreted or summarized. For
this reason, it may be both simpler and preferable to adopt a time-invariant approach of structural
VARs relying on the structure of the different models. This is actually straightforward to obtain.
Consider for instance the standard approach. For any value |γ| < 0 (a reasonable economic assump-
tion), (5.2.3) implies that:
220
5. Bayesian VARs with stochastic volatility
That is, in the long run the stochastic volatility process λi,t reverts to its equilibrium, homoscedastic
value. Following:
s̄1 exp( lim λ1,t ) 0 ··· ··· 0
t→∞
..
..
0 s̄2 exp( lim λ2,t ) . .
t→∞
.. .. . ..
lim Λt = . . s̄3 exp( lim λ3,t ) . . .
t→∞ t→∞
.. .. ..
. . . 0
0 ··· ··· 0 s̄n exp( lim λn,t )
t→∞
s̄ 0 ··· ··· 0
1
. ..
s̄2 . .
0 .
. .. . ..
= .. . s̄3 . . . (5.6.5)
.. ... ...
. 0
0 ··· ··· 0 s̄n
It is then convenient to work with the time-invariant matrix to obtain a general structural identifi-
cation scheme for the model. As a bonus, such a strategy makes it trivial to compute the structural
identification matrices. For instance, if one opts for a triangular factorization scheme, then the struc-
tural matrix D is just F in (5.6.7), and draws from the posterior are readily available from the Gibbs
sampling algorithm. Similarly, the structural innovation covariance matrix Γ is just Λ in (5.6.6),
and it is readily available from s̄1 , · · · , s̄n . If one prefers instead a Choleski approach, (2.5.3) and
(5.6.7) imply that it can be recovered simply from C = F Λ1/2 . The same approach can apply to all
the stochastic volatility models. From (5.3.3)-(5.3.4) and (6.2.23)-(5.4.3), it turns out that (5.6.6)
and (5.6.7) also apply to the random inertia and large BVAR models. Any application implying
221
5. Bayesian VARs with stochastic volatility
a structural decomposition can thus apply to any of the stochastic volatility models in a perfectly
standard way.
222
6. Time varying Bayesian VARs
εt ∼ N (0, Σ) (6.1.2)
Note that under this simple form, the model only allows for the VAR coefficients to be time-varying,
while the residual covariance matrix Σ remains time-invariant. This assumption will be relaxed in
the next section. The model can be reformulated for each period in compact form as:
yt = X̄t βt + εt (6.1.3)
with:
, , ,
X̄t = In ⊗ Xt , Xt = yt−1 yt−2 · · · yt−p x,t (6.1.4)
| {z } | {z }
n×q 1×k
and
A,
1,t
,
A2,t
.
βt, = vec(Bt ) , ..
Bt =
(6.1.5)
| {z }
,
q×1 Ap,t
Ct,
| {z }
k×n
223
6. Time varying Bayesian VARs
The VAR coefficients are assumed to follow the following autoregressive process:
The covariance matrix Ω is assumed to be a random variable endogenously determined by the model.
This concludes the description of the model. The parameters of interest to be estimated are then: the
VAR coefficients β = {β1 , · · · , βT }, the covariance matrix Ω for the shocks on the dynamic process,
and the residual covariance matrix Σ.
Start with the likelihood function. Independence between the residuals εt implies that the likelihood
can be written as:
T
1
−1/2 ,
exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt )
Y
f (y |β, Σ) ∝ |Σ| (6.1.8)
t=1 2
It is also possible to obtain a compact form for the likelihood by setting:
y X̄ 0 ··· 0 β ε
1 1 1 1
y2
0 X̄2
··· 0 β2 ε2
= + (6.1.9)
.. .. .. ... .. .. ..
. . . . . .
yT 0 0 · · · X̄T βT εT
| {z } | {z } | {z } | {z }
nT ×1 nT ×qT qT ×1 nT ×1
or:
Following:
1
−1/2
, −1
f (y |β, Σ) ∝ Σ̄ exp − (y − X̄B) Σ̄ (y − X̄B) (6.1.11)
2
The prior distribution π(β |Ω) for the VAR coefficients can take two forms. The first is a compact
form proposed by Chan and Jeliazkov (2009). To obtain it, note that it is possible to express the
dynamic process 6.1.6 in compact form as:
224
6. Time varying Bayesian VARs
I 0 0 ··· 0 β β + ν1
q 1 0
−Iq Iq 0 · · · 0 β2 ν2
0
−Iq Iq β3 = ν3
(6.1.12)
.. .. .. . . .
. . . .. .. ..
0 0 · · · Iq βT νT
| {z } | {z } | {z }
T q×T q T q×1 T q×1
or:
HB = ν (6.1.13)
The initial condition β0 is assumed to follow the following normal distribution: β0 ∼ N (0, (τ − 1)Ω),
where τ denotes some positive scalar. Then independence implies that:
so that:
τΩ 0 0 · · · 0 τ 0 0 ··· 0
0 Ω 0 · · · 0 0 1 0 ··· 0
0
var(ν) = 0 Ω = Iτ ⊗ Ω with 0
Iτ = 0 1 (6.1.15)
.. .. . . .. .. .. ..
. . . . .
.
. . . .
0 0 ··· Ω 0 0 ··· 1
| {z } | {z }
T q×T q T ×T
B = H −1 ν (6.1.16)
And from the affine property of the normal distribution, one then obtains that the prior distribution
for β is given by:
,
π(β |Ω) ∼ N (0, H −1 (Iτ ⊗ Ω)(H −1 ) ) (6.1.17)
or:
225
6. Time varying Bayesian VARs
τ −1 0 0 ··· 0
0
1 0 ··· 0
−1
π(β |Ω ) ∼ N (0, Ω0 ) , Ω0 = (H , (I−τ ⊗ Ω−1 )H) , I−τ = 0 0 1 (6.1.18)
.. .. .. ..
| {z }
. . . .
T q×T q
0 0 ··· 1
| {z }
T ×T
Then:
1
π(β |Ω) ∝ |Ω0 | exp − B , Ω−1
0 B (6.1.19)
2
The second form relies on a joint conditional formulation, using the fact that:
T
Y
π(β |Ω) = π(β1 |Ω) π(βt |Ω, βt−1 ) (6.1.20)
t=2
This yields:
T
( )!
−T /2 1
β1, (τ Ω)−1 β1 + (βt − βt−1 ), Ω−1 (βt − βt−1 )
X
π(β |Ω ) ∝ |Ω| exp − (6.1.21)
2 t=2
Consider now the prior for Ω. For simplicity, Ω is assumed to be a diagonal matrix. Each of the q
diagonal entries ωi , i = 1, . . . , q is assumed to follow an inverse gamma prior with shape χ20 and scale
ψ0
2
.
!
−
χ0
−1 ψ0
π(ωi ) ∝ ωi 2
exp − (6.1.22)
2ωi
In order to implement a loose prior, the hyperparameter values are set at χ0 = ψ0 = 0.001.
Finally, the prior distribution for Σ is inverse Wishart with scale S0 and degrees of freedom κ0 .
Hence:
1 n
o
π(Σ) ∝ |Σ|−(κ0 +n+1)/2 exp − tr Σ−1 S0 (6.1.23)
2
Given Bayes rule 6.1.7, the likelihood function 6.1.8, the prior distributions 6.1.19, 6.1.22 and 6.1.23,
the joint posterior distribution is given by:
226
6. Time varying Bayesian VARs
π(β, Ω, Σ |y )
T
1
−n/2 −1/2 ,
exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt )
Y
∝ (2π) |Σ|
t=1 2
1
× |Ω0 | exp − B , Ω−1 0 B
2
q !
Y χ
− 20 −1 ψ0
× ωi exp −
i=1 2ωi
1 n −1 o
−(κ0 +n+1)/2
× |Σ| exp − tr Σ S0
2
This function does not admit analytical solutions, so that the Gibbs sampling algorithm has to be
used. Start with the conditional posterior for β. Consider Bayes rule 6.1.7 and relegate to the
proportionality constant any term not involving β to obtain:
1 1
−1/2
,
π(β |y, Ω, Σ ) ∝ Σ̄ exp − (y −1
− X̄B) Σ̄ (y − X̄B) × |Ω0 | exp − B , Ω−1
0 B (6.1.25)
2 2
Rearranging then yields:
1
,
π(β |y , Ω, Σ) ∝ exp − (B − B̄) Ω̄−1 (B − B̄) (6.1.26)
2
with:
Ω̄−1 = Ω−1 , −1
0 + X̄ Σ̄ X̄ (6.1.27)
and
B̄ = Ω̄ X̄ , Σ̄−1 y (6.1.28)
This is the kernel of a multivariate normal distribution with mean B̄ and variance Ω̄:
Consider then the conditional posterior distribution of Ω. More precisely, consider the conditional
posterior for each ωi , i = 1, . . . , q. Start from Bayes rule 6.1.7 and relegate to the proportionality
constant any term not involving Ω to obtain:
227
6. Time varying Bayesian VARs
Substituting for the reformulated prior π(β |Ω) given by 6.1.21 and for the prior π(ωi ) given by
6.1.22, then rearranging, one obtains:
π(ωi |y , β, Σ)
T
( )!
−T /2 1
β1, (τ Ω)−1 β1 + (βt − βt−1 ), Ω−1 (βt − βt−1 )
X
∝ |Ω| exp −
2 t=2
!
χ0
− −1 ψ0
× ωi 2 exp − (6.1.31)
2ωi
χ0 + T
χ̄ = (6.1.33)
2
and:
T
2
(βi,t − βi,t−1 )2 + ψ0
P
βi,1 /τ +
t=2
ψ̄ = (6.1.34)
2
where βi,t is element i of βt , i = 1, . . . , q. This is the kernel of an inverse Gamma distribution with
shape χ̄ and degrees of freedom ψ̄:
Finally, obtain the conditional posterior for Σ. Start from Bayes rule 6.1.7 and relegate to the
proportionality constant any term not involving Σ to obtain:
228
6. Time varying Bayesian VARs
Substituting for the likelihood function 6.1.8 and the prior distribution 6.1.23, one obtains:
π(Σ |y, β, Ω)
T
1
−1/2 ,
exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt )
Y
∝ |Σ|
t=1 2
1 n −1 o
−(κ+n+1)/2
× |Σ| exp − tr Σ S (6.1.37)
2
Rearranging yields:
1 n
o
π(Σ |y, β, Ω) ∝ exp − tr Σ−1 S̄ × |Σ|−(κ̄+n+1)/2 (6.1.38)
2
with:
κ̄ = T + κ0 (6.1.39)
and:
T
X ,
S̄ = (yt − X̄t βt )(yt − X̄t βt ) + S0 (6.1.40)
t=1
Following, it is possible to introduce the general Gibbs sampling algorithm for the model:
,
1. Determine the initial values B (0) , Ω(0) and Σ(0) . Set B (0) = 1T ⊗ β̂OLS , Ω(0) = diag(β̂OLS β̂OLS ),
and Σ(0) = Σ̂OLS .
229
6. Time varying Bayesian VARs
χ̄ = χ20 + T
and:
T
P
2 /τ +
βi,1 (βi,t −βi,t−1 )2 +ψ0
t=2
ψ̄ = 2
230
6. Time varying Bayesian VARs
εt ∼ N (0, Σt ) (6.2.2)
Unlike the basic time-varying model, this version also allows the residual covariance matrix to be
period-specific.
The model can be reformulated for each period in compact form as:
yt = X̄t βt + εt (6.2.3)
with:
, , ,
X̄t = In ⊗ Xt , Xt = yt−1 yt−2 · · · yt−p x,t (6.2.4)
| {z } | {z }
n×q 1×k
and
A
1,t
A2,t
..
βt = vec(Bt ) , Bt =
.
(6.2.5)
| {z }
Ap,t
q×1
Ct
| {z }
k×n
As for Σt , its dynamic process follows that described in section 5.2. It assumes that Σt can be
decomposed as:
Σt = F Λt F , (6.2.7)
231
6. Time varying Bayesian VARs
F is a lower triangular matrix with ones on its main diagonal, while Λt is a period-specific diagonal
matrix with diag(Λt ) = (s̄1 exp(λ1,t ), s̄2 exp(λ2,t ), · · · , s̄n exp(λn,t )). That is:
1 0 ··· ··· 0 s̄1 exp(λ1,t ) 0 ··· ··· 0
.. .. .. ..
. .
f21
1 .
0 s̄2 exp(λ2,t ) .
... .. .. ... . ..
s̄3 exp(λ3,t ) . .
F = f
31 f32 1 . Λt =
. .
.. .. . . ... .. ... ...
. . . 0 . 0
fn1 fn2 · · · fn(n−1) 1 0 ··· ··· 0 s̄n exp(λn,t )
| {z } | {z }
n×n n×n
(6.2.8)
s̄1 , s̄2 , · · · , s̄n are known scaling terms, while λ1,t , λ2,t , · · · , λn,t are dynamic processes generating the
heteroskedasticity of the model. Specifically, it is assumed that the λi,t terms are characterized by
the following autoregressive process:
This concludes the description of the model. The parameters of interest to be estimated are then:
the VAR coefficients β = {βt : t = 1, . . . , T }, the covariance matrix Ω for the shocks on the dy-
n o
namic process, the elements f −1 = fi−1 : i = 2, · · · , n related to the F matrix, the set of dy-
namic coefficients λ = {λi,t : i = 1, · · · , n ; t = 1, · · · , T }, and the heteroskedasticity parameters
φ = {φi : i = 1, · · · , n}.
Assuming independence between the parameters β, f −1 , f −1 and λ, and relying on the hierarchical
setting introduced in section 1.2 to address the dependence between β and Ω, then λ and φ, Bayes
rule obtains as:
n n n
! ! !
−1 −1
π(fi−1 )
Y Y Y
f (β, Ω, f , λ, φ |y ) ∝ f (y |β, f , λ)π(β |Ω)π(Ω) π(λi |φi ) π(φi ) (6.2.10)
i=2 i=1 i=1
Start with the likelihood function. Independence between the residuals εt implies that the likelihood
can be written as:
T
1
, −1/2 ,
−1
exp − (yt − X̄t βt ) (F Λt F , )−1 (yt − X̄t βt )
Y
f (y |β, f , λ) ∝ |F Λt F | (6.2.11)
t=1 2
It is also possible to obtain a compact form for the likelihood by setting:
232
6. Time varying Bayesian VARs
y X̄ 0 ··· 0 β ε
1 1 1 1
y2
0 X̄2
··· 0 β2 ε2
= + (6.2.12)
.. .. .. .. .. .. ..
.
.
. . . . .
yT 0 0 · · · X̄T βT εT
| {z } | {z } | {z } | {z }
nT ×1 nT ×qT qT ×1 nT ×1
or:
Σ 0 ··· 0
1
0 Σ2
··· 0
y = X̄B + ε , ε ∼ N (0, Σ̄) , Σ̄ =
.. .. .. .. (6.2.13)
. . . .
0 0 · · · ΣT
| {z }
nT ×nT
Following:
1
−1/2
, −1
f (y |β, Σ) ∝ Σ̄ exp − (y − X̄B) Σ̄ (y − X̄B) (6.2.14)
2
Following section 6.1, there can be two formulations for the prior π(β |Ω). The first one is the
compact formulation given by π(β |Ω) ∼ N (0, Ω0 ) given by 6.1.19:
1
π(β |Ω) ∝ |Ω0 | exp − B , Ω−1
0 B (6.2.15)
2
T
The second one is the conditional formulation π(β |Ω) = π(β1 |Ω) π(βt |Ω, βt−1 ) given by 6.1.21:
Q
t=2
T
( )!
−T /2 1
β1, (τ Ω)−1 β1 + (βt − βt−1 ), Ω−1 (βt − βt−1 )
X
π(β |Ω ) ∝ |Ω| exp − (6.2.16)
2 t=2
Following section 6.1, the matrix Ω is assumed to be diagonal, with each term ωi following an inverse
Gamma distribution: π(ωi ) ∼ IG( χ20 , ψ20 ) ; it is given by :
!
−
χ0
−1 ψ0
π(ωi ) ∝ ωi 2
exp − (6.2.17)
2ωi
Denote by fi−1 the vector containing the non-zero and non-one elements of the ith row of F −1 .
Following section 5.1, the prior for each fi−1 is then assumed to be multivariate normal with mean
fi0−1 and covariance Υi0 : fi−1 ∼ N (fi0−1 , Υi0 ):
1
,
π(fi−1 ) ∝ exp − fi−1 − fi0−1 Υ−1
i0 f −1
i − f −1
i0 i = 2, 3, · · · , n (6.2.18)
2
233
6. Time varying Bayesian VARs
There are two formulations for the prior distribution of λ. The first is the joint prior π(λi |φi ) ∼
N (0, Φ0 ) given by 5.2.16:
1
−1/2
π(λi |φi ) ∝ |Φ0 | exp − L,i Φ−1
0 Li (6.2.19)
2
T
The second formulation is the conditional prior π(λi |φi ) = π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) given by
Q
t=2
5.2.18. This yields:
1 λ2i,1 XT
(λi,t − γλi,t−1 )2
π(λi |φi ) ∝ exp −
+ (6.2.20)
2 φi ω t=2 φi
Finally, the prior for each heteroskedasticity variance parameter φi is inverse gamma with shape α0
and δ0 , and given by 5.2.24:
!
−α /2−1 −δ0 /2
π(φi ) ∝ φi 0 exp (6.2.21)
φi
Given Bayes rule 6.2.10, the likelihood function 6.2.11, the prior distributions 6.2.15, 6.2.17,6.2.18,
6.2.19 and 6.2.21, the joint posterior distribution is given by:
f (β, Ω, f −1 , λ, φ |y )
T
1
, −1/2 ,
exp − (yt − X̄t βt ) (F Λt F , )−1 (yt − X̄t βt )
Y
∝ |F Λt F | (6.2.22)
t=1 2
1
× |Ω0 | exp − B , Ω−1 0 B
2
q !
Y χ
− 20 −1 ψ0
× ωi exp −
i=1 2ωi
n
1
,
exp − fi−1 − fi0−1 Υ−1 −1 −1
Y
× i0 f i − f i0
i=1 2
1
× |Φ0 |−1/2 exp − L,i Φ−10 Li
2
n
!
Y −α0 /2−1 −δ0 /2
× φi exp (6.2.23)
i=1 φi
The posterior does not admit analytical posteriors, so that the Gibbs sampling algorithm is required.
Obtain first the conditional posterior for β. Start from Bayes rule 6.2.10 and relegate to the propor-
tionality constant any multiplicative term not involving β to obtain:
f (β y, Ω, f −1 , λ, φ ) ∝ f (y |β, f −1 , λ)π(β |Ω) (6.2.24)
234
6. Time varying Bayesian VARs
This is similar to equation 6.1.24 in section 6.1, with similar expressions for the likelihood function
f (y |β, f −1 , λ) (given by 6.2.14) and the prior π(β |Ω) (given by 6.2.15). The solution is therefore
similar and is given by 6.1.29:
with:
Ω̄−1 = Ω−1 , −1
0 + X̄ Σ̄ X̄ (6.2.26)
and
B̄ = Ω̄ X̄ , Σ̄−1 y (6.2.27)
Consider then the conditional posterior for Ω. Start from Bayes rule 6.2.10 and relegate to the
proportionality constant any multiplicative term not involving ωi to obtain:
π(ωi y, β, f −1 , λ, φ ) ∝ π(β |ωi )π(Ω) (6.2.28)
This is similar to equation 6.1.31 in section 6.1, with similar expressions for the priors π(β |Ω) (given
by 6.2.15) and π(ωi ) (given by 6.2.17). The solution is therefore similar and is given by 6.1.32:
!
ψ̄
π(ωi |y, β, ω−i , Σ) ∝ ωi−χ̄−1 exp − (6.2.29)
ωi
with
χ0 + T
χ̄ = (6.2.30)
2
and:
T
2
(βi,t − βi,t−1 )2 + ψ0
P
βi,1 /τ +
t=2
ψ̄ = (6.2.31)
2
Consider then the conditional posterior for fi−1 . Start from Bayes rule 6.2.10 and relegate to the
proportionality constant any multiplicative term not involving fi−1 to obtain:
235
6. Time varying Bayesian VARs
This is similar to equation 5.2.32 in section 5.2, with similar expressions for the likelihood function
f (y |β, f −1 , λ) (given by 6.2.11) and the prior π(fi−1 ) (given by 6.2.18). The solution is therefore
similar and is given by 5.2.40:
−1
π(fi−1 |y, β, f−i , λ, φ) ∼ N (f¯i−1 , Ῡi ) (6.2.33)
with
T
!−1
s̄−1 ε−i,t exp(−λi,t )ε,−i,t Υ−1
X
Ῡi = i + i0 (6.2.34)
t=1
and
T
!
f¯i−1 = Ῡi −s̄−1 ε−i,t exp(−λi,t )εi,t + Υ−1 −1
X
i i0 fi0 (6.2.35)
t=1
Consider then the conditional posterior for λi,t . Note first that, as stated in 5.2.18, the joint density
π(λi |φi ) can rewrite as:
T
Y
π(λi |φi ) = π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) (6.2.36)
t=2
f (β, Ω, f −1 , λ, φ |y )
n n T n
! ! !
−1
π(fi−1 )
Y Y Y Y
∝ f (y |β, f , λ)π(β |Ω)π(Ω) π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) π(φi )
i=2 i=1 t=2 i=1
(6.2.37)
Then using Bayes rule 6.2.37 and relegating to the proportionality constant any multiplicative term
not involving λi,t yields:
f (λi,t y, β, Ω, f −1 , λ−i,−t , φ) ∝ f (y |β, f −1 , λ)π(λi,t |λi,t−1 , φi )π(λi,t+1 |λi,t , φi ) (6.2.38)
This is similar to equation 5.2.47 in section 5.2, with similar expressions for the likelihood function
f (y |β, f −1 , λ) (given by 6.2.11) and the priors π(λi,t |λi,t−1 , φi ) and π(λi,t+1 |λi,t , φi ) (given by 6.2.21).
The solution is therefore similar and is given by 5.2.50:
236
6. Time varying Bayesian VARs
with:
φi
φ̄ = (6.2.40)
1 + γ2
and:
γ
λ̄ = (λ + λi,t+1 ) (6.2.41)
1 + γ 2 i,t−1
Equation 6.2.39 is non standard and requires a Metropolis-Hastings step. The acceptance function
for the Metropolis-Hastings step is given by 5.2.53 as:
(n−1) (n)
α(λi,t, λi,t )
1n
2
−1 ,
o
(n) (n−1) −1
= exp − exp(−λi,t ) − exp(−λi,t ) s̄i εi,t + (fi ) ε−i,t
2n
1 (n) (n−1)
o
× exp − λi,t − λi,t (6.2.42)
2
Finally, obtain the conditional posterior for φi . Start from Bayes rule 6.2.10 and relegate to the
proportionality constant any multiplicative term not involving φi to obtain:
f (φi y, β, Ω, f −1 , λ, φ−i ) ∝ π(λi |φi )π(φi ) (6.2.43)
This is similar to equation 5.2.41 in section 5.2, with similar expressions for the priors π(λi |φi ) (given
by 6.2.19) and π(φi ) (given by 6.2.21). The solution is therefore similar and is given by 5.2.46:
!
ᾱ δ̄
π(φi y, β, f −1 , λi , φ−i ) ∼ IG , (6.2.44)
2 2
with
ᾱ = T + α0 (6.2.45)
237
6. Time varying Bayesian VARs
and
Following, it is possible to introduce the general Gibbs sampling algorithm for the model:
,
1. Determine the initial values B (0) and Ω(0) : set B (0) = 1T ⊗ β̂OLS and Ω(0) = diag(β̂OLS β̂OLS ).
Then also compute the time invariant OLS estimate Σ̂ of Σt , and compute its triangular factoriza-
tion. That is, identify F̂ and Λ̂ such that Σ̂ = F̂ Λ̂F̂ , , with F̂ a lower triangular matrix with ones
−1(0)
on the main diagonal, and Λ̂ a diagonal matrix. Then compute F̂ −1 and set f2 , · · · , fn−1(0) as the
non-zero and non-one elements of rows 2, · · · , n of F̂ −1 . For λ(0) , set the values to zero for every
(0)
λi,t , i = 1, · · · , n and t = 1, · · · , T , which implies initial homoskedasticity. Finally, for φ(0) , set the
(0)
value of φi to 1 for each i = 1, · · · , n, which corresponds to a standard normal distribution for the
heteroskedasticity disturbances.
2. Determine the values s̄1 , · · · , s̄n . Use the estimated Λ̂ and simply set s̄i as the ith diagonal
entry of Λ̂.
(0) (0)
3. For t = 1, · · · , T , recover Λt , using the series λi,t and the series s̄1 , · · · , s̄n . Then obtain
(0) (0) (0) ,
Σt for t = 1, · · · , T , using Σt = F (0) Λt (F (0) ) .
238
6. Time varying Bayesian VARs
T
P
2 /τ +
βi,1 (βi,t −βi,t−1 )2 +ψ0
t=2
ψ̄ = 2
−1(n)
6. At iteration n, for i = 2, · · · , n draw fi from:
π(fi−1 |y, β, f−i
−1
, λ, φ) ∼ N (f¯i−1 , Ῡi ),
with !−1
T (n) (n−1) (n)
s̄−1 ε−i,t exp(−λi,t )(ε−i,t ), Υ−1
P
Ῡi = i + i0
t=1
and !
T (n) (n−1) (n)
f¯i−1 = Ῡ −s̄−1 Υ−1 −1
P
i i ε−i,t exp(−λi,t )εi,t + i0 fi0 .
t=1
(n) (n) (n)
ε−i,t and εi,t are obtained from εt = yt − X̄t β (n) . Then recover F −1(n) and invert it to obtain F (n) .
(n)
7. At iteration n, for i = 1, · · · , n draw φi from:
π(φi y, β, f −1(n) , λ, φ−i ) ∼ IG ᾱ2 , 2δ̄
with
ᾱ = T + α0
and
(n−1) , , (n−1)
δ̄ = (Li ) G I−ω GLi + δ0 .
(n)
8. At iteration n, for i = 1, · · · , n and t = 1, · · · , T draw a candidate λi,t . Draw the candidate
from N ∼ (λ̄, φ̄).
(n−1) (n)
γλi,2 φi
If t = 1, λ̄ = ω −1 +γ 2
and φ̄ =
ω −1 +γ 2
.
(n)
γ (n−1) (n−1) φi
If t = 2, · · · , T − 1, λ̄ = 1+γ 2 (λi,t−1 +
λi,t+1 ) and φ̄ = 1+γ 2
.
(n−1) (n)
If t = T , λ̄ = γλi,T −1 and φ̄ = φi .
For all t, the acceptance function for the candidate is:
(n−1) (n)
α(λi,t
, λi,t )
n o , (n)
2
(n) (n−1) (n)
= exp − 21 exp(−λi,t ) − exp(−λi,t ) s̄−1
i εi,t + (fi−1 ) ε−i,t
n o
(n) (n−1)
× exp − 12 λi,t − λi,t .
(n) (n) (n)
Then for i = 1, · · · , n, stack λi,1 , · · · , λi,T to obtain Li .
(n)
9. For t = 1, · · · , T , recover Λt , using λ(n) and the series s̄1 , · · · , s̄n .
239
A. Derivations
(A ⊗ B), = A, ⊗ B , (A.1)
A ⊗ B + A ⊗ C = A ⊗ (B + C) (A.3)
A ⊗ C + B ⊗ C = (A + B) ⊗ C (A.4)
240
A. Derivations
Proof :
n o n o
tr V −1 (X − M ), U −1 (Y − N ) = tr (X − M ), U −1 (Y − N )V −1 Q.17
= vec(X − M ), × vec U −1 (Y − N )V −1 A.11
= vec(X − M ), × (V −1 ⊗ U −1 )vec(Y − N )A.8 and symmetry
= (vec(X) − vec(M )), (V −1 ⊗ U −1 ) (vec(Y ) − vec(N )) A.12
= (vec(X) − vec(M )), (V ⊗ U )−1 (vec(Y ) − vec(N )) A.2
Let A be a triangular matrix. Then the determinant of A is equal to the product of its diagonal terms.
(A.14)
241
A. Derivations
Corollary:
Let A be a diagonal matrix. Then the determinant of A is equal to the product of its diagonal terms.
(A.15)
Let A and B be k × k matrices. Then:
generalisation:
Let A be any invertible k × k matrix, B be a k × m matrix, and C be a m × k matrix. Then:
|A + BC| = |A| . |Im + CA−1 B|
proofs: see Pozrikidis (2014) p 271.
A + tIk , (A.20)
242
A. Derivations
where λi (A) denotes the ith eigenvalue of A. In other words, the determinant of Ik +A can be obtained
from the product of 1 plus the eigenvalues of A. proof: because the determinant of a matrix is equal
to the product of its eigenvalues, one can write:
|Ik + A| = ki=1 λi (Ik + A) where λi (Ik + A) denotes the ith eigenvalue of Ik + A
Q
B. Statistical distributions
Bayesian analysis in general may rely on a very large number of different statistical distributions.
This section does not aim at being exhaustive and only provides a brief introduction for the families
of distribution used at some point in this guide. Proofs for the results do not constitute the main
object of this guide and are thus omitted. For a more formal presentation, textbooks such as Casella
and Berger (2001) can be consulted.
243
A. Derivations
x ∼ U (a, b) (B.1)
a+b (b − a)2
E(x) = and var(x) = (B.3)
2 12
x ∼ Nk (µ, Σ)
1
f (x |µ, Σ) = (2π)−k/2 |Σ|−1/2 exp − (x − µ), Σ−1 (x − µ) (B.4)
2
where µ is k × 1 vector and Σ is k × k symmetric positive definite matrix. Its kernel is given by:
1
f (x |µ, Σ) ∝ exp − (x − µ), Σ−1 (x − µ) (B.5)
2
It has the following properties:
If x ∼ Nr1 +r2 (µ, Σ), and x, µ and Σ are partitioned in the following way:
x1 r1 µ1 r1 Σ11 Σ12 r1
x= , µ= and
x2 r2 µ2 r2 Σ21 Σ22 r2
r1 r2
Then:
244
A. Derivations
In other words, a subset of multivariate normal distribution is itself a multivariate normal dis-
tribution, with mean and covariance matrices defined as the corresponding subset of the original
distribution.
The converse property holds in case of independence: let x1 be a k1 × 1 random vector following
a multivariate normal distribution with mean µ1 and covariance Σ1 , and x2 be a k2 × 1 random
vector following a multivariate normal distribution with mean µ2 and covariance Σ2 . If x1 and x2 are
independent, then the k × 1 random vector x follows a multivariate normal distribution with mean
µ and covariance Σ with:
x1 µ1 Σ1 0
k = k1 + k2 x= µ= Σ= (B.8)
x2 µ2 0 Σ2
A final important property is the affine or linear property of the multivariate normal distribution:
let x ∼ Nk (µ, Σ) and let A and b respectively denote a m×k matrix and a m×1 vector of coefficients.
Then the random vector y = Ax + b also follows a multivariate normal distribution with mean Aµ + b
and covariance matrix AΣA, . That is:
Therefore, an affine combination of a multivariate normal random variable is itself multivariate nor-
mal, with mean and covariance matrices defined in accordance with the affine function.
This property can be used to generate easily multivariate random numbers with an arbitrary mean
and covariance from a multivariate standard normal draw:
Algorithm a.2.2.1 (random number generator for the multivariate normal distribution): in or-
der to generate a k × 1 random vector y from a multivariate normal distribution with mean µ and
covariance matrix Σ:
1. first draw a k × 1 random vector x from a multivariate standard normal distribution, that is,
draw x from x ∼ Nk (0, Ik ).
2. estimate A, where A is any matrix such that AA, = Σ. Typically, A will be chosen as the
(lower triangular) Choleski factor of Σ, but other choices are possible. For instance, A could
be chosen as the square root matrix of Σ).
245
A. Derivations
3. eventually compute y = µ + Ax. Then from the affine property y = µ + Ax is a random draw
from Nk (µ, Σ).
X ∼ M Nk,n (M, Σ, Φ)
1 h
i
−nk/2 −k/2 −n/2
f (X |M, Φ, Σ) = (2π) |Σ| |Φ| exp − tr Σ−1 (X − M ), Φ−1 (X − M ) (B.10)
2
where M is k × n matrix, and Σ is n × n symmetric positive definite matrix, and Φ is k × k symmetric
positive definite matrix.
Its kernel is given by:
1 h
i
f (X |M, Φ, Σ) ∝ exp − tr Σ−1 (X − M ), Φ−1 (X − M ) (B.11)
2
It has the following properties:
Φ (among rows)
E(X) = M V ar(X) = (B.12)
Σ (among columns)
Equivalence of the matrix normal distribution with the multivariate normal distribution:
Proof: the proof consists in showing that the density of the two distributions are equivalent, and it
follows directly from A.7 and A.13.
To illustrate this relation, it is now shown how the data density can be conveniently rewritten
in terms of a matrix normal distribution, rather than a multivariate normal. Start from the data
density 1.3.1:
1
−nT /2 −1/2
,
−1
f (y β, Σ̄) = (2π)
Σ̄ exp − y − X̄β Σ̄ y − X̄β (B.14)
2
From 1.1.13, y = vec(Y ), X̄ = In ⊗ X, and β = vec(B), so that it is possible to rewrite:
246
A. Derivations
Also, from 1.1.14, Σ̄ = Σ⊗IT . With these elements, it is possible to reformulate the data multivariate
normal density as:
f (y β, Σ̄) ∼ NT n (vec(Y − XB), Σ ⊗ IT ) (B.16)
Now, apply B.13, and conclude that equivalently, the data density may be expressed a matrix normal
distribution:
1 h
i
−nT /2 −T /2 −n/2
f (y |B, Σ) = (2π) |Σ| |IT | exp − tr Σ−1 (Y − XB), IT −1 (Y − XB)
2
And this simplifies to:
1 h
i
−nT /2 −T /2
f (y |B, Σ) = (2π) |Σ| exp − tr Σ−1 (Y − XB), (Y − XB) (B.18)
2
The advantage of B.18 over B.14 is that it is computationally more efficient. In practical applications,
such as in the calculation of the data density for the marginal likelihood 1.9.36, it is thus this
formulation which will be retained.
Eventually, a feature of central interest is to be able to obtain random draws from a matrix normal
distribution. An algorithm to draw from a matrix normal distribution is provided by Karlsson (2012)
(see algorithm 19).
algorithm a.2.3.1 (random number generator for the matrix normal distribution): In order to
obtain a k × n random draw X from a matrix normal distribution with location matrix M , and scale
matrices Σ and Φ:
2. draw a kn×1 random vector w from a multivariate standard normal distribution, and redimen-
sion it to transform it into a k ×n random draw W from a standard matrix normal distribution,
using B.13.
247
A. Derivations
Σ ∼ IW(S, α)
1 1 n
o
f (Σ |S, α ) = |S|α/2 |Σ|−(α+n+1)/2 exp − tr Σ−1 S (B.19)
2αn/2 Γn α 2
2
where S is n × n symmetric positive definite matrix, and α is an integer value. Γn is the multivariate
Gamma function, defined as:
n
Γn (x) = π p(p−1)/4
Y
Γ (x + (1 − i)/2) (B.20)
i=1
1 n
o
−(α+n+1)/2
f (Σ |S, α ) ∝ |Σ| exp − tr Σ−1 S (B.21)
2
It has the following properties:
S
E(Σ) = for α > n + 1 (B.22)
α−n−1
For σi,j ∈ Σ:
Algorithm a.2.4.1 (random number generator for the inverse Wishart distribution): In order to
obtain a n × n random draw Σ from an inverse Wishart distribution with scale matrix S and degrees
of freedom α:
248
A. Derivations
4. eventually estimate X = C(Z , Z)−1 C , . Then X is a random draw from IW n (S, α).
1
E(X) = M and V ar(vec(X)) = (Σ ⊗ Φ) for α > 2 (B.27)
α−2
Another important property of the matrix-variate student is the following theorem (theorem 4.3.9 in
Gupta and Nagar (1999)):
249
A. Derivations
Mr1 r1 (Mc1 Mc2 )
M = =
Mr2 r2 c1 c2
Σ11 Σ12 c1
Σ =
Σ21 Σ22 c2
c1 c2
and
Φ11 Φ12 r1
Φ =
Φ21 Φ22 r2
r1 r2
then:
Xr1 ∼ M tr1 ,n (Mr1 , Σ, Φ11 , α)
and
Xc1 ∼ M tk,c1 (Mc1 , Σ11 , Φ, α)
In other words, if one partitions a matrix-student distribution with α degrees of freedom, then
the sub-partition remains a matrix-student distribution with α degrees of freedom, with mean and
covariance defined in accordance with the partitions. Going on with partitioning up to individual
entries of X, this result implies that:
That is, each individual element Xij of X follows a univariate student distribution with mean Mij ,
scale parameter Φii × Σjj and degrees of freedom α. This provides the mean and variance Xij , but no
direct way to compute confidence intervals. Because the definition of the matrix student distribution
provided by Gupta and Nagar (1999) differs from the classical student distribution with respect
to the scale parameter, some translation is required to compute correct results. Hence, to obtain
confidence intervals, consider a classical univariate location-scale student distribution with location
parameter µ and scale parameter σ, such that:
X = µ + σT
250
A. Derivations
where T follows a classical univariate student distribution. Then this distribution has the following
properties:
α
E(X) = µ and V ar(X) = σ 2 α−2
with α the degrees of freedom of the distribution. This implies that the univariate scale parameter
σ can be expressed as a function of the variance and degrees of freedom as:
s
α−2
σ= V ar(X) (B.29)
α
Because V ar(X) can be directly obtained for the matrix student distribution from B.27, a γ confi-
dence interval for the distribution can then be obtained in a classical way from:
where t(γ,α) is the is the γ th quantile of the standard student distribution with α degrees of freedom.
Eventually, in a way similar to the matrix normal and inverse Wishart distributions, an algorithm
to draw from the matrix student distribution is now introduced (see Karlsson (2012), algorithm 22).
algorithm a.2.5.1 (random number generator for the matrix variate student distribution):
In order to obtain a k × n random draw X from a matrix variate student distribution with location
M , scale matrices Σ and Φ, and degrees of freedom α:
1. first draw a n × n random matrix V from an inverse Wishart distribution with scale matrix Σ
and degrees of freedom α : V ∼ IWn (Σ, α), using algorithm a.2.2.
2. draw a k × n random matrix X from a matrix normal distribution: Z ∼ M Nk,n (M, V, Φ),
using algorithm a.2.1. Then X is a random draw from M tk,n (M, Σ, Φ, α).
x
f (x |a, b) ∝ xa−1 exp − (B.33)
b
251
A. Derivations
To sample from G (a, b), it is possible to use the following algorithm proposed by Marsaglia and
Tsang (2000):
3. generate v = (1 + cz)3 .
5. otherwise, go back to 2.
If 0 < a < 1:
2. generate u ∼ U (0, 1)
252
A. Derivations
Γ(a) denotes as usual the (univariate) Gamma function. The kernel of the distribution is given by:
!
−a−1 −b
f (x |a, b) ∝ x exp (B.37)
x
b b2
E(x) = for a>1 and var(x) = for a>2 (B.38)
a−1 (a − 1)2 (a − 2)
Another important property of the inverse Gamma is the following: if x follows a Gamma distribution
with shape a and scale b, then 1/x follows an inverse Gamma distribution with shape a and scale
1/b. That is:
x ∼ G(a, b) ⇒ 1/x ∼ IG(a, 1/b) (B.39)
It is then simple to propose the following algorithm to draw from IG(a, b):
algorithm a.2.7.1 (random number generator for the Inverse Gamma distribution):
Also, it turns out that the inverse Gamma distribution is a special univariate case of the inverse
Wishart distribution. To see this, consider the inverse Wishart density B.19 when n = 1 (univariate
case) so that Σ = x, S = 2b, α = 2a and compare with (B.36).
1 n
, o
π(β |y ) ∝ exp − y − X̄β Σ̄−1 y − X̄β + (β − β0 ), Ω−1
0 (β − β0 ) (C.1)
2
253
A. Derivations
To transform this expression, consider only the exponential part in the curly brackets and develop
it:
,
y − X̄β Σ̄−1 y − X̄β + (β − β0 ), Ω−1
0 (β − β0 )
,
, −1
= y , Σ̄−1 y + β , X̄ , Σ̄−1 X̄β − 2β , X̄ , Σ̄−1 y + β , Ω−1 , −1
0 β + β0 Ω0 β0 − 2β Ω0 β0
, −1
= y , Σ̄−1 y + β , Ω−1 , −1 , −1 , −1
0 + X̄ Σ̄ X̄ β − 2β Ω0 β0 + X̄ Σ̄ y + β0 Ω0 β0 (C.2)
Notice that C.1 resembles the kernel of a normal distribution, but with a sum of squares rather than
a single square term within the exponential part. It would therefore be nice to replace this sum by
a single square, to obtain the kernel of a normal distribution. This can be done by applying the
manipulations known as ”completing the square”. This most of the time amounts to adding and
subtracting an additional matrix term, and inserting the product of a matrix with its inverse. After
factoring, this will eventually lead to a single squared form, while the additional terms created will
be independent of β and will hence be relegated to the proportionality constant. Hence, complete
the squares in C.2):
, −1
= y , Σ̄−1 y+β , Ω−1 , −1 , −1 −1 , −1 , −1 , −1
0 + X̄ Σ̄ X̄ β−2β Ω̄ Ω̄ Ω0 β0 + X̄ Σ̄ y +β0 Ω0 β0 + β̄ Ω̄ β̄− β̄ Ω̄ β̄ (C.3)
Note that C.3 holds whatever the definition of Ω̄ and β̄ (as long as dimensions agree). Nevertheless,
one may obtain the desired squared form from C.3 by defining:
−1
Ω̄ = Ω−1 , −1
0 + X̄ Σ̄ X̄
and (C.4)
β̄ = Ω̄ Ω−1 , −1
0 β0 + X̄ Σ̄ y (C.5)
254
A. Derivations
1 n
, o
π(β |y ) ∝ exp − β − β̄ Ω̄−1 β − β̄ + β0, Ω−1 , −1 , −1
0 β0 − β̄ Ω̄ β̄ + y Σ̄ y
2
1 1 , −1
,
−1 , −1 , −1
∝ exp − β − β̄ Ω̄ β − β̄ × exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ̄ y
2 2
1
,
−1
∝ exp − β − β̄ Ω̄ β − β̄ (C.7)
2
where the last line obtains by noting that the second term in row 2 does not involve β and can hence
be relegated to the proportionality constant. Therefore, one finally obtains:
1
,
π(β |y ) ∝ exp −β − β̄ Ω̄−1 β − β̄ (C.8)
2
Which is 1.3.16 in the text. Finally, one may obtain a rewriting of C.5 and C.6.
h i−1
Ω̄ = Ω−1
0 +Σ
−1
⊗ X ,X (C.10)
h i
β̄ = Ω̄ Ω−1
0 β0 + (Σ
−1
⊗ X , )y (C.12)
The advantage of C.9 and C.10 over C.5 and C.6 is that they are numerically much faster to compute.
One can then eventually recognise C.9 and C.10 as 1.3.17 and 1.3.18 in the text.
255
A. Derivations
1
−1/2 ,
f (y |β, Σ) ∝ Σ̄ y − X̄β Σ̄−1 y − X̄β
exp −
2
For our purpose, it will be easier to use 1.1.13 and 1.1.14 to reformulate the likelihood as:
1n
o
−1/2
f (y |β, Σ ) ∝ |Σ ⊗ IT | exp − (y − (In ⊗ X)β), (Σ ⊗ IT )−1 (y − (In ⊗ X)β) (D.1)
2
Consider only the part within the curly brackets and develop it:
256
A. Derivations
= y , Σ−1 ⊗ IT y − 2β̂ , Σ−1 ⊗ X , y + 2β̂ , Σ−1 ⊗ X , X β̂
− 2β , Σ−1 ⊗ X , X β̂ + β , Σ−1 ⊗ X , X β
= y , Σ−1 ⊗ IT y − 2β̂ , Σ−1 ⊗ X , y + β̂ , Σ−1 ⊗ X , X β̂
+ β̂ , Σ−1 ⊗ X , X β̂ − 2β , Σ−1 ⊗ X , X β̂ + β , Σ−1 ⊗ X , X β
= y , Σ−1 ⊗ IT y − 2β̂ , Σ−1 ⊗ X , y + β̂ , Σ−1 ⊗ X , X β̂
,
+ (β − β̂) Σ−1 ⊗ X , X (β − β̂)
= y , Σ−1 ⊗ IT y − 2β̂ , Σ−1 ⊗ X , y + β̂ , Σ−1 ⊗ X , X β̂
, −1
+ (β − β̂) Σ ⊗ (X , X)−1 (β − β̂) A.2 (D.4)
The second row of D.4 has a nice squared form, while the first row requires some additional work.
Hence, focus on the first row only:
y , Σ−1 ⊗ IT y − 2β̂ , Σ−1 ⊗ X , y + β̂ , Σ−1 ⊗ X , X β̂
= y , Σ−1 ⊗ IT y − 2β̂ , (In ⊗ X), Σ−1 ⊗ IT y + β̂ , Σ−1 ⊗ X , (In ⊗ X) β̂ A.6
,
= y , Σ−1 ⊗ IT y − 2 (In ⊗ X) β̂ Σ−1 ⊗ IT y + β̂ , (In ⊗ X), Σ−1 ⊗ IT (In ⊗ X) β̂ A.6
,
= y , (Σ ⊗ IT )−1 y − 2 (In ⊗ X) β̂ (Σ ⊗ IT )−1 y + β̂ , (In ⊗ X), (Σ ⊗ IT )−1 (In ⊗ X) β̂ A.2
n o n , o n o
= tr Σ−1 Y , IT Y − 2tr Σ−1 (X B̂) IT Y + tr Σ−1 B̂ , X , IT X B̂ A.13
n o n o n o
= tr Y Σ−1 Y , − 2tr Y Σ−1 B̂ , X , + tr X B̂Σ−1 B̂ , X , Q.17
n o
= tr Y Σ−1 Y , − 2Y Σ−1 B̂ , X , + X B̂Σ−1 B̂ , X , Q.17
n ,o
= tr (Y − X B̂)Σ−1 (Y − X B̂)
n , o
= tr Σ−1 (Y − X B̂) (Y − X B̂) A.1
Before turning back to D.1, note also that Kronecker property A.7 implies that the determinant part
of D.1 can rewrite as:
257
A. Derivations
−1/2
|Σ ⊗ IT |−1/2 = |Σ|T |IT |n = |Σ|−T /2 = |Σ|−k/2 |Σ|−(T −k)/2 = |Σ|−k/2 |Σ|−[(T −k−n−1)+n+1]/2 (D.6)
D.7 is just 1.6.3 in the text. It can be recognised as the product of two kernels: the kernel of a
−1
multivariate normal distribution for β (given Σ), with mean β̂ and covariance Σ ⊗ (X , X)−1 and
,
the kernel of an inverse Wishart distribution for Σ, with scale matrix (Y − X B̂) (Y − X B̂) and
degrees of freedom T − k − n − 1.
With the likelihood determined it is now possible to estimate the posterior distribution for β and Σ.
As it will be more convenient to work with all equations expressed in terms of trace operators, start
by reshaping the first row of D.7. This is easily done by noting that:
, −1 n , o
(β − β̂) Σ ⊗ (X , X)−1 (β − β̂) = tr Σ−1 B − B̂ (X , X) B − B̂ A.13
Hence, using the previous expression, and collecting powers on |Σ|, D.7 rewrites as:
1 n , o
−T /2
f (y |β, Σ) ∝ |Σ| exp − tr Σ−1 B − B̂ (X , X) B − B̂
2
1 n −1
o
,
∝ exp − tr Σ (Y − X B̂) (Y − X B̂) (D.8)
2
Also, using once again A.13, the prior density for β A.12 rewrites as:
1
−k/2
π(β) ∝ |Σ| exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 )
2
1 n
o
∝ |Σ|−k/2 exp − tr Σ−1 (B − B0 ), Φ−10 (B − B 0 ) (D.9)
2
Applying Bayes rule 1.2.5 on the likelihood D.8 and the priors D.9 and 1.4.14, one obtains:
258
A. Derivations
Rearrange:
1 n
h , io
−(T +k+α0 +n+1)/2
π(β, Σ |y ) ∝ |Σ| exp − tr Σ−1 B − B̂ (X , X) B − B̂ + (B − B0 ), Φ−1
0 (B − B0 )
2
1 n
h , io
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) (D.11)
2
Focus first on the term in the curly brace in the first row of D.11 :
h , i
= Σ−1 B − B̂ (X , X) B − B̂ + (B − B0 ), Φ−1
0 (B − B0 )
h i
, −1
= Σ−1 B , X , XB + B̂ , X , X B̂ − 2B , X , X B̂ + B , Φ−1 , −1
0 B + B0 Φ0 B0 − 2B Φ0 B0
h i
, −1
= Σ−1 B , X , X + Φ−1
0 B − 2B , X , X B̂ + Φ−1 , ,
0 B0 + B̂ X X B̂ + B0 Φ0 B0
, −1
= Σ−1 [B , X , X + Φ−1
0 B −2B , Φ̄−1 Φ̄ X , X B̂ + Φ−1 , −1 , −1 , ,
0 B0 + B̄ Φ̄ B̄ − B̄ Φ̄ B̄ + B̂ X X B̂ +B0 Φ0 B0 ]
Now, define:
h i−1
Φ̄ = Φ−1 ,
0 +X X (D.12)
and
h i
B̄ = Φ̄ Φ−1 ,
0 B0 + X X B̂ (D.13)
259
A. Derivations
h i
= Σ−1 B , Φ̄−1 B − 2B , Φ̄−1 B̄ + B̄ , Φ̄−1 B̄ − B̄ , Φ̄−1 B̄ + B̂ , X , X B̂ + B0, Φ−1
0 B0
,
h i
= Σ−1 (B − B̄) Φ̄−1 (B − B̄) − B̄ , Φ̄−1 B̄ + B̂ , X , X B̂ + B0, Φ−1
0 B0
,
h i h i
= Σ−1 (B − B̄) Φ̄−1 (B − B̄) + Σ−1 B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
π(β, Σ |y ) ∝
1 n
,
h i h io
−(T +k+α0 +n+1)/2
|Σ| exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄) + Σ−1 B̂ , X , X B̂ + B0, Φ−1
0 B0 − B̄ , −1
Φ̄ B̄
2
1 n
h , io
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂)
2
1 n −1 h
io
−(T +k+α0 +n+1)/2 , −1
= |Σ| exp − tr Σ (B − B̄) Φ̄ (B − B̄)
2
1 n
io
h ,
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) + B̂ , X , X B̂ + B0, Φ−1
0 B0 − B̄ , −1
Φ̄ B̄
2
1
,
n h io
= |Σ|−k/2 exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄)
2
1 n
io
h ,
× |Σ|−(T +α0 +n+1)/2 exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) + B̂ , X , X B̂ + B0, Φ−10 B0 − B̄ , −1
Φ̄ B̄
2
Define:
ᾱ = T + α0 (D.14)
and
,
S̄ = Y − X B̂ Y − X B̂ + S0 + B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (D.15)
1 n
,
h io
−k/2
π(β, Σ |y ) ∝ |Σ| exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄)
2
1 n −1 o
−(ᾱ+n+1)/2
× |Σ| exp − tr Σ S̄ (D.16)
2
This can be recognised as the product of a matrix-variate normal distribution with mean B̄ and
variance matrices Σ and Φ̄, and an inverse Wishart distribution with scale matrix S̄ and degrees of
freedom ᾱ. Alternatively, using A.13, one can rewrite D.16 as:
260
A. Derivations
1
−1
,
π(β, Σ |y ) ∝ |Σ|−k/2 exp − (β − β̄) Σ ⊗ Φ̄ (β − β̄)
2
1 n −1 o
−(ᾱ+n+1)/2
× |Σ| exp − tr Σ S̄ (D.17)
2
and recognise for β the kernel of a multivariate normal distribution with mean β̄ = vec(B̄) and
covariance matrix Σ ⊗ Φ̄.
Note finally that this is a joint distribution, while the objects of interest are the marginal distri-
butions for β and Σ. Deriving the marginal for Σ using 1.2.7 is quite trivial: it is easy to integrate
out β as it only appears in the first term of D.17 as a multivariate normal variable. Doing so leaves
us only with the second term. The details are as follows:
Z
π(Σ |y ) = π(β, Σ |y )dβ
β
1 1 n
Z −1
,
o
−k/2
∝ |Σ| exp − (β − β̄) Σ ⊗ Φ̄ (β − β̄) × |Σ|−(ᾱ+n+1)/2 exp − tr Σ−1 S̄ dβ
β 2 2
1 1
Z −1
,
n o
−(ᾱ+n+1)/2 −1 −k/2
= |Σ| exp − tr Σ S̄ × |Σ| exp − (β − β̄) Σ ⊗ Φ̄ (β − β̄) dβ
2 β 2
1
n o
= |Σ|−(ᾱ+n+1)/2 exp − tr Σ−1 S̄ (D.18)
2
Which is once again immediately recognised as the kernel of an inverse Wishart distribution :
π(Σ |y ) ∼ IW ᾱ, S̄ (D.19)
Deriving the posterior for β is trickier. Start by regrouping terms in D.16, then integrate with respect
to Σ :
Z
π(β |y ) = π(β, Σ |y )dΣ
Σ
1 n
Z
,
h io
−(k+ᾱ+n+1)/2
∝ |Σ| exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄) + S̄ dΣ
Σ 2
,
Since the integrand has the form of an inverse Wishart distribution with scale matrix (B − B̄) Φ̄−1 (B−
B̄) + S̄ and degrees of freedom k + ᾱ, integration yields the reciprocal of the constant of that function
1
:
1
Indeed, if a random variable X has density f (X) = c×g(X), Rwith c the proportionality R g(X) the vari-
constant and
able part, then from the definition of a density, one obtains 1 = X f (X)dX = c X g(X)dX, so that X g(X)dX = 1c .
R
261
A. Derivations
!
(k+ᾱ)n k + ᾱ ,
− k+ᾱ
π(β |y ) ∝ 2 2 Γn × S̄ + (B − B̄) Φ̄−1 (B − B̄) 2 (D.20)
2
But only the final term contains B. Accordingly, eliminating from D.20 the terms belonging to the
proportionality constant, one obtains:
,
− k+ᾱ
π(β |y ) ∝ S̄ + (B − B̄) Φ̄−1 (B − B̄)
2
n ,
o− k+T +α0
= S̄ In + S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
− k+T +α0 ,
− k+T +α0
= S̄ 2
In
+ S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
,
− k+T +α0
∝ In + S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
,
− [T +α0 −n+1]+n+k−1
= In + S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
Hence:
,
− [T +α0 −n+1]+n+k−1
π(β |y ) ∝ In + S̄ −1 (B − B̄) Φ̄−1 (B − B̄) 2
(D.21)
This is the kernel of a matrix-variate student distribution with mean B̄, scale matrices S̄ and Φ̄, and
degrees of freedom α = T + α0 − n + 1.
B.28 then implies that each individual element Bi,j of B follows a univariate student distribution
with mean B̄i,j , scale parameter Φ̄i,i × S̄j,j and degrees of freedom α.
Therefore, conditional on prior choices for β0 , Φ0 , S0 and α0 , point estimates and inference can be
realised on β and Σ from D.19 and D.22 , D.23 .
It should also be clear now why the Kronecker structure Σ ⊗ Φ0 is imposed on the variance matrix
of the prior distribution for β. Without this structure, it would be impossible to transform the prior
distribution π(β) into a trace argument as done in D.9. It would then not be possible to complete
the squares and reformulate the posterior as in D.16, which is necessary to derive the unconditional
marginal posterior of B as a student distribution.
262
A. Derivations
Finally, notice that it is possible to simplify some of the expressions derived in this section. The
first term that can be simplified is S̄, defined in D.15. Keeping in mind definition 1.7.2 of the OLS
estimate B̂, notice that:
,
(Y − X B̂) (Y − X B̂) + B̂ , X , X B̂
, ,
= Y , Y − Y , X B̂ − (X B̂) Y + (X B̂) (X B̂) + B̂ , X , X B̂
= Y , Y − Y , X B̂ − B̂ , X , Y + B̂ , X , X B̂ + B̂ , X , X B̂
= Y , Y − Y , X B̂ − B̂ , X , Y + 2B̂ , X , X B̂
n o n o, n o, n o
= Y , Y − Y , X (X , X)−1 X , Y − (X , X)−1 X , Y X , Y + 2 (X , X)−1 X , Y X , X (X , X)−1 X , Y
= Y , Y − Y , X(X , X)−1 X , Y − Y , X(X , X)−1 X , Y + 2Y , X(X , X)−1 X , X(X , X)−1 X , Y
= Y , Y − 2Y , X(X , X)−1 X , Y + 2Y , X(X , X)−1 X , Y
= Y ,Y
,
S̄ = (Y − X B̂) (Y − X B̂) + S0 + B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
= Y , Y + S0 + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (D.24)
h i h n oi h i
−1 ,
B̄ = Φ̄ Φ−1 , −1 , ,
0 B0 + X X B̂ = Φ̄ Φ0 B0 + X X (X X) X Y = Φ̄ Φ−1 ,
0 B0 + X Y
The likelihood is similar as that of a normal Wishart and is thus given by 1.4.3, rewritten here
with simplified powers on |Σ|:
263
A. Derivations
1
, −1
f (y |β, Σ) ∝ |Σ|−T /2 exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂)
2
(E.1)
The prior for β is given by 1.5.3, and that for Σ is given by 1.5.5. Using Bayes rule 1.2.5, the posterior
is then given by:
1
, −1
π(β, Σ |y ) ∝ |Σ|−T /2 exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂)
2
1
, −1
× exp − (β − β0 ) Ω0 (β − β0 )
2
1 n −1 o
−(α0 +n+1)/2
× |Σ| exp − tr Σ S0
2
(E.2)
1 n
, o
−(T +α0 +n+1)/2
π(β, Σ |y ) ∝ |Σ| exp − β − β̂ Σ−1 ⊗ X , X β − β̂ + (β − β0 ), Ω−1
0 (β − β0 )
2
1 n
h , io
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) (E.3)
2
Consider only the term in the curly brackets in the first row:
,
β − β̂ Σ−1 ⊗ X , X β − β̂ + (β − β0 ), Ω−1
0 (β − β0 )
= β , Σ−1 ⊗ X , X β + β̂ , Σ−1 ⊗ X , X β̂ − 2β , Σ−1 ⊗ X , X β̂
, −1
+ β , Ω−1 , −1
0 β + β0 Ω0 β0 − 2β Ω0 β0
h i h i
= β , Ω−1
0 +Σ
−1
⊗ X , X β − 2β , Ω−1
0 β0 + Σ
−1
⊗ X , X β̂ + β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1
0 β0
264
A. Derivations
h i h i
= β , Ω−1
0 +Σ
−1
⊗ X , X β − 2β , Ω̄−1 Ω̄ Ω−1
0 β0 + Σ
−1
⊗ X , X β̂ + β̄ , Ω̄−1 β̄ − β̄ , Ω̄−1 β̄
+ β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1
0 β0
Define:
h i−1
Ω̄ = Ω−1
0 +Σ
−1
⊗ X ,X (E.4)
h i
β̄ = Ω̄ Ω−1
0 β0 + Σ
−1
⊗ X , X β̂ (E.5)
= β , Ω̄−1 β − 2β , Ω̄−1 β̄ + β̄ , Ω̄−1 β̄ − β̄ , Ω̄−1 β̄ + β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1
0 β0
,
= (β − β̄) Ω̄−1 (β − β̄) − β̄ , Ω̄−1 β̄ + β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1
0 β0
1
−(T +α0 +n+1)/2 ,
π(β, Σ |y ) ∝ |Σ| exp − (β − β̄) Ω̄−1 (β − β̄)
2
1 n , −1
o
× exp − β̂ Σ ⊗ X , X β̂ + β0, Ω−1
0 β0 − β̄ , −1
Ω̄ β̄
2
1 n
io
h ,
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂) (E.6)
2
E.6 is recognised as 1.5.8 in the text. Note also that E.5 can be simplified. Consider the part
(Σ−1 ⊗ X , X) β̂, and use definition D.3 of β̂ to obtain:
Σ−1 ⊗ X , X β̂
−1
= Σ−1 ⊗ X , X Σ−1 ⊗ X , X Σ−1 ⊗ X , y
= Σ−1 ⊗ X , y
h i
β̄ = Ω̄ Ω−1
0 β0 + (Σ
−1
⊗ X , )y (E.7)
265
A. Derivations
E.4 and E.7 are then recognised as 1.5.9 and 1.5.10 in the text. One may also note that E.7 and
1.3.18 are similar, implying that the independent normal Wishart prior yields a (conditional) posterior
comparable to the Minnesota posterior with respect to β.
Now compute the conditional distributions. Relegating any term not involving β in E.6 to a propor-
tionality constant, one obtains the distribution of β, conditional on Σ:
1
−(T +α0 +n+1)/2 ,
π(β |Σ, y ) ∝ |Σ| exp − (β − β̄) Ω̄−1 (β − β̄) (E.8)
2
This is recognised as the kernel of a multivariate normal distribution:
To obtain the posterior for Σ, conditional on β, it is easier to work directly on E.3, since E.6 contains
β̄ and Ω̄, which are complicated functions of Σ and do not allow transformations into trace arguments.
Hence consider the posterior E.3, ignore terms not involving Σ, and notice that the remaining terms
rewrite as:
1
−1
,
π(Σ |β, y ) ∝ |Σ|−(T +α0 +n+1)/2 exp − (β − β̂) Σ ⊗ (X , X)−1 (β − β̂) A.2
2
1 n
h , io
× exp − tr Σ−1 S0 + (Y − X B̂) (Y − X B̂)
2
1 n
o
,
= |Σ|−(T +α0 +n+1)/2 exp − tr Σ−1 (B − B̂) (X , X)(B − B̂) A.2
2
1 n −1 h
io
,
× exp − tr Σ S0 + (Y − X B̂) (Y − X B̂)
2
1 n −1 h
io
−[(T +α0 )+n+1]/2 , , ,
= |Σ| exp − tr Σ (B − B̂) (X X)(B − B̂) + S0 + (Y − X B̂) (Y − X B̂)
2
(E.10)
, ,
Ŝ = (B − B̂) (X , X)(B − B̂) + S0 + (Y − X B̂) (Y − X B̂) (E.12)
α̂ = T + α0 (E.13)
266
A. Derivations
Eventually, note that similarly to the normal-Wishart prior, it is possible to apply some simplifi-
cations. Consider Ŝ, defined in E.12. Using once again definition 1.7.2 of the OLS estimate B̂,
simplify:
, ,
(B − B̂) (X , X)(B − B̂) + (Y − X B̂) (Y − X B̂)
= B , (X , X)B − B , (X , X)B̂ − B̂ , (X , X)B + B̂ , (X , X)B̂
, ,
+ Y , Y − Y , X B̂ − (X B̂) Y + (X B̂) (X B̂)
= B , X , XB − B , X , X B̂ − B̂ , X , XB + B̂ , X , X B̂
+ Y , Y − Y , X B̂ − B̂ , X , Y + B̂ , X , X B̂
n o n o, n o, n o
= B , X , XB − B , X , X (X , X)−1 X , Y − (X , X)−1 X , Y X , XB + (X , X)−1 X , Y X , X (X , X)−1 X , Y
n o n o, n o, n o
+ Y , Y − Y , X (X , X)−1 X , Y − (X , X)−1 X , Y X , Y + (X , X)−1 X , Y X , X (X , X)−1 X , Y
= B , X , XB − B , X , X(X , X)−1 X , Y − Y , X(X , X)−1 X , XB + Y , X(X , X)−1 X , X(X , X)−1 X , Y
+ Y , Y − Y , X(X , X)−1 X , Y − Y , X(X , X)−1 X , Y + Y , X(X , X)−1 X , X(X , X)−1 X , Y
= B , X , XB − B , X , Y − Y , XB + Y , X(X , X)−1 X , Y
+ Y , Y − Y , X(X , X)−1 X , Y − Y , X(X , X)−1 X , Y + Y , X(X , X)−1 X , Y
= Y , Y − Y , XB − B , X , Y + B , X , XB
= (Y − XB), (Y − XB)
(E.14)
, ,
Ŝ = (B − B̂) (X , X)(B − B̂) + S0 + (Y − X B̂) (Y − X B̂)
= (Y − XB), (Y − XB) + S0
(E.15)
1 n
o
−[(T +α0 )+n+1]/2
π(Σ |β, y ) ∝ |Σ| exp − tr Σ−1 [(Y − XB), (Y − XB) + S0 ] (E.16)
2
267
A. Derivations
1
, −1
−T /2
f (y |β, Σ) ∝ |Σ| exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (F.1)
2
The priors for β and Σ are respectively given by 1.6.2 and 1.6.3:
1
π(β) ∝ exp − (β − β0 ), Ω−1
0 (β − β0 ) (F.2)
2
and
1
, −1
−T /2
π(β, Σ |y ) ∝ |Σ| exp − β − β̂ Σ ⊗ (X , X)−1 β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂)
2
1
, −1
× exp − (β − β0 ) Ω0 (β − β0 )
2
−(n+1)/2
× |Σ|
(F.4)
1
,
0 −1 0
π(β, Σ |y ) ∝|Σ|−T /2 exp − β − β̂ Σ−1 ⊗ (X X) β − β̂ + (β − β0 ) Ω−1
0 (β − β 0 )
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (F.5)
2
The expression in the curly brackets appearing in the first term is similar to that in E.3. Hence,
using the same process as in Appendix E, one shows that it rewrites as:
268
A. Derivations
,
β − β̂ Σ−1 ⊗ X , X β − β̂ + (β − β0 ), Ω−1
0 (β − β0 )
,
= (β − β̄) Ω̄−1 (β − β̄) − β̄ , Ω̄−1 β̄ + β̂ , Σ−1 ⊗ X , X β̂ + β0, Ω−1
0 β0 (F.6)
h i−1
Ω̄ = Ω−1
0 +Σ
−1
⊗ X ,X (F.7)
and
h i
β̄ = Ω̄ Ω−1
0 β0 + (Σ
−1
⊗ X , )y (F.8)
1
,
π(β, Σ |y ) ∝ |Σ|−(T +n+1)/2 exp − (β − β̄) Ω̄−1 (β − β̄)
2
1 n , −1
o
× exp − β̂ Σ ⊗ X , X β̂ + β0, Ω−1 0 β 0 − β̄ , −1
Ω̄ β̄
2
1 n −1
o
,
× exp − tr Σ (Y − X B̂) (Y − X B̂) (F.9)
2
Now compute the conditional distributions. Relegating any term not involving β in F.9 to a propor-
tionality constant, one obtains the distribution of β, conditional on Σ:
1
,
π(β |Σ, y ) ∝ exp − (β − β̄) Ω̄−1 (β − β̄) (F.10)
2
This is recognised as the kernel of a multivariate normal distribution:
To obtain the posterior for Σ, conditional on β, it is once again easier to work directly on the primary
posterior expression F.5, rather than with the modified expression F.9. Hence consider the posterior
F.5, ignore terms not involving Σ, and notice that the remaining terms rewrite as:
269
A. Derivations
1
,
π(Σ |β, y ) ∝ |Σ|−(T +n+1)/2 exp − β − β̂ Σ−1 ⊗ X , X β − β̂
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂)
2
1 n −1
o
−(T +n+1)/2 , ,
= |Σ| exp − tr Σ (B − B̂) (X X)(B − B̂)
2
1 n −1
o
,
× exp − tr Σ (Y − X B̂) (Y − X B̂)
2
1 n −1 h
io
−(T +n+1)/2 , , ,
= |Σ| exp − tr Σ (B − B̂) (X X)(B − B̂) + (Y − X B̂) (Y − X B̂) (F.12)
2
1 n
o
π(Σ |β, y ) ∝ |Σ|−[(T +α0 )+n+1]/2 exp − tr Σ−1 [(Y − XB), (Y − XB)]
2
One then recognises in F.12 the kernel of an inverse Wishart distribution
1 n
−(T +n+1)/2 , o
f (β, Σ |y ) ∝ |Σ| exp − tr Σ−1 (B − B̂) (X , X)(B − B̂)
2
1 n
, o
× exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (G.1)
2
1 n
−k/2 , o
f (β, Σ |y ) ∝ |Σ| exp − tr Σ−1 (B − B̂) (X , X)(B − B̂)
2
1
o
−(T −k+n+1)/2
n
−1 ,
× |Σ| exp − tr Σ (Y − X B̂) (Y − X B̂) (G.2)
2
270
A. Derivations
1 n
Z
−k/2 , o
f (Σ |y ) ∝ |Σ| exp − tr Σ−1 (B − B̂) (X , X)(B − B̂) dB
B 2
1
o
−(T −k+n+1)/2
n
−1 ,
× |Σ| exp − tr Σ (Y − X B̂) (Y − X B̂)
2
1 n
o
,
= |Σ|−(T −k+n+1)/2 exp − tr Σ−1 (Y − X B̂) (Y − X B̂) (G.3)
2
This is the kernel of an inverse Whishart distribution: Σ ∼ IW Ŝ, α̂ , with scale matrix :
,
Ŝ = (Y − X B̂) (Y − X B̂) (G.4)
α̂ = T − k (G.5)
Now integrate with respect to Σ to obtain the posterior for β. To make things easier, gather first
terms in G.1:
1 n
−(T +n+1)/2
h , io
f (β, Σ |y ) ∝ |Σ| exp − tr Σ−1 Ŝ + (B − B̂) (X , X)(B − B̂) (G.6)
2
,
This can be recognized as the kernel of an inverse-Wishart density with scale matrix Ŝ+(B − B̂) (X , X)(B−
B̂) and degrees of freedom T . To integrate, note that similarly to appendix 4, integration will yield
the reciprocal of the normalizing constant of the inverse-Wishart density:
1 n
Z
−(T +n+1)/2
h , io
π(β |y ) ∝ |Σ| exp − tr Σ−1 Ŝ + (B − B̂) (X , X)(B − B̂) dΣ
Σ 2
T − T
Tn ,
Ŝ + (B − B̂) (X , X)(B − B̂)
2
∝2 2 Γn
2
Since only the determinant term comprises B, eliminate the other parts:
271
A. Derivations
, − T
π(β |y ) ∝ Ŝ + (B − B̂) (X , X)(B − B̂)
2
n , o− T
= Ŝ I + Ŝ −1 (B − B̂) (X , X)(B − B̂)
2
− T n , o− T
I + Ŝ −1 (B − B̂) (X , X)(B − B̂)
2 2
= Ŝ
n , o− T
In + Ŝ −1 (B − B̂) (X , X)(B − B̂)
2
∝
o− (T −n−k+1)+n+k−1
, −1
n
∝ In + Ŝ −1 (B − B̂) ((X , X)−1 ) (B − B̂)
2
_
This is recognized as the kernel of a matrix student distribution: B˜M T (B̂, Ŝ, Φ̂, α), with B̂ and Ŝ
defined by 1.7.2 and 1.7.6, and:
Φ̂ = (X , X)−1 (G.7)
And
_
α=T −n−k+1 (G.8)
It is now shown how to recover a VAR in error correction form from a standard VAR formulation.
In general, a reduced-form VAR with p lags writes as:
yt = A1 yt−1 + A2 yt−2 + ... + Ap yt−p + Cxt + εt
From this formulation, manipulate to obtain :
p
X
yt = Ai yt−i + Cxt + εt
i=1
p
X
⇒ yt − yt−1 = Ai yt−i − yt−1 + Cxt + εt
i=1
p
X p
X p
X
⇒ yt − yt−1 = Ai yt−i + Aj yt−j − Aj yt−j − yt−1 + Cxt + εt
i=1 j=i+1 j=i+1
p
X
! p−1
X p
X
⇒ yt − yt−1 = − I − Ai yt−1 − Aj (yt−i − yt−i−1 ) + Cxt + εt
i=1 i=1 j=i+1
p
X
! p−1
X p
X
⇒ ∆yt = − I − Ai yt−1 − Aj ∆yt−i + Cxt + εt
i=1 i=1 j=i+1
p
X
! p−1
X
⇒ ∆yt = − I − Ai yt−1 + Bi ∆yt−i + Cxt + εt
i=1 i=1
272
A. Derivations
⇒ ∆yt = −(I − A1 − A2 ... − Ap )yt−1 + B1 ∆yt−1 + B2 ∆yt−2 + ... + Bp−1 ∆yt−(p−1) + Cxt + εt (G.9)
with:
p
Bi = −
P
Aj
j=i+1
This is the error correction form 1.7.28.
273
A. Derivations
1 , −1
−1/2 1/2
m(y) = (2π)−nT /2 Σ̄ |Ω0 |−1/2 Ω̄ exp − β0 Ω0 β0 − β̄ , Ω̄−1 β̄ + y , Σ̄−1 y
2
h i−1 1/2
−nT /2 −1/2 −1/2
= (2π) |Σ ⊗ IT | |Ω0 | Ω−1
0 +Σ −1 ,
⊗ X X
1 , −1
× exp − β Ω β0 − β̄ , Ω̄−1 β̄ + y , (Σ ⊗ IT )−1 y
2 0 0
−1/2
= (2π)−nT /2 |Σ|−T /2 |IT |−n/2 |Ω0 |−1/2 Ω−10 +Σ
−1
⊗ X , X
1 , −1
, −1 , −1
× exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ ⊗ IT y
2
−1/2
= (2π)−nT /2 |Σ|−T /2 |Ω0 | Ω−1
0 +Σ
−1
⊗ X ,X
1 , −1
, −1 , −1
× exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ ⊗ IT y
2
−1/2
= (2π)−nT /2 |Σ|−T /2 Ω0 Ω−1 0 +Σ
−1
⊗ X ,X
1
× exp − β0, Ω−1 0 β 0 − β̄ , −1
Ω̄ β̄ + y ,
Σ −1
⊗ IT y
2
−1/2
= (2π)−nT /2 |Σ|−T /2 Ink + Ω0 Σ−1 ⊗ X , X
1 , −1
, −1 , −1
× exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ ⊗ IT y
2
−1/2
= (2π)−nT /2 |Σ|−T /2 Ink + FΩ FΩ, Σ−1 ⊗ X , X
1 , −1
, −1 , −1
× exp − β0 Ω0 β0 − β̄ Ω̄ β̄ + y Σ ⊗ IT y
2
From A.21, the determinant |Ink + FΩ, (Σ−1 ⊗ X , X) FΩ | can be obtained from the product of 1 plus
the eigenvalues of FΩ, (Σ−1 ⊗ X , X) FΩ .
274
A. Derivations
ᾱ
n/2 −ᾱ/2 2ᾱn/2 Γn
(2π)−nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
m(y) =
α0
2α0 n/2 Γn 2
n/2 −ᾱ/2 2(T +α0 )n/2 Γn ᾱ
2−nT /2 π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
=
α0
2α0 n/2 Γn 2
n/2 −ᾱ/2 2α0 n/2 Γn ᾱ
2−nT /2 2nT /2 π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
=
α0
2α0 n/2 Γn 2
ᾱ
n/2 −ᾱ/2 Γn
π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
=
α0
Γn 2
which is 1.9.25.
Now show how to obtain 1.9.26, for improved numerical accuracy. Start from 1.9.25:
ᾱ
n/2 −ᾱ/2 Γn
π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ̄ S̄
2
m(y) =
α0
Γn 2
ᾱ
−n/2 −ᾱ/2 Γn
π −nT /2 |Φ0 |−n/2 |S0 |α0 /2 Φ−1
2
= 0 + X , X S̄
α0
Γn 2
−n/2
Consider only the part |Φ0 |−n/2 Φ−1 ,
0 + X X :
−n/2 −n/2
|Φ0 |−n/2 Φ−1 ,
0 + X X = |Φ0 |−n/2 Φ−1 ,
0 . |IT + XΦ0 X | A.16
where FΦ denotes the square root matrix of Φ0 , that is, FΦ FΦ, = Φ0 . Then, substituting, one even-
tually obtains:
275
A. Derivations
−ᾱ/2 Γ ᾱ
n( 2 )
m(y) = π −nT /2 |S0 |α0 /2 |Ik + FΦ, X , XFΦ |−n/2 S̄
α0
Γn ( 2 )
−ᾱ/2
Now consider the part |S0 |α0 /2 S̄ :
−ᾱ/2 −ᾱ/2
|S0 |α0 /2 S̄ = |S0 |α0 /2 S0 + Y , Y + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
n h io−ᾱ/2
= |S0 |α0 /2 |S0 | In + S0−1 Y , Y + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ A.16
h i−ᾱ/2
= |S0 |α0 /2 |S0 |−ᾱ/2 In + S0−1 S̄ − S0
h i−ᾱ/2
= |S0 |α0 /2 |S0 |−(T +α0 )/2 In + S0−1 S̄ − S0
h i−ᾱ/2
= |S0 |−T In + FS FS, S̄ − S0
Substituting back:
Γn ( ᾱ )
h i −ᾱ/2
m(y) = π −nT /2 Γ α20 |Ik + FΦ, X , XFΦ |−n/2 |S0 |−T /2 In + FS, S̄ − S0 FS
n( 2 )
which is 1.9.26.
276
A. Derivations
1 h
−T /2
,
i
m(y) = (2π)−nT /2 Σ̃ exp − tr Σ̃−1 (Y − X B̃) (Y − X B̃)
2
,
−q/2 −1/2
(2π) |Ω0 | exp − 2 (β̃ − β0 ) Ω−1
1
0 β̃ − β0
× −1/2 ,
(2π)−q/2 Ω̄ exp − 12 (β̃ − β̄) Ω̄−1 (β̃ − β̄)
1 1 n −1 o 1
α0 /2 −(α+n+1)/2
× |S0 | Σ̃ exp − tr Σ̃ S0 ×
2α0 n/2 Γn 20α 2 π(Σ̃ |y )
1 h
−T /2
,
i
= (2π)−nT /2 Σ̃ exp − tr Σ̃−1 (Y − X B̃) (Y − X B̃)
2
,
−1/2
|Ω0 | exp − 2 (β̃ − β0 ) Ω−1
1
0 β̃ − β0
× −1/2
Ω̄
1 1 n −1 o 1
−(α0 +n+1)/2
× |S0 |α0 /2 Σ̃ exp − tr Σ̃ S 0 ×
2α0 n/2 Γn α0 2 π(Σ̃ |y )
2
(2π)−nT /2 1 h
−(T +α0 +n+1)/2 oi
,
n
= |S0 |α0 /2 Σ̃ exp − tr Σ̃−1 (Y − X B̃) (Y − X B̃) + S0
2α0 n/2 Γn α0 2
2
−1/2
|Ω | 1 1
,
× 0 exp − (β̃ − β0 ) Ω−1
0 β̃ − β0 ×
Ω̄ 2 π(Σ̃ |y )
−1/2
−nT /2
(2π) −(T +α 0 +n+1)/2 |Ω |
m(y) = |S0 |α0 /2 Σ̃ 0
α n/2 α
2 0 Γn 2 0
Ω̄
1 h
oi
,
n
× exp − tr Σ̃−1 (Y − X B̃) (Y − X B̃) + S0
2
1 1
, −1
× exp − (β̃ − β0 ) Ω0 β̃ − β0 × It−Bu
2
(It − Bu)−1 π(Σ̃ |β (n) , y )
P
n=1
277
A. Derivations
−1/2
|Ω | 1/2
0 = |Ω0 |−1/2 Ω̄
Ω̄
h i−1 1/2
−1/2
= |Ω0 | Ω−1
0
−1
+ Σ̃ ⊗ X X ,
, −1/2
= |Ω0 |−1/2 Ω−10 + Σ̃ −1
⊗ X X
−1/2
= |Ω0 |−1/2 Ω−1 + (I ⊗ X ,
) Σ̃ −1
⊗ X A.19
0 n
, −1/2
= |Ω0 |−1/2 Ω−1 I + Σ̃ −1
⊗ X Ω (I ⊗ X ) A.16
0 q 0 n
−1/2
= |Ω0 |−1/2 |Ω0 |1/2 Iq + Σ̃−1 ⊗ X Ω0 (In ⊗ X , ) A.18
−1/2
= Iq + Σ̃−1 ⊗ X Ω0 (In ⊗ X , )
−1/2
,
= Iq + Σ̃−1 ⊗ X FΩ FΩ (In ⊗ X , )
Substituting back:
Which is 1.9.38.
278
A. Derivations
Note first that the steady-state of a model will be meaningful only if the model is guaranteed to
ultimately return to its long-run value. Otherwise, the model may just wander away of this value
and never approach it again. This is related to the notion of weak or covariance stationarity, which
implies that the expectation of the variables in the model should be independent of the period t.
That is:
E(yt ) = µ ∀t (I.1)
with µ a vector of constants. Therefore, before one turns to the computation of the steady-state, it is
necessary to check that the model is covariance stationary. The usual issue of parameter uncertainty
arises with Bayesian VAR models: talking about ’the’ estimated model is not meaningful as the
estimation process produces a posterior distribution for each coefficient, and not a single value. The
difficulty is overcome by assuming that ’the’ model to check for stationarity is that defined by the
point estimates (typically the median) for each coefficient. This guarantees in no way, however,
that every draw from the posterior distribution would produce a stationary model. It only checks
whether a typical model satisfy stationarity. Assume hence that the point estimate β̃ is retained
for β in 1.1.12, permitting to recover Ã1 , Ã2 , ..., Ãp in 1.1.2. Hamilton (1994) shows (see proposition
10.1, p 259) that the VAR model will be covariance stationary if all the eigenvalues of the matrix F
are smaller than 1 in modulus, with F the companion matrix of the VAR defined as:
à Ã2 · · · Ãp−1 Ãp
1
In
0 ··· 0 0
F = 0 In 0 0 (I.2)
.. ... . .
. .. ..
0 0 · · · In 0
Once covariance stationarity has been checked, it is possible to evaluate the steady-state of the model.
The analysis starts with the classical VAR model 1.1.2:
279
A. Derivations
The steady-state, or long-term value µ of the model at period t is simply the expectation E(yt ) for
model I.3 at this period. Hence, to derive the steady-state value of the model, take expectation on
both sides of I.3:
Under the assumption of covariance stationarity, E(yt ) = µ. Note also that as xt is an exogenous
process with known values, E(xt ) = xt . Finally, assumption 1.1.3 implies that E(εt ) = 0. Then, I.4
rewrites as:
Rearranging:
(I − A1 − A2 − ... − Ap )µ = Cxt
In the case of a mean-adjusted VAR, the procedure is a bit different. Start from the mean-adjusted
model 3.6.3:
With this formulation, the simplest approach consists in adopting a Wold representation strategy.
Under the assumption of covariance stationarity, the model I.7 can be inverted and reformulated as:
A(L) (yt − F xt ) = εt
⇔ (yt − F xt ) = A(L)−1 εt
∞
X
⇔ yt − F xt = Ψi εt−i (I.8)
i=0
Take expectation on both sides, and use the facts that E(xt ) = xt and E(εt ) = 0, ∀t to obtain:
280
A. Derivations
∞
X
E(yt ) − F E(xt ) = Ψi E(εt−i )
i=0
⇔ E(yt ) − F xt = 0
⇔ µ = F xt (I.9)
J. Forecast evaluation
Forecast evaluation is a matter of central interest for model selection. To be useful, a model should
be able to produce good forecasts. This means that the forecasts produce by the model should be as
close as possible to the actual realised values taken by the data. Two sets of evaluation measures are
developed in this section. The first set is fairly standard and is not proper to Bayesian techniques:
it is the usual set of in-sample and out of sample fit measures. The second set is constituted by the
family of statistics known as log predictive scores, and is more specific to Bayesian approaches.
Start thus with first set, and consider first the in-sample evaluation measures. A rough and
preliminary measure of the goodness of fit of the model is given by the sum of squared residuals.
Intuitively, the smaller this sum, the smaller the amplitude of the residuals, and thus the better the
fit of the model to the data. For a VAR model with n variables, the sum of squared residuals for
variable i, with i = 1, 2, ..., n, is defined as:
where ε,i = (εi1 εi2 . . . εiT ) denotes the residual series for variable i over the whole sample. Using
B̃ as a point estimate for B in 1.1.7, recovering the sum of squared residuals is straightforward. First
obtain the predicted values Ỹ from the model, using 1.1.7:
Ỹ = E(Y |X ) = X B̃ (J.2)
Ẽ = Y − X B̃ = Y − Ỹ (J.3)
281
A. Derivations
RSS = Ẽ , Ẽ (J.4)
A second common measure of fit, related to the sum of squared residuals, is the coefficient of
determination, or R2 . This value measures the share of total variation in y that can be attributed
to the model. The larger R2 , the more efficient the model to explain data variation. For equation i
of the VAR model, R2 is defined as:
RSSi
Ri2 = 1 − (J.5)
T SSi
where T SSi is the total sum of squares for equation i, defined as:
T
(yi,j − ȳi )2
X
T SSi = (J.6)
j=1
with ȳi the mean of yi . A convenient way to compute T SSi is to use a demeaning matrix M̄ =
IT − (1/T )1T ×T , where 1T ×T denotes a T × T matrix for which all entries are 1. M̄ is idempotent
and has the property that M̄ x = x − x̄, for any vector x. Therefore, it is straightforward to define
the full T SS matrix as:
T SS = Y , M̄ Y (J.7)
RSS
R2 = In − (J.8)
T SS
Where the division of RSS with T SS has to be element-wise. Ri2 can then be read from the
ith diagonal element of the R2 matrix.
282
A. Derivations
T −1
R̄i2 = 1 − (1 − Ri2 ) (J.9)
T −k
It is possible to recycle the R2 matrix in J.9 to obtain a full matrix of adjusted R2 :
T −1
R̄2 = In − (In − R2 ) (J.10)
T −k
R̄i2 can then be read from the ith diagonal element of the R̄2 matrix.
Two evaluation criteria commonly used to discriminate among OLS models are the Akaike Informa-
tion Criterion (AIC), and the Bayesian Information Criterion (BIC). These two criteria are respec-
tively defined as:
and
L denotes the full system log-likelihood. Assuming as usual normal disturbances, it is defined as:
−T n T Ẽ , Ẽ
L= (1 + log(2π)) − log (J.13)
2 2 T
Though the in-sample measures are informative, the most important measures evaluate the quality
of out-of-sample predictions. Four standard out-of-sample measures are presented here: the root
mean squared error, the mean absolute error, the mean absolute percentage error, and the Theil
inequality coefficient. All these measures provide a way to assess the size of the difference between
the predicted value and the value that actually occurred in the data set. Note that because these
measures compare the forecast provided by the model with realised data values, computing them
requires that at least one actual data point is available over the forecast period.
The first forecast evaluation measure is the root mean squared error or RMSE. Assume that
forecasts are produced over h periods, and that in addition of the forecasts, the actual data values
are known for these periods. Then the root mean squared error of this forecast for variable i in the
VAR is defined as:
v
u h
− ỹT +i )2
u X
RM SEi = t(1/h) (y T +i (J.14)
i=1
where ỹT +i denotes as usual the predicted value of yT +i . An alternative measure of forecast efficiency
is given by the mean absolute error:
283
A. Derivations
h
X
M AEi = (1/h) |yT +i − ŷT +i | (J.15)
i=1
For these two measures, a lower value indicates a better fit. The squared terms indicate however
that the RMSE place a greater penalty on large errors than does the MAE. A third measure is the
mean absolute percentage error, defined for variable i as:
h
yT +i − ŷT +i
X
M AP Ei = (100/h) (J.16)
yT +i
i=1
Unlike the RMSE and the MAE which measure the absolute size of the forecast error, the MAPE I
a scaled measure, providing the size of the error relative to value of the variable. A final measure of
forecast accuracy is provided by the Theil inequality coefficient or Theil U statistics:
s
h
(yT +i − ŷT +i )2
P
(1/h)
i=1
Ui = s s (J.17)
h h
P 2 P 2
(1/h) (yT +i ) + (1/h) (ŷT +i )
i=1 i=1
This coefficient is always comprised between 0 and 1, a lower value indicating a better forecast. A
value of 0 indicates a perfect fit, while a value of 1 says that the forecast is no better than a naive
guess.
The second set of forecast measures, specific to Bayesian analysis, is the family of log predictive
scores for forecasts. While the measures previously described compare the point estimates of the
forecast with the actual values, in a pure frequentist style, the log scores compare the realised values
with the whole posterior predictive density, in a more Bayesian fashion. The idea behind log scores
is that a good model should produce a forecast distribution that makes it likely that the forecast
occurs close to the realised values. In other words, the predictive distribution should be such that it
takes a high density at the actual data value.
The procedure for computing log predictive scores that is now presented is due to Warne et al.
(2013), as detailed by Mao (2010). Assume that some data set is used to estimate BVAR model M1 .
The estimation sample runs until period T of the data set, with T < T f , the final period of the data
set. In other words, there remains some observed data values after the final sample period. Also, one
wants to consider predictions for this model up to h periods after the sample end, with T + h ≤ T f .
That is, predictions are formed over periods for which actual data is observed. Consider then any set
of predicted values for periods T + 1, T + 2, ..., T + h for the BVAR model M1 . Recycling notations
from Section 2.1, the vector of h-step ahead forecasts can be denoted as:
284
A. Derivations
ỹ
T +1
ỹT +2
ỹT +1:T +h = .
(J.18)
..
ỹT +h
Following, it is possible to denote the conditional predictive density of these predicted values by
f (ỹT +1:T +h |yTo , β, Σ, M1 ), where yTo denotes data observed until period T , β and Σ denote respectively
the VAR coefficient and residual covariance matrix drawn from the posterior distribution of model M1 ,
and M1 denotes the candidate model. Under the assumption of normal disturbances, the conditional
distribution of ỹT +1:T +h is multivariate normal:
with
µ Υ Υ1,2 · · · Υ1,h
1 1,1
µ2
Υ
Υ2,2 · · · Υ2,h
and Υ = 2,1
µ=
.. .. .. .. .. (J.20)
. . . . .
µh Υh,1 Υh,2 · · · Υh,h
µ is the mean vector for the h-step ahead predictions, in which each µi element represents the n × 1
mean for prediction at period T + i (i = 1, 2, ..., h). On the other hand, Υ is the variance-covariance
matrix for these predictions, and each Υi,j is the n × n covariance matrix between predictions at
period T + i and T + j. The issue resides in computing µ and Υ.
For µ, the ith -step ahead expectation µi is given by:
E(y
T +i |yTo , β, Σ, M1 ) if i > 0
µi = (J.21)
yT +i if i < 0
µi is straightforward to obtain from the usual chain rule of forecasting. For instance given a VAR
model in the form of 1.1.2, one has:
µ1 = E(yT +1 |yTo , β, Σ, M1 )
= A1 E(yT |yTo , β, Σ, M1 ) + A2 E(yT −1 |yTo , β, Σ, M1 ) + ... + Ap E(yT +1−p |yTo , β, Σ, M1 )
+ CE(xT +1 |yTo , β, Σ, M1 ) + E(εT +1 |yTo , β, Σ, M1 )
= A1 µ0 + A2 µ−1 + ... + Ap µ1−p + CE(xT +1 )
285
A. Derivations
Following:
µ2 = E(yT +2 |yTo , β, Σ, M1 )
= A1 E(yT +1 |yTo , β, Σ, M1 ) + A2 E(yT |yTo , β, Σ, M1 ) + ... + Ap E(yT +2−p |yTo , β, Σ, M1 )
+ CE(xT +2 |yTo , β, Σ, M1 ) + E(εT +2 |yTo , β, Σ, M1 )
= A1 µ1 + A2 µ0 + ... + Ap µ2−p + CE(xT +2 )
The min(i − 1, p)justifies by the fact that for k ≥ i, the period becomes t < T , implying from J.21
that (yT +i−k − µi−k ) = (µi−k − µi−k ) = 0.
Substituting back in J.23, one obtains:
286
A. Derivations
min(i−1,p)
Ak (yT +i−k − µi−k )+C [xT +i − E(xT +i )] + εT +i (yT +j − µj ), |yTo , β, Σ, M1
X
Υi,j =E
k=1
min(i−1,p)
Ak E [(yT +i−k − µi−k )(yT +j − µj ), |yTo , β, Σ, M1 ]
X
=
k=1
Without loss of generality, assume i > j (the symmetry of Υ implies that Υi,j = Υ,j,i , so that the
case i < j can simply be treated as the transpose of the case i > j). Then from J.25:
min(i−1,p)
Ak E [(yT +i−k − µi−k )(yT +j − µj ), |yTo , β, Σ, M1 ] + E [εT +i (yT +j − µj ), |yTo , β, Σ, M1 ]
X
Υi,j =
k=1
min(i−1,p)
X
= Ak Υi−k,j (J.26)
k=1
where use has been made of the fact that E [εT +i (yT +j − µj ), |yTo , β, Σ, M1 ] = 0 since i > j. In the
case i = j, using again J.24 to substitute for yT +j − µj in J.26, one obtains:
min(i−1,p)
Ak E [(yT +i−k − µi−k )(yT +i − µi ), |yTo , β, Σ, M1 ]
X
Υi,i =
k=1
,
min(i−1,p)
|yTo , β, Σ, M1
X
+ E εT +i Ak (yT +i−k − µi−k )+C [xT +i − E(xT +i )] + εT +i
k=1
min(i−1,p)
X
= Ak Υi−k,i + Σ (J.27)
k=1
where Σ denotes as usual the residual covariance matrix, and where use has been made of the fact
that E [εT +i Ak (yT +i−k − µi−k ), |yTo , β, Σ, M1 ] = 0 since T + i > T + i − k.
287
A. Derivations
J.22, J.26 and J.27 allow to fully identify µ and Υ, and, following, to compute
f (ỹT +1:T +h |yTo , β, Σ, M1 ) from J.19. Furthermore, it is possible to use property B.9 of the multivariate
normal distribution to obtain:
where R is any matrix comfortable with ỹT +1:T +h . By selecting carefully R, one can obtain the
properties of a subset only of ỹT +1:T +h . For instance, considering the case n = 2 and h = 3 (two
variables and three forecast periods):
Note however that what has been so far defined in J.19 is only a conditional predictive density,
that is, the density obtained for given draws of β and Σ from the posterior distribution of model
A. However, what is required for the log predictive score is the unconditional predictive density.
Fortunately, it is straightforward to derive the latter by relying on almost sure convergence properties.
Precisely, one has:
N
1 X a.s
f (RyTo +1:T +h |yTo , β (n) , Σ(n) , M1 )→ f (RyTo +1:T +h |yTo , M1 ) (J.29)
N n=1
where β (n) and Σ(n) denote draw n from the posterior distribution of model A. Of course, in practice,
one follows the usual strategy consisting in recycling the Gibbs sampler draws to obtain the sequences
of β (n) and Σ(n) values. Also, it is important to note that the predictive density is evaluated from
the observed values yTo +1:T +h in order to evaluate the prediction performance of model M1 .
With this predictive density, it is possible to estimate the log predictive score of model A. The
general definition of the log predictive score for model A is 2 :
2
There are nearly as many different definitions of log predictive scores than papers using them as an evaluation
criterion. The definition adopted here is that of Mao (2010), which has the virtue of being fairly general.
288
A. Derivations
f −h
TX
S(yTo , M1 ) = o
log f (Ryt+1:t+h |yto , M1 ) (J.30)
t=T
Two base forecasting scenarios are considered, each time for variable i of the model, i = 1, 2, ..., n.
In the first scenario, R is sequentially defined as:
R = 0i,n 0n 0n · · · 0n , 0n 0i,n 0n · · · 0n , ..., 0n 0n 0n · · · 0i,n (J.32)
1×nh
where 0i,n denotes a 1 × n matrix of zeros, save for a unique 1, located at the ith entry, and 0n denotes
a 1 × n matrix of zeros. In this case, what is evaluated is the performance of the forecasts produced
by model A for variable i at respective periods T + 1, T + 2, ..., T + h. In the second scenario, R is
sequentially defined as:
0 0n 0n · · · 0n
i,n
0i,n 0n 0n · · · 0n 0n 0i,n 0n · · · 0n
R = 0i,n 0n 0n · · · 0n , , ...,
.. .. .. (J.33)
0n 0i,n 0n · · · 0n . . .
0n · · · 0n 0n 0i,n
Where R is sequentially of dimension 1 × nh, 2 × nh, ..., h × nh. In this case, what is evaluated is
the overall performance of the forecast produced by model A for variable i from period T + 1 up to
periods T + 2, T + 3, ..., T + h.
To summarize, it is possible to propose the following procedure to compute the log predictive
scores:
Algorithm A.10.1 (log predictive score, all priors):
2. Initiate the Gibbs sampler phase. At iteration n, draw β (n) and Σ(n) .
5. At iteration n, obtain f (RyTo +1:T +h |yTo , β (n) , Σ(n) , M1 ) from J.19, for every value of R in the
sequences J.32 and J.33.
289
A. Derivations
6. Once It iterations are realised, compute f (RyTo +1:T +h |yTo , M1 ) from J.29, once again for each
value of R.
7. Compute the log predictive scores from J.31, for each value of R.
An alternative to the log predictive score is the continuous ranked probability score, first introduced
by Matheson and Winkler (1976), and which has recently regained interest Gneiting and Raftery
(2007). Similarly to the log predictive score, it evaluates the quality of the forecast produced by
the model by assessing the adequacy between the posterior predictive distribution and the actual,
realized value. The idea, once again, is that a good posterior predictive distribution should be at the
same time characterized by an accurate location (close to the realized value), and a sharp density
(predictive values should be tightly concentrated around the realized value).
Consider the cumulative distribution function F corresponding to the marginal predictive density
f for the forecast at period T + h, along with the realized value yTo +h for this period. Then, the
continuous ranked predictive score (CRPS) is then defined as:
Z ∞ 2
CRP S(F, yTo +h ) = F (x) − 1(x > yTo +h ) dx (J.34)
−∞
where 1(.) denotes the indicator function, taking a value of 1 if the condition is verified, and zero
otherwise. The CRPS value in J.34 can be conceived as a penalty function sanctioning the overall
distance between the distribution points and the realized value. In the case of a perfect predictive
distribution (a mass point of density 1 at x = yTo +h , so that F (x) = 0 for x < yTo +h , and F (x) = 1
for x ≥ yTo +h ), the value of CRP S(F, yTo +h ) is 0. In any other case, there will be a positive penalty
stemming from the possible deviations of the distribution value from the observed value, with greater
penalty applied on values far away from the realized value. Hence, the larger the value of the CRP S,
the poorer the performance of the predictive distribution f for the forecast at period T + h.
In practical applications, J.34 is not applicable because the analytical form of the cumulative distri-
bution function F is not known. However, Gneiting and Raftery (2007) show that the CRP S J.34
can be evaluated in closed form as:
1
CRP S(F, yTo +h ) = E x − yTo +h − E |x − y| (J.35)
2
where expectation is to be taken with respect to the distribution function F , and x and y are inde-
pendent random draws from the density f . As usual, the strategy then consists into approximating
the expectation terms in J.35 by recycling the Gibbs sampler draws from f . This yields the following
equivalent formula:
290
A. Derivations
The confidence intervals for the VAR coefficients are derived by using proposition 11.1 (p 298-299)
in Hamilton (1994). This proposition states the following: consider the standard VAR model 1.1.2,
and its vectorised reformulation 1.1.11. The two parameters of interest are the residual variance-
covariance matrix Σ and the vectorised VAR coefficients β, and their OLS counterparts Σ̂ and β̂ are
respectively given by 1.1.10 and 1.1.15. Then, under fairly standard conditions, the following holds:
P
1. (1/T )(X , X)→ Θ, where Θ = E(X , X)
P
2. β̂ → β
P
3. Σ̂→ Σ
√
L
4. T β̂ − β → N (0, Σ ⊗ Θ−1 )
1.) states that (1/T )(X , X) is a consistent estimate for Θ. That is, for large enough T , (1/T )(X , X) ≈
Θ, which implies that Θ−1 ≈ T (X , X)−1 . Then, 2.) and 3.) tell us that β̂ and Σ̂ are consistent
estimators for β and Σ. Finally, 4.) implies that β̂ converges in distribution to a normal law:
L
β̂ → N (β, T −1 (Σ ⊗ Θ−1 )). Combining 1.) and 4.), it is possible to conclude that β̂ approximately
follows a normal distribution characterised by β̂ ∼ N β, Σ ⊗ (X X)−1 . Finally, combining with 3.)
to obtain a consistent estimate of Σ, one obtains the approximate distribution:
β̂ ∼ N β, Σ̂ ⊗ (X X)−1 (K.1)
291
A. Derivations
From this, and the property B.7 of the multivariate normal distribution, one may conclude that the
ith element of the vector β̂ follows a normal distribution:
β̂i ∼ N βi , σ̂i2 ⊗ (X X)−1 (K.2)
where σ̂i2 is the ith diagonal element of Σ̂. From this, it is straightforward to derive the standard
deviation and confidence intervals of each coefficient.
For impulse response functions, the easiest approach is probably to rely on Monte Carlo simulation
methods, as described in Hamilton (1994), p 337. Because from J.1, the distribution of β̂ is known,
it is possible to randomly generate vectors β̂ (1) , β̂ (2) , ..., β̂ (N ) , where N is some large number. Then,
for each such vector, compute the series of impulse functions, using the methodology developed in
section 2.2. For a confidence level of α , simply trim the α/2 percent smallest and largest values, to
obtain an empirical α% confidence interval.
Finally, to derive the confidence interval of forecasts, one may use the Gaussian properties of yt .
This implies (see Luetkepohl (1993), equation 3.5.15 p 89) that an approximate (1 − α) % confidence
interval for an h-periods ahead forecast for variable yi,t obtains as:
where ỹi,t+h denotes the predicted value for yi at period t + h , z(α) is the αth quantile of the standard
normal distribution, and σi,h is the square root of the ith diagonal element of Σ̃h , the forecast error
covariance matrix. The latter is defined as:
h−1
Ψi Σ̂Ψ,i = Σ̃h−1 + Ψh−1 Σ̂Ψ,h−1
X
Σ̃h = (K.4)
i=0
and Ψi denotes the impulse response function matrix for period i (see Luetkepohl (1993), equation
2.2.11 p 32).
292
A. Derivations
y2,T +1 = ȳ2 . Both conditions are generated by shock 1. There is thus one block made of two
variables, generated only by one shock. The system 3.3.12 is given by:
η
1,T +1
φ̃
0,11
φ̃0,12 φ̃0,13 ȳ1 − ỹ1,T +1
η2,T +1 = (L.1)
φ̃0,21 φ̃0,22 φ̃0,23 ȳ2 − ỹ2,T +1
η3,T +1
• Draw first the non-constructive shocks η2,T +1 and η3,T +1 from their distribution, and trans-
fer their impacts on the right-hand side:
η1,T +1
φ̃
0,11
0 0 ȳ 1 − ỹ1,T +1 − φ̃ η
0,12 2,T +1 − φ̃ η
0,13 3,T +1
η2,T +1 = (L.2)
φ̃0,21 0 0 ȳ2 − ỹ2,T +1 − φ̃0,22 η2,T +1 − φ̃0,23 η3,T +1
η3,T +1
For clarity, note that this system can be equivalently rewritten as:
φ̃ ȳ − ỹ1,T +1 − φ̃0,12 η2,T +1 − φ̃0,13 η3,T +1
0,11 (η1,T +1 ) = 1 (L.3)
φ̃0,21 ȳ2 − ỹ2,T +1 − φ̃0,22 η2,T +1 − φ̃0,23 η3,T +1
This is a system of two equations in only one unknown: η1,T +1 . The system is overdetermined
and has no solution.
Conclusion: conditions cannot hold for blocks where there are more variables than shocks
generating the conditions. The reason is that this generates over-determined systems with no
solutions.
293
A. Derivations
φ̃
0,11
φ̃0,12 φ̃0,13 η1,T +1 ȳ1 − ỹ1,T +1
φ̃0,21 φ̃0,22 φ̃0,23 η2,T +1 = ȳ2 − ỹ2,T +1 (L.4)
φ̃0,31 φ̃0,32 φ̃0,33 η3,T +1 ȳ3 − ỹ3,T +1
• Draw first the non-constructive shock η3,T +1 from its distribution, and transfer its impact
on the right-hand side:
φ̃
0,11
φ̃0,12 0 η1,T +1 ȳ1 − ỹ1,T +1 − φ̃0,13 η3,T +1
φ̃0,21 φ̃0,22 0 η2,T +1 = ȳ2 − ỹ2,T +1 − φ̃0,23 η3,T +1 (L.5)
φ̃0,31 φ̃0,32 0 η3,T +1 ȳ3 − ỹ3,T +1 − φ̃0,33 η3,T +1
• Consider block 1: draw first the constructive shock η1,T +1 and η2,T +1 from the Waggoner-
Zha distribution, and transfer their impacts on the right-hand side:
0 0 0 η1,T +1 ȳ1 − ỹ1,T +1 − φ̃0,13 η3,T +1 − φ̃0,11 η1,T +1 − φ̃0,12 η2,T +1
0 0 0 η2,T +1 = ȳ2 − ỹ2,T +1 − φ̃0,23 η3,T +1 − φ̃0,21 η1,T +1 − φ̃0,22 η2,T +1 (L.6)
0 0 0 η3,T +1 ȳ3 − ỹ3,T +1 − φ̃0,33 η3,T +1 − φ̃0,31 η1,T +1 − φ̃0,32 η2,T +1
All the shocks are now determined, but the draws have been realised to satisfy the conditions in
block 1 only. There is thus no reason that the condition in block 2 is also satisfied. This is because
shocks are actually not shared: shock η2,T +1 has been used by block 1, and is not available anymore
to determine block 2. Block 2 could be only identified if it was generated by at least one additional
shock. But then, it would be more accurate to say that it is generated only by this other shock.
Conclusion: shocks cannot be shared among blocks. Different blocks must be generated by different
shocks.
294
A. Derivations
−1/2 ,
f (y Σ̄) = (2π)−N nT /2 Σ̄ exp − 12 (y − X̄β) Σ̄−1 (y − X̄β)
or:
−1/2 ,
f (y Σ̄) ∝ Σ̄ exp − 21 (y − X̄β) Σ̄−1 (y − X̄β)
1
−1/2
f (y |Σc ) ∝ |Σc ⊗ IN T | exp − (y − (In ⊗ X) β), (Σc ⊗ IN T )−1 (y − (In ⊗ X) β) (M.1)
2
Consider only the part within the curly brackets of (M.1) and develop:
295
A. Derivations
β̂ = vec(B̂)
= vec(B̂In )
= vec (X , X)−1 X , yIn
= In ⊗ (X , X)−1 X , vec(Y ) A.8
= In ⊗ (X , X)−1 X , y
= Σc ⊗ (X , X)−1 Σ−1 ,
c ⊗X y A.6
−1
= Σ−1 ,
c ⊗ (X X) Σ−1 ,
c ⊗X y A.2
= y , Σ−1 , −1 , , −1 ,
c ⊗ IN T y − 2β̂ Σc ⊗ X y + 2β̂ Σc ⊗ X X β̂
−2β , Σ−1 , , −1 ,
c ⊗ X X β̂ + β Σc ⊗ X X β
= y , Σ−1 , −1 , , −1 ,
c ⊗ IN T y − 2β̂ Σc ⊗ X y + β̂ Σc ⊗ X X β̂
+β̂ , Σ−1 , , −1 , , −1 ,
c ⊗ X X β̂ − 2β Σc ⊗ X X β̂ + β Σc ⊗ X X β
= y , Σ−1 , −1 , , −1 ,
c ⊗ IN T y − 2β̂ Σc ⊗ X y + β̂ Σc ⊗ X X β̂
,
+(β − β̂) Σ−1 ,
c ⊗ X X (β − β̂)
= y , Σ−1 , −1 , , −1 ,
c ⊗ IN T y − 2β̂ Σc ⊗ X y + β̂ Σc ⊗ X X β̂
, −1
+(β − β̂) Σc ⊗ (X , X)−1 (β − β̂) A.2 (M.4)
296
A. Derivations
y , Σc−1 ⊗ IN T y − 2β̂ , Σ−1 , , −1 ,
c ⊗ X y + β̂ Σc ⊗ X X β̂
= y , Σc−1 ⊗ IN T y − 2β̂ , (In ⊗ X), Σ−1
c ⊗ IN T y
+β̂ , Σ−1 ,
c ⊗ X (In ⊗ X) β̂ A.1, A.6
,
= y , Σc−1 ⊗ IN T y − 2 (In ⊗ X) β̂ Σ−1
c ⊗ IN T y
+β̂ , (In ⊗ X), Σ−1
c ⊗ IN T (In ⊗ X) β̂ A.6
,
= y , (Σc ⊗ IN T )−1 y − 2 (In ⊗ X) β̂ (Σc ⊗ IN T )−1 y
+β̂ , (In ⊗ X), (Σc ⊗ IN T )−1 (In ⊗ X) β̂ A.2
n o n , o n o
= tr Σ−1 , −1 −1 , ,
c Y IN T Y − 2tr Σc (X B̂) IN T Y + tr Σc B̂ X IN T X B̂ A.8, A.13
n o n o n o
= tr Y Σ−1
c Y
,
− 2tr Y Σ−1 , ,
c B̂ X + tr X B̂Σ−1 , ,
c B̂ X Q.17
n o
= tr Y Σ−1 , −1 , , −1 , ,
c Y − 2Y Σc B̂ X + X B̂Σc B̂ X Q.17
n ,o
= tr (Y − X B̂)Σ−1
c (Y − X B̂)
n , o
= tr Σ−1
c (Y − X B̂) (Y − X B̂) Q.17 (M.5)
, −1
(β − β̂) Σc ⊗ (X , X)−1 (β − β̂)
n , o
= tr Σ−1
c B − B̂ (X , X) B − B̂ A.13 (M.6)
Before turning back to (M.1), note also that Kronecker property A.7 implies that the determinant
part of (M.1) can rewrite as:
−1/2
|Σc ⊗ IN T |−1/2 = |Σc |N T |IT |n = |Σc |−N T /2 (M.8)
297
A. Derivations
h n , o n , oi
exp − 12 tr Σ−1 −1
c (Y − X B̂) (Y − X B̂) + tr Σc B − B̂ (X , X) B − B̂
Or, rearranging:
1 n
, o
−N T /2
f (y |β, Σc ) ∝ |Σc | exp − tr Σ−1
c B − B̂ (X ,
X) B − B̂
2
1
o
n
−1 ,
× exp − tr Σc (Y − X B̂) (Y − X B̂) (M.9)
2
β ∼ N (β0 , Σc ⊗ Φ0 )
1
π(β) = (2π)−q/2 |Σc ⊗ Φ0 |−1/2 exp − (β − β0 ), (Σc ⊗ Φ0 )−1 (β − β0 ) (M.10)
2
π(β) = (2π)−q/2 |Σc |−k/2 |Φ0 |−n/2 exp − 21 (β − β0 ), (Σc ⊗ Φ0 )−1 (β − β0 )
h i
π(β) ∝ |Σc |−k/2 exp − 21 (β − β0 ), (Σc ⊗ Φ0 )−1 (β − β0 )
1 n
o
−k/2 , −1
π(β) ∝ |Σc | exp − tr Σ−1
c (B − B0 ) Φ0 (B − B0 ) (M.11)
2
298
A. Derivations
Σc ∼ IW (S0 , α0 )
π(Σc |S0 , α 0 ) = 1
|S |α0 /2 |Σc |−(α0 +n+1)/2
2α0 n/2 Γn ( 20 ) 0
α exp − 12 tr {Σ−1
c S0 }
1 n
o
−(α0 +n+1)/2
π(Σc ) ∝ |Σc | exp − tr Σ−1
c S0 (M.12)
2
Combining the likelihood (M.9) with the prior distributions (M.11) and (M.12), one obtains the
posterior distribution as:
Rearranging:
299
A. Derivations
h , i
Σ−1
c B − B̂ (X , X) B − B̂ + (B − B0 ), Φ−1
0 (B − B0 )
h i
, −1
= Σ−1
c B , X , XB + B̂ , X , X B̂ − 2B , X , X B̂ + B , Φ−1 , −1
0 B + B0 Φ0 B0 − 2B Φ0 B0
h i
, −1
= Σ−1
c B , X , X + Φ−1
0 B − 2B , X , X B̂ + Φ−1 , ,
0 B0 + B̂ X X B̂ + B0 Φ0 B0
"
= Σ−1
c B , X , X + Φ−1
0 B − 2B , Φ̄−1 Φ̄ X , X B̂ + Φ−1 , −1 , −1
0 B0 + B̄ Φ̄ B̄ − B̄ Φ̄ B̄
#
,
+B̂ X X B̂ +,
B0, Φ−1
0 B0
Defining:
h i−1
Φ̄ = Φ−1 ,
0 +X X (M.15)
and
h i
B̄ = Φ̄ Φ−1 ,
0 B0 + X X B̂ (M.16)
h i
= Σ−1
c B , Φ̄−1 B − 2B , Φ̄−1 B̄ + B̄ , Φ̄−1 B̄ − B̄ , Φ̄−1 B̄ + B̂ , X , X B̂ + B0, Φ−1
0 B0
,
h i
= Σ−1
c (B − B̄) Φ̄−1 (B − B̄) − B̄ , Φ̄−1 B̄ + B̂ , X , X B̂ + B0, Φ−1
0 B0
,
h i h i
= Σ−1
c (B − B̄) Φ̄−1 (B − B̄) + Σ−1
c B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄
300
A. Derivations
Define:
ᾱ = N T + α0 (M.17)
and
,
S̄ = S0 + (Y − X B̂) (Y − X B̂) + B̂ , X , X B̂ + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (M.18)
1 n
, −1
h io
π(β, Σc |y ) ∝ |Σc |−k/2 exp − tr Σ−1 (B − B̄) Φ̄ (B − B̄)
2 c
1 n o
×|Σc |−(ᾱ+n+1)/2 exp − tr Σ−1c S̄ (M.19)
2
This is exactly similar to D.16. Therefore, following a reasoning identical to that of E, it follows
immediately that the marginal posteriors are given by:
π(Σc |y ) ∼ IW ᾱ, S̄ (M.20)
and
π(B |y ) ∼ M T (B̄, S̄, Φ̄, α̃) (M.21)
with:
α̃ = ᾱ − n + 1 = N T + α0 − n + 1 (M.22)
301
A. Derivations
S̄ = Y , Y + S0 + B0, Φ−1 , −1
0 B0 − B̄ Φ̄ B̄ (M.23)
and
h i
B̄ = Φ̄ Φ−1 ,
0 B0 + X Y (M.24)
1
−1/2 ,
f (y β, Σ̄) = (2π)−nT /2 Σ̄ exp − y − X̄β Σ̄−1 y − X̄β (N.1)
2
1
,
f (y |β ) ∝ exp − y − X̄β Σ̄−1 y − X̄β (N.2)
2
1
−1/2
−h/2 ,
π(β) = (2π) Σ̄b exp − (β − b̄) Σ̄−1
b (β − b̄) (N.3)
2
1
,
π(β) ∝ exp − (β − b̄) Σ̄−1
b (β − b̄) (N.4)
2
Then, using Bayes rule 1.2.3, one combines the likelihood and the prior to obtain:
1 n
, , o
f (β |y ) ∝ exp − y − X̄β Σ̄−1 y − X̄β + β − b̄ Σ̄−1
b β − b̄ (N.5)
2
302
A. Derivations
Consider the term in the curly bracket of (N.5), and use (4.5.8) and (4.5.9) to develop:
, ,
y − X̄β Σ̄−1 y − X̄β + β − b̄ Σ̄−1
b β − b̄
, −1 , −1
= y − X̄β σε2 IN nT y − X̄β + β − b̄ λ1 σε2 Iq β − b̄
, ,
= y − X̄β σε−2 y − X̄β + λ−1
1 β − b̄ σε−2 β − b̄
= y , σε−2 y + β , X̄ , σε−2 X̄β − 2β , X̄ , σε−2 y + λ−1 , −2 −1 , −2 −1 , −2
1 β σε β + λ1 b̄ σε b̄ − 2λ1 β σε b̄
= y , σε−2 y + β , λ−1 −2 −2 , , , −2 −1 −2 −1 , −2
1 σε Ih + σε X̄ X̄ β − 2β X̄ σε y + λ1 σε b̄ + λ1 b̄ σε b̄
Define:
−1
Ω̄b = λ−1 −2 −2 ,
1 σε Ih + σε X̄ X̄ (N.6)
and
β̄ = Ω̄b X̄ , σε−2 y + λ−1 −2
1 σε b̄ (N.7)
= y , σε−2 y + β , Ω̄−1 , −1 −1 , −2 , −1 , −1
b β − 2β Ω̄b β̄ + λ1 b̄ σε b̄ + β̄ Ω̄b β̄ − β̄ Ω̄b β̄
,
= (β − β̄) Ω̄−1 , −2 −1 , −2 , −1
b (β − β̄) + y σε y + λ1 b̄ σε b̄ − β̄ Ω̄b β̄ (N.8)
1n
,
o
f (β |y ) ∝ exp − (β − β̄) Ω̄−1 , −2 −1 , −2 , −1
b (β − β̄) + y σε y + λ1 b̄ σε b̄ − β̄ Ω̄b β̄
2
1 1 , −2
,
∝ exp − (β − β̄) Ω̄−1
b (β − β̄) exp − y σε y + λ−1 , −2
1 b̄ σε b̄ − β̄ , −1
Ω̄ b β̄
2 2
1
,
∝ exp − (β − β̄) Ω̄−1
b (β − β̄) (N.9)
2
This is the kernel of a multivariate normal distribution with mean β̄ and covariance matrix Ω̄b .
Finally, simplify the expressions. First, it is immediate from (N.6) that Ω̄b rewrites:
−1
Ω̄b = σε2 λ−1 ,
1 Ih + X̄ X̄ (N.10)
303
A. Derivations
π (β, b, Σb , Σ, y)
π (β, b, Σb , Σ |y ) =
π (y)
∝ π (β, b, Σb , Σ, y)
π (y, β, b, Σb , Σ)
= π (β, b, Σb , Σ)
π (β, b, Σb , Σ)
= π (y |β, b, Σb , Σ) π (β, b, Σb , Σ)
b and Σb are relevant only inasmuch as they allow to determine β. In other words, any expression
conditioning on β, b and Σb can be simplified as an expression conditioning on β only, since once a
value for β is drawn from π (β |b, Σb ), b and Σb can have no further impact. This is the case for the
likelihood function π (y |β, b, Σb , Σ), which can hence rewrite simply as π (y |β, Σ). From this, one
304
A. Derivations
eventually obtains:
Now turn to the derivation of the likelihood function. Given (4.4.12) and (4.4.14), the likelihood
function for unit i writes as:
1
−1/2 ,
π (yi |βi , Σi ) = (2π)−nT /2 Σ̄i exp − yi − X̄i βi Σ̄−1 y − X̄ β
i i i i
2
1
−1/2 ,
∝ Σ̄i exp − yi − X̄i βi Σ̄−1 y − X̄ β (O.2)
i i i i
2
Then, because static interdependencies does not apply, the residual series εi are independent across
units, which allows to obtain the likelihood for the full data set from (O.2) as:
YN
π (y |β, Σ) = i=1
π (yi |βi , Σi )
1
YN −1/2 ,
= Σ̄i
exp − yi − X̄i βi Σ̄−1
i yi − X̄i βi (O.3)
i=1 2
Before starting the derivation of the conditional posterior distributions, obtain first the full prior
distributions for β and Σ. Start with the prior distribution for β. From (4.4.16), the prior distribution
for βi is multivariate normal: βi ∼ N (b, Σb ). Therefore, its density is given by:
1
−q/2 −1/2
π (βi |b, Σb ) = (2π) |Σb | exp − (βi − b), Σ−1
b (βi − b)
2
1
−1/2 , −1
∝ |Σb | exp − (βi − b) Σb (βi − b)
2
305
A. Derivations
Now derive the conditional posteriors. Obtain first the conditional posterior for β. Start from
(4.6.16), and substitute for (4.6.4) and (4.6.6), for unit i only:
1
−1/2 , −1
π (βi |β−i , y, b, Σb , Σ) ∝ Σ̄i exp − yi − X̄i βi Σ̄i yi − X̄i βi
2
1
×|Σb |−1/2 exp − (βi − b), (Σb )−1 (βi − b)
2
1
, −1
= exp − yi − X̄i βi Σ̄i yi − X̄i βi + (βi − b), (Σb )−1 (βi − b)
2
(O.6)
Following the usual strategy, consider the curly bracket term and develop:
,
yi − X̄i βi Σ̄−1
i yi − X̄i βi + (βi − b), Σ−1
b (βi − b)
= yi, Σ̄−1 , , −1 , , −1 , −1 , −1 , −1
i yi + βi X̄i Σ̄i X̄i βi − 2βi X̄i Σ̄i yi + βi Σb βi + b Σb b − 2βi Σb b
= yi, Σ̄−1 , , −1 −1
i yi + βi X̄i Σ̄i X̄i + Σb βi − 2βi, X̄i, Σ̄−1 −1 , −1
i y i + Σ b b + b Σb b
Define:
−1
Ω̄i = X̄i, Σ̄−1 −1
i X̄i + Σb (O.8)
and:
β̄i = Ω̄i X̄i, Σ̄−1 −1
i yi + Σ b b (O.9)
= yi, Σ̄−1 , −1 , −1 , −1 , −1 , −1
i yi + βi Ω̄i βi − 2βi Ω̄i β̄ + b Σb b + β̄i Ω̄i β̄i − β̄i Ω̄i β̄i
= βi, Ω̄−1 , −1 , −1 , −1 , −1 , −1
i βi − 2βi Ω̄i β̄i + β̄i Ω̄i β̄i + b Σb b − β̄i Ω̄i β̄i + yi Σ̄i yi
,
, −1 , −1
= βi − β̄i Ω̄−1
i βi − β̄i + b, Σ−1
b b − β̄i Ω̄i β̄i + yi Σ̄i yi (O.10)
306
A. Derivations
1 n
, o
, −1 , −1
π (βi |β−i , y, b, Σb , Σ) ∝ exp − βi − β̄ Ω̄−1 i βi − β̄ + b, Σ−1 b b − β̄i Ω̄i β̄i + yi Σ̄i yi
2
1 1 , −1
,
, −1 , −1
= exp − βi − β̄ Ω̄−1 i β i − β̄ exp − b Σ b b − β̄ Ω̄
i i β̄ i + y Σ̄
i i y i
2 2
1
,
∝ exp − βi − β̄ Ω̄−1 i βi − β̄
2
(O.11)
1
,
π (βi |β−i , y, b, Σb , Σ) ∝ exp − βi − β̄i Ω̄−1
i β i − β̄i (O.12)
2
Therefore, the posterior for βi is conditionally normal, with mean β̄i and covariance matrix Ω̄i .
Considering (O.8) and (O.9), and making use of C.9 and C.11, it is possible to simplify β̄i and Ω̄i as:
h i−1
, −1
Ω̄i = Σ−1
i ⊗ X i Xi + Σ b (O.13)
and:
h i
, −1
β̄i = Ω̄i Σ−1
i ⊗ Xi y i + Σ b b (O.14)
Obtaining the conditional posterior for b turns out to be a bit trickier. Start from the conditional
posterior obtained from Bayes rule (4.6.20):
This is the product of N independent multivariate normal distributions. Intuitively, this should lead
to a final result in the form of a normal distribution, but this expression cannot be used as such, for
two reasons. First, it is a product of densities, while what is required is a single density. Secondly,
this is a distribution in β, while what is needed is the posterior distribution for b. Therefore, some
307
A. Derivations
First, using B.8, it is possible to express the product of multivariate normal distributions (O.15)
as a single multivariate normal distribution. Define:
β Σb 0 ··· 0 b
. ..
Σb . .
β 0 . b
β̃ =
..
Σ̃b = IN ⊗ Σb =
.. ... ...
b̃ = 1N ⊗ b = ..
(O.16)
.
. 0
.
β 0 ··· 0 Σb b
| {z } | {z } | {z }
h×1 h×h h×1
Then β̃ follows a multivariate normal distribution with mean b̃ and covariance matrix Σ̃b :
β̃ ∼ N b̃, Σ̃b (O.17)
Now, the trick consists in using the affine properties of the multivariate normal distribution. Define:
M = N −1 (1,N ⊗ Iq )
= N −1 Iq Iq · · · Iq (O.18)
| {z }
q×h
Then, from B.9, M β̃ follows a multivariate normal distribution with mean M b̃ and covariance matrix
M Σ̃b M , . Note that M acts as an averaging matrix. Indeed, from (O.16) and (O.18), one obtains:
β
1
β2
XN
M β̃ = N −1 Iq Iq = N −1
· · · Iq .. β = βm
i=1 i
(O.19)
.
βN
308
A. Derivations
1
−1
π (b |y, β, Σb , Σ) ∝ exp − (βm − b), N −1 Σb (βm − b) (O.21)
2
Then, notice that the term into brackets can be equivalently rewritten as:
−1 −1
(βm − b), N −1 Σb (βm − b) = (b − βm ), N −1 Σb (b − βm )
1
−1
π (b |y, β, Σb , Σ) ∝ exp − (b − βm ), N −1 Σb (b − βm ) (O.22)
2
This is the kernel of a multivariate normal distribution with mean βm and covariance matrix N −1 Σb .
Obtain now the conditional posterior for Σb . Start from (4.6.23), and use (4.6.6) and (4.6.13) to
309
A. Derivations
obtain:
π (Σb |y, β, b, Σ)
1 s +2
v0
YN −1/2 , −1 − 02
∝ |Σ b | exp − (β i − b) (Σ b ) (β i − b) × λ1 exp −
i=1 2 2λ1
N
!
1 Xn s
v0
− 0 −1
o
−N/2 , −1
= |(λ1 ⊗ Iq ) Ωb | exp − (βi − b) [(λ1 ⊗ Iq ) Ωb ] (βi − b) × λ1 2 exp −
2 i=1 2λ1
N n
!
1X s
v0
− 20 −1
o
−N/2 −N/2 −1
= |λ1 ⊗ Iq | |Ωb | exp − (βi − b), Ω−1
b (λ 1 ⊗ Iq ) (βi − b) × λ 1 exp − (a.1.11)
2 i=1 2λ1
N n
!
− qN 1X s
v0
− 20 −1
o
∝ λ1 2 exp − (βi − b), Ω−1
b λ −1
1 (β i − b) × λ1 exp − A.2, A.7
2 i=1 2λ1
N n
!
1 X s
v0
−h − 20 −1
o
, −1
= λ1 2 exp − (βi − b) Ωb (βi − b) × λ1 exp −
2λ1 i=1 2λ1
o
N n
,
(βi − b) Ω−1 (βi − b)
P
h+s0 v0 + b
− −1 i=1
= λ1 2
−
exp
2λ1
v̄ 1
− s̄ −1
= λ1 2 exp − (O.23)
2 λ1
with:
s̄ = h + s0 (O.24)
and:
N n o
(βi − b), Ω−1
X
v̄ = v0 + b (βi − b) (O.25)
i=1
One concludes:
v̄ 1
− s̄ −1
π (Σb |y, β, b, Σ) ∝ λ1 2 exp − (O.26)
2 λ1
s̄
This the kernel of an inverse Gamma distribution with shape 2
and scale v̄2 .
Obtain finally the conditional posteriors for the Σi s. Start from (4.6.28), substitute (4.6.4) and
310
A. Derivations
so:
1 h
i
−(T +n+1)/2 ,
π (Σi |Σ−i , y, β, b, Σb ) ∝ |Σi | exp − tr Σ−1
i (Y i − X i Bi ) (Yi − X i Bi ) (O.27)
2
This is the kernel of an inverse Wishart distribution with scale S̃i = (Yi − Xi Bi ), (Yi − Xi Bi ) and
degrees of freedom T .
311
A. Derivations
Derive the full posterior distribution. Combine the likelihood function (4.7.29) with the priors
(4.7.30), (4.7.31) and (4.7.32) to obtain the posterior as:
T
1
−T /2 Y
−N nT /2 ,
π(θ, Σ̃, σ |y) ∝ (σ) Σ̃
exp − σ −1 (yt −1
− X̃t θ) Σ̃ (yt − X̃t θ)
t=1 2
!
1 −δ0
−(N n+1)/2
α0
× exp − (θ − θ0 ), Θ−1
0 (θ − θ0 ) × Σ̃
× σ − 2 −1 exp
2 2σ
T
!
1 −δ0
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
Y
= × exp
t=1 2 2σ
1
−(T +N n+1)/2
−(N nT +α0 )/2−1 , −1
×(σ) × Σ̃ × exp − (θ − θ0 ) Θ0 (θ − θ0 )
2
(P.2)
Derive now the conditional distributions. Start with θ. Relegate to the proportionality constant any
term not involving θ in (4.7.33):
T
1 1
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) × exp − (θ − θ0 ), Θ−1
Y
π(θ y, Σ̃, σ ) ∝ 0 (θ − θ0 )
t=1 2 2
T
( )!
1 X ,
= exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) + (θ − θ0 ), Θ−1
0 (θ − θ0 )
2 t=1
T
( )!
1 X ,
= exp − (yt − X̃t θ) Σ−1 (yt − X̃t θ) + (θ − θ0 ), Θ−1
0 (θ − θ0 )
2 t=1
(P.3)
Consider only the term in the curly brackets, develop and complete the squares:
T
,
(yt − X̃t θ) Σ−1 (yt − X̃t θ) + (θ − θ0 ), Θ−1
X
0 (θ − θ0 )
t=1
T
y , Σ−1 y + θ, X̃t, Σ−1 X̃t θ − 2θ, X̃t, Σ−1 yt + θ, Θ−1 , −1 , −1
X
= t t 0 θ + θ0 Θ0 θ0 − 2θ Θ0 θ0
t=1
T T T
! !
yt, Σ−1 yt + θ, X̃t, Σ−1 X̃t θ − 2θ, X̃t, Σ−1 yt + θ, Θ−1 , −1 , −1
X X X
= 0 θ + θ0 Θ0 θ0 − 2θ Θ0 θ0
t=1 t=1 t=1
T T T
! !
y , Σ−1 y + θ, X̃t, Σ−1 X̃t Θ−1 ,
X̃t, Σ−1 yt Θ−1 + θ0, Θ−1
X X X
= t t + 0 θ − 2θ + 0 θ0 0 θ0
t=1 t=1 t=1
T T T
! !
yt, Σ−1 yt ,
X̃t, Σ−1 X̃t Θ−1 , −1
X̃t, Σ−1 yt Θ−1
X X X
= +θ + 0 θ − 2θ Θ̄ Θ̄ + 0 θ0
t=1 t=1 t=1
+θ0, Θ−1 , −1 , −1
0 θ0 + θ̄ Θ̄ θ̄ − θ̄ Θ̄ θ̄
312
A. Derivations
Define: !−1
T
X̃t, Σ−1 X̃t + Θ−1
X
Θ̄ = 0 (P.4)
t=1
and:
T
!
X̃t, Σ−1 yt Θ−1
X
θ̄ = Θ̄ + 0 θ0 (P.5)
t=1
T
( !)!
1 ,
(θ − θ̄) Θ̄−1 (θ − θ̄) + yt, Σ−1 yt + θ0, Θ−1 , −1
X
π(θ y, Σ̃, σ ) ∝ exp − 0 θ0 − θ̄ Θ̄ θ̄
2 t=1
T
!!
1 1 X
, −1
= exp − (θ − θ̄) Θ̄ (θ − θ̄) exp − yt, Σ−1 yt + θ0, Θ−1 , −1
0 θ0 − θ̄ Θ̄ θ̄
2 2 t=1
1
,
∝ exp − (θ − θ̄) Θ̄−1 (θ − θ̄)
2
Hence:
1
,
π(θ y, σ, Σ̃) ∝ exp − (θ − θ̄) Θ̄−1 (θ − θ̄) (P.6)
2
This is the kernel of a multivariate normal distribution π(θ y, σ, Σ̃) ∼ N (θ̄, Θ̄).
Now obtain the conditional posterior for Σ̃. Start from (4.7.33) and relegate to the proportion-
ality constant any term not involving Σ̃:
T
1
−(T +N n+1)/2
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
Y
π(Σ̃ |y, θ, σ ) ∝ × Σ̃ (P.7)
t=1 2
313
A. Derivations
Rearrange:
T
1
−(T +N n+1)/2
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
Y
π(Σ̃ |y, θ, σ ) ∝ × Σ̃
t=1 2
T
!
−(T +N n+1)/2 1X ,
= Σ̃ exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
2 t=1
T
!
−(T +N n+1)/2 1X n ,
o
= Σ̃ exp − tr σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ)
2 t=1
T
!
−(T +N n+1)/2 1X n ,
o
= Σ̃ exp − tr Σ̃−1 (yt − X̃t θ)σ −1 (yt − X̃t θ) (a.1.7)
2 t=1
T
( )!
−(T +N n+1)/2 1 ,
Σ̃−1 (yt − X̃t θ)σ −1 (yt − X̃t θ)
X
= Σ̃
exp − tr (a.1.6)
2 t=1
T
( )!
−(T +N n+1)/2 1 ,
− tr Σ̃−1 (yt − X̃t θ)σ −1 (yt − X̃t θ)
X
= Σ̃
exp
2 t=1
Define:
T
,
(yt − X̃t θ)σ −1 (yt − X̃t θ)
X
S̄ = (P.8)
t=1
1 n −1 o
−(T +N n+1)/2
π(Σ̃ |y, θ, σ ) ∝ Σ̃ exp − tr Σ̃ S̄ (P.9)
2
Finally, obtain the conditional posterior distribution for σ. Relegate to the proportionality con-
stant any term not involving σ in (4.7.33):
T
!
1 −δ0
,
exp − σ −1 (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) × σ −(N nT +α0 )/2−1
Y
π(σ y, θ, Σ̃) ∝ × exp
t=1 2 2σ
T
( )!
1 X ,
= σ −(N nT +α0 )/2−1 exp − (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) + δ0
2σ t=1
Define:
ᾱ = N nT + α0 (P.10)
and:
T
!
X , −1
δ̄ = (yt − X̃t θ) Σ̃ (yt − X̃t θ) + δ0 (P.11)
t=1
314
A. Derivations
Note that it is possible to reformulate some of the formulas obtained for the conditional poste-
rior distributions. Those reformulated formulas are simpler as they involve direct matrix products
rather than large summations terms, and a a consequence they are also computationally faster, which
matters when a very large number of replications is implemented. Start with Θ̄ and θ̄, respectively
defined by (P.4) and (P.5). The formula for Θ̄ can reformulate as:
T
!−1
X̃t, Σ−1 X̃t + Θ−1
X
Θ̄ = 0
t=1
−1
X̃
1
X̃
2
−1
X̃ , Σ−1 X̃2, Σ−1 · · · X̃T, Σ−1
= 1 .. + Θ 0
.
X̃T
−1
Σ−1 0 · · · 0 X̃
1
0 Σ−1 0 X̃2
X̃ , X̃2, , + Θ−1
= 1 · · · X̃T
.. .. .. ..
0
. . . .
0 0 · · · Σ−1 X̃T
−1
= X̃IΣ X̃ , + Θ−1
0 (P.13)
with:
Σ−1 0 · · · 0
0
Σ−1 0
X̃ = X̃1, X̃2, · · · X̃T, IΣ = (IT ⊗ Σ−1 ) =
.. .. .. (P.14)
. . .
| {z }
d×N nT
0 0 · · · Σ−1
| {z }
N nT ×N nT
315
A. Derivations
Also:
T
!
X̃t, Σ−1 yt + Θ−1
X
θ̄ = Θ̄ 0 θ0
t=1
y
1
y2
, −1 −1
X̃2, Σ−1 , −1
= Θ̄
X̃1 Σ · · · X̃T Σ .. + Θ0 θ0
.
yT
Σ−1 0 · · · 0 y
1
0 Σ−1 0 y2
,
X̃2, , + Θ−1 θ0
= Θ̄
X̃1 · · · X̃T
.. ... .. .. 0
. . .
0 0 · · · Σ−1 yT
= Θ̄ X̃IΣ y + Θ−1
0 θ0 (P.15)
with:
y
1
y2
y=
..
(P.16)
.
yT
| {z }
N nT ×1
T
,
(yt − X̃t θ)σ −1 (yt − X̃t θ)
X
S̄ =
t=1
T
,
= σ −1
X
(yt − X̃t θ)(yt − X̃t θ)
t=1
,
(y − X̃1 θ)
1 ,
(y2 − X̃2 θ)
= σ −1 (y1 − X̃1 θ) (y2 − X̃2 θ) · · · (yT − X̃T θ)
.. (P.17)
.
,
(yT − X̃T θ)
316
A. Derivations
with:
θ 0 ··· 0
0 θ 0
Y = y1 y2 · · · yT Ẍ = X̃1 X̃2 · · · X̃T Iθ = (IT ⊗ θ) =
.. ... .. (P.19)
. .
| {z } | {z }
N n×T
N n×T d
0 0 ··· θ
| {z }
T d×T
317
A. Derivations
T
" #
1 X ,
δ̄ = (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) + δ0
2 t=1
T
" #
1 X ,
= tr (yt − X̃t θ) Σ̃−1 (yt − X̃t θ) + δ0
2 t=1
T
" #
1 X ,
= tr (yt − X̃t θ)(yt − X̃t θ) Σ̃−1 + δ0 (A.1.7)
2 t=1
T
" ! #
1 ,
(yt − X̃t θ)(yt − X̃t θ) Σ̃−1 + δ0
X
= tr (A.1.6)
2 t=1
" " T # ! #
1 X , −1
= tr (yt − X̃t θ)(yt − X̃t θ) Σ̃ + δ0
2 t=1
,
(y − X̃1 θ)
1 ,
1
(y 2 − X̃ 2 θ)
−1
= tr y1 − X̃1 θ y2 − X̃2 θ · · · yT − X̃T θ
. Σ̃ + δ0
2 ..
,
(yT − X̃T θ)
1h i
= tr (Y − ẌIθ )(Y − ẌIθ ), Σ̃−1 + δ0 (P.21)
2
318
A. Derivations
π(θ, b, Σ̃, ζ, ϕ, y)
π(θ, b, Σ̃, ζ, ϕ |y ) =
π(y)
∝ π(θ, b, Σ̃, ζ, ϕ, y)
π(θ, b, Σ̃, ζ, ϕ, y)
= π(θ, b, Σ̃, ζ, ϕ)
π(θ, b, Σ̃, ζ, ϕ)
= π(y θ, b, Σ̃, ζ, ϕ)π(θ, b, Σ̃, ζ, ϕ)
= π(y θ, b, Σ̃, ζ, ϕ)π(θ, b)π(Σ̃)π(ζ, ϕ)
π(θ, b) π(ζ, ϕ)
= π(y θ, b, Σ̃, ζ, ϕ) π(b)π(Σ̃) π(ϕ)
π(b) π(ϕ)
= π(y θ, b, Σ̃, ζ, ϕ)π(θ |b)π(b)π(Σ̃)π(ζ |ϕ )π(ϕ)
= π(y θ, Σ̃, ζ )π(θ |b )π(b)π(Σ̃)π(ζ |ϕ )π(ϕ) (Q.1)
where the last line obtains by noting that b and ϕ are of no relevance to compute the likelihood
function once θ and ζ are known.
319
A. Derivations
Then obtain the likelihood function. Given (4.8.9) and (4.8.19), it is given by:
T
Y
f (y θ, Σ̃, ζ) = f (yt θt , Σ̃, ζt )
t=1
T
1
,
(2π)−k/2 |Σt |−1/2 exp − (yt − X̃t θt ) Σ−1
Y
= t (yt − X̃t θt )
t=1 2
T
1
−1/2 ,
exp − (yt − X̃t θt ) Σ−1
Y
∝ |Σt | t (yt − X̃t θt )
t=1 2
T
1
−1/2 −1
,
Y
= exp(ζt )Σ̃
exp − (yt − X̃t θt ) exp(ζt )Σ̃ (yt − X̃t θt )
t=1 2
T
1
−1/2
Y −N n/2 −1 , −1
= exp (ζt ) Σ̃
exp − exp (ζt ) (yt − X̃t θt ) Σ̃ (yt − X̃t θt ) A.17
t=1 2
T
( ! )
N nζt −1/2 1
Y , −1
= exp − Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃ (yt − X̃t θt )
t=1 2 2
T
( ! )
N nζt 1
−T /2 Y
,
= Σ̃ exp − exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt )
t=1 2 2
T
( !) T
N nζt 1
−T /2 Y
,
exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt )
Y
= Σ̃ exp −
t=1 2 t=1 2
T T
! !
−T /2 Nn 1X ,
exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt )
X
= Σ̃ exp − ζt exp −
2 t=1 2 t=1
T n
!
−T /2 1X ,
o
= Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt (Q.2)
2 t=1
π(Z |ϕ)
= π(ζ1 , · · · , ζT |ϕ)
π(ζ1 , · · · , ζT |ϕ)
= π(ζ1 , · · · , ζT −1 |ϕ)
π(ζ1 , · · · , ζT −1 |ϕ)
= π(ζT |ζ1 , · · · , ζT −1 , ϕ)π(ζ1 , · · · , ζT −1 |ϕ )
= π(ζT |ζT −1 , ϕ)π(ζ1 , · · · , ζT −1 |ϕ ) (Q.3)
320
A. Derivations
where the last step obtains from the Markovian property of the dynamic process. Repeating the
same process for all the other periods eventually yields:
π(Z |ϕ)
T
Y
= π(ζt |ζt−1 , ϕ)
t=1
(Q.4)
Obtain first the conditional posterior for θ = {θt }Tt=1 . Use Bayes rule (4.8.46), and combine the prior
(4.8.31) with the reformulated likelihood (4.8.50) to obtain:
π(θ y, b, Σ̃, ζ, ϕ) ∝ f (y θ, Σ̃, ζ )π(θ |b)
1
,
= |Σ|−1/2 exp − (y − X̃Θ) Σ̃−1 (y − X̃Θ)
2
1
× |B0 | exp − (Θ − Θ0 ), B0−1 (Θ − Θ0 )
2
1 1
,
∝ exp − (y − X̃Θ) Σ−1 (y − X̃Θ) exp − (Θ − Θ0 ), B0−1 (Θ − Θ0 )
2n 2
1 , −1 , −1
o
= exp − (y − X̃Θ) Σ (y − X̃Θ) + (Θ − Θ0 ) B0 (Θ − Θ0 ) (Q.5)
2
Consider only the term in the curly brackets, develop and complete the squares:
,
(y − X̃Θ) Σ−1 (y − X̃Θ) + (Θ − Θ0 ), B0−1 (Θ − Θ0 )
= y , Σ−1 y + Θ, X̃ , Σ−1 X̃Θ − 2Θ, X̃ , Σ−1 y + Θ, B0−1 Θ + Θ,0 B0−1 Θ0 − 2ΘB0−1 Θ0
= y , Σ−1 y + Θ, X̃ , Σ−1 X̃ + B0−1 Θ − 2Θ, X̃ , Σ−1 y + B0−1 Θ0 + Θ,0 B0−1 Θ0
= y , Σ−1 y + Θ, X̃ , Σ−1 X̃ + B0−1 Θ − 2Θ, B̄ −1 B̄ X̃ , Σ−1 y + B0−1 Θ0
+Θ,0 B0−1 Θ0 + Θ̄, B̄ −1 Θ̄ − Θ̄, B̄ −1 Θ̄
Define:
−1
B̄ = X̃ , Σ−1 X̃ + B0−1 (Q.6)
and:
Θ̄ = B̄ X̃ , Σ−1 y + B0−1 Θ0 (Q.7)
321
A. Derivations
1n
, o
π(θ |y, b, Σ, σ̃, a) ∝ exp − (Θ − Θ̄) B̄ −1 (Θ − Θ̄) + Θ,0 B0−1 Θ0 − Θ̄, B̄ −1 Θ̄ + y , Σ−1 y
2
1 1n
o
,
= exp − (Θ − Θ̄) B̄ −1 (Θ − Θ̄) exp − Θ,0 B0−1 Θ0 − Θ̄, B̄ −1 Θ̄ + y , Σ−1 y
2 2
1
, −1
∝ exp − (Θ − Θ̄) B̄ (Θ − Θ̄) (Q.8)
2
Obtain the conditional posterior for b = {bi }ri=1 . First, noting that from (4.8.16) and (4.8.24),
the priors for the θi s and the bi s are independent across the r factors, one may rewrite:
r
Y r
Y
π(θ |b ) = π(θi |bi ) and π(b) = π(bi )
i=1 i=1
Then consider the conditional posterior for bi . Consider the rewritten Bayes rule (Q.9) and relegate
to the proportionality constant any term not involving bi :
Hence:
θi,t |θ ∼ N (θi,t−1 , bi Idi )
So that: (T )
1
−1/2
exp − (θi,t − θi,t−1 ), (bi Idi )−1 (θi,t − θi,t−1 )
Y
π(θi |bi ) ∝ |bi Idi | (Q.12)
t=1 2
322
A. Derivations
Define:
āi = T di + a0 (Q.13)
and:
T
(θi,t − θi,t−1 ), (θi,t − θi,t−1 ) + b0
X
b̄i = (Q.14)
t=1
āi b̄i
This is the kernel of an inverse Gamma distribution with shape 2
and scale 2
.
Obtain the conditional posterior for Σ̃. Consider Bayes rule (4.8.43) and relegate to the propor-
tionality constant any term not involving Σ̃ to obtain:
π(Σ̃ |y, θ, b, ζ, ϕ) ∝ f (y θ, Σ̃, ζ )π(Σ̃) (Q.16)
323
A. Derivations
T n
!
−T /2 1X , −1
o −(N n+1)/2
= Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃ (yt − X̃t θt ) + N nζt Σ̃
2 t=1
T n
!
−(T +N n+1)/2 1X ,
o
= Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2 t=1
T n
!
−(T +N n+1)/2 1X ,
o
∝ Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt )
2 t=1
T
!
−(T +N n+1)/2 1X n ,
o
= Σ̃
exp − tr exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt )
2 t=1
T
!
−(T +N n+1)/2 1X n ,
o
= Σ̃
exp − tr Σ̃−1 (yt − X̃t θt ) exp(−ζt )(yt − X̃t θt )
2 t=1
T
( )!
−(T +N n+1)/2 1 ,
Σ̃−1 (yt − X̃t θt ) exp(−ζt )(yt − X̃t θt )
X
= Σ̃
exp − tr
2 t=1
T
( )!
−(T +N n+1)/2 1 ,
− tr Σ̃−1
X
= Σ̃ exp (yt − X̃t θt ) exp(−ζt )(yt − X̃t θt )
2 t=1
Define:
T
X ,
S̄ = (yt − X̃t θt ) exp(−ζt )(yt − X̃t θt ) (Q.17)
t=1
1 n
−(T +N n+1)/2 o
π(Σ̃ |y, θ, b, ζ, ϕ) ∝ Σ̃ exp − tr Σ̃−1 S̄ (Q.18)
2
Obtain the conditional posterior for ϕ. Start from Bayes rule (4.8.43) and relegate to the pro-
portionality constant any term not involving ϕ:
324
A. Derivations
Define:
ᾱ = T + α0 (Q.20)
and:
δ̄ = Z , G, GZ + δ0 (Q.21)
Finally, obtain the conditional posterior for ζt . Start from (Q.31), and substitute for (4.8.44) and
(4.8.41) to obtain:
π(ζt y, θ, b, Σ̃, ϕ)
T n
!
−T /2 1X ,
o
∝ Σ̃ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2 t=1
! !
−1/2 1 (ζt − γζt−1 )2 −1/2 1 (ζt+1 − γζt )2
×ϕ exp − ×ϕ exp −
2 ϕ 2 ϕ
1
o
, −1
n
∝ exp − exp(−ζt )(yt − X̃t θt ) Σ̃ (yt − X̃t θt ) + N nζt
2 ! !
1 (ζt − γζt−1 )2 1 (ζt+1 − γζt )2
× exp − exp −
2 ϕ 2 ϕ
1
o
, −1
n
= exp − exp(−ζt )(yt − X̃t θt ) Σ̃ (yt − X̃t θt ) + N nζt
2( )!
1 (ζt − γζt−1 )2 + (ζt+1 − γζt )2
× exp −
2 ϕ
(Q.23)
325
A. Derivations
Define:
ϕ
ϕ̄ = (Q.26)
1 + γ2
and
γ(ζt−1 + ζt+1 )
ζ̄ = ϕ̄ (Q.27)
ϕ
Then Q.25 rewrites:
1n
o
,
∝ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2(
1 (ζt − ζ̄)2 γ 2 ζt−1
2 2
)!
+ ζt+1 ζ̄ 2
× exp − + −
2 ϕ̄ ϕ ϕ̄
1
o
, −1
n
∝ exp − exp(−ζt )(yt − X̃t θt ) Σ̃ (yt − X̃t θt ) + N nζt
2( )!
1 (ζt − ζ̄)2
× exp −
2 ϕ̄
(Q.29)
326
A. Derivations
This is not a standard formula, so that a Metropolis-Hastings step is required to sample from the
conditional posterior.
Obtain the value of the acceptance probability for the Metropolis-Hastings algorithm for the in-
dependent kernel:
T n
!
1X ,
o
∝ exp − exp(−ζt )(yt − X̃t θt ) Σ̃−1 (yt − X̃t θt ) + N nζt
2 t=1
!
1 (ζT − γζT −1 )2
× exp − (Q.32)
2 ϕ
There is no need to rearrange further as this expression is similar to Q.29, with ϕ̄ = ϕ and ζ̄ = γζT −1 .
327
A. Derivations
π(β, f −1 , λ, φ|y)
f (y|β, f −1 , λ, φ)π(β, f −1 , λ, φ)
=
f (y)
∝ f (y|β, f , λ, φ)π(β, f −1 , λ, φ)
−1
(R.1)
Since φ is only used to determine λ, it becomes irrelevant when λ is known. Therefore, conditioning
on λ makes φ redundant, and this term can be omitted from the likelihood function:
Relying on a standard independence assumption between the parameters β, f −1 and λ, and relying
on the hierarchical setting introduced in section (1.2) to address the dependence between λ and φ,
one obtains:
π(β, f −1 , λ, φ|y)
∝ f (y|β, f −1 , λ)π(β, f −1 , λ, φ)
= f (y|β, f −1 , λ)π(β)π(f −1 )π(λ, φ)
π(λ, φ)
= f (y|β, f −1 , λ)π(β)π(f −1 ) π(φ)
π(φ)
= f (y|β, f −1 , λ)π(β)π(f −1 )π(λ|φ)π(φ) (R.3)
Consider elements in turn. Assuming independence between the different elements f2−1 , · · · , fn−1 of
f −1 , one obtains:
n
π(f −1 ) = π(fi−1 )
Y
(R.4)
i=2
Noting that from (5.2.3) only φi is used to determine λi , conditioning on φ−i is irrelevant and can
be omitted so that:
328
A. Derivations
n
Y
π(λ|φ) = π(λi |φi ) (R.6)
i=1
Finally, assuming once again independence between the elements φ1 , · · · , φn of φ, one obtains:
n
Y
π(φ) = π(φi ) (R.7)
i=1
Substituting for (R.4), (R.6) and (R.7) in (R.3), Bayes rule reformulates as:
n n n
! ! !
−1 −1
π(fi−1 )
Y Y Y
π(β, f , λ, φ|y) ∝ f (y|β, f , λ)π(β) π(λi |φi ) π(φi ) (R.8)
i=2 i=1 i=1
Given (5.1.3) and (5.1.4), the likelihood function for the data at period t is given by:
1
−n/2 −1/2 ,
f (yt |β, Σt ) = (2π) |Σt | exp − (yt − X̄t β) Σ−1
t (yt − X̄t β) (R.9)
2
This implies that the joint density for the whole data sample is given by:
T
1
−nT /2 −1/2 ,
exp − (yt − X̄t β) Σ−1
Y
f (y |β, Σt ) = (2π) |Σt | t (yt − X̄t β) (R.10)
t=1 2
Relegating to the proportionality constant any term not involving β or Σt , one obtains:
T
1
−1/2 ,
exp − (yt − X̄t β) Σ−1
Y
f (y |β, Σt ) ∝ |Σt | t (yt − X̄t β) (R.11)
t=1 2
Substituting for (5.2.1), one obtains:
f (y|β, f −1 , λ)
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F | (R.12)
t=1 2
The prior for the VAR coefficients β is normal with prior mean β0 and covariance matrix Ω0 :
1
π(β) = (2π)−q/2 |Ω0 |−1/2 exp − (β − β0 ), Ω−1
0 (β − β0 ) (R.13)
2
Relegating terms independent from β to the proportionality constant, (R.13) rewrites:
1
π(β) ∝ exp − (β − β0 ), Ω−1
0 (β − β0 ) (R.14)
2
The prior for each fi−1 is then assumed to be multivariate normal with mean fi0−1 and covariance Υi0 :
fi ∼ N (fi0−1 , Υi0 ). This implies that the prior density is given by:
329
A. Derivations
1
,
−(i−1)/2 −1/2
π(fi−1 ) ∝ (2π) |Υi0 | exp − fi−1 − fi0−1 Υ−1
i0 fi−1 − fi0−1 (R.15)
2
Relegating any term not involving fi−1 to the proportionality constant, one obtains:
1
,
π(fi−1 ) ∝ exp − fi−1 − fi0−1 Υ−1
i0 fi−1 − fi0−1 (R.16)
2
Obtain the second formulation for π(λi |φi ). Start from:
Because from (5.2.3) each λi,t depends on λi,t−1 , assuming independence between the λi,t terms is
not possible. It is however possible to use the hierarchical framework developed in section (1.2) to
obtain:
π(λi |φi )
= π(λi,1 , λi,2 , · · · , λi,T −1 , λi,T |φi )
π(λi,1 , λi,2 , · · · , λi,T −1 , λi,T |φi )
= π(λi,1 , λi,2 , · · · , λi,T −1 |φi )
π(λi,1 , λi,2 , · · · , λi,T −1 |φi )
= π(λi,T |λi,1 , λi,2 , · · · , λi,T −1 , φi )π(λi,1 , λi,2 , · · · , λi,T −1 |φi ) (R.18)
(5.2.3) implies that λi,T is fully determined by λi,T −1 . Therefore λi,1 , λi,2 , · · · , λi,T −2 are redundant
in the conditioning of λi,T , and those terms can be ignored. This Markov property of the process
allows rewriting (R.18) as:
Repeating recursively the same conditioning process for the other periods eventually yields:
π(λi |φi )
= π(λi,T |λi,T −1 , φi )π(λi,T −1 |λi,T −2 , φi ) · · · π(λi,2 |λi,1 , φi )π(λi,1 |φi )
T
Y
= π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) (R.20)
t=2
π(β, f −1 , λ, φ|y)
n n T n
! ( )! !
−1
π(fi−1 )
Y Y Y Y
∝ f (y|β, f , λ)π(β) π(λi,1 |φi ) π(λi,t |λi,t−1 , φi ) π(φi ) (R.21)
i=2 i=1 t=2 i=1
330
A. Derivations
Finally, the prior for the heteroskedasticity variance parameters φ1 , φ2 , · · · , φn is inverse gamma with
shape α20 and scale δ20 :
π(β|y, f −1 , λ, φ)
∝ f (y|β, f −1 , λ)π(β)
T
1 1
,
|F Λt F , |−1/2 exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β) × exp − (β − β0 ), Ω−1
Y
= 0 (β − β0 )
t=1 2 2
T
1 1
,
|Σt |−1/2 exp − (yt − X̄t β) Σ−1 , −1
Y
= t (yt − X̄t β) × exp − (β − β0 ) Ω0 (β − β0 )
t=1 2 2
T
1 1
, , −1
exp − (yt − X̄t β) Σ−1
Y
∝ t (yt − X̄t β) × exp − (β − β0 ) Ω0 (β − β0 )
t=1 2 2
T
!
1X 1
, , −1
= exp − (yt − X̄t β) Σ−1
t (yt − X̄t β) × exp − (β − β0 ) Ω0 (β − β0 )
2 t=1 2
T
( )!
1 X , , −1
= exp − (yt − X̄t β) Σ−1
t (yt − X̄t β) + (β − β0 ) Ω0 (β − β0 ) (R.24)
2 t=1
331
A. Derivations
Define:
T
!−1
X̄t, Σ−1 Ω−1
X
Ω̄ = t X̄t + 0 (R.25)
t=1
and:
T
!
X̄t, Σ−1 Ω−1
X
β̄ = Ω̄ t yt + 0 β0 (R.26)
t=1
Then:
T
y , Σ−1 y + β , Ω̄−1 β − 2β , Ω̄−1 β̄ + β0, Ω−1 , −1 , −1
X
= t t t 0 β0 + β̄ Ω̄ β̄ − β̄ Ω̄ β̄
t=1
T
= β , Ω̄−1 β + β̄ , Ω̄−1 β̄ − 2β , Ω̄−1 β̄ + y , Σ−1 y + β , Ω−1 β − β̄ , Ω̄−1 β̄
X
t t t 0 0 0
t=1
T
= (β − β̄), Ω̄−1 (β y , Σ−1 y + β , Ω−1 β − β̄ , Ω̄−1 β̄
X
− β̄) + t t t 0 0 0 (R.27)
t=1
π(β|y, f −1 , λ, φ)
T
( )!
1 , −1
X , −1
, −1 , −1
= exp − (β − β̄) Ω̄ (β − β̄) + yt Σt yt + β0 Ω0 β0 − β̄ Ω̄ β̄
2 t=1
T
( )!
1 1 X
= exp − (β − β̄), Ω̄−1 (β − β̄) exp − yt, Σ−1
t y , −1 , −1
t + β0 Ω0 β0 − β̄ Ω̄ β̄
2 2 t=1
1
, −1
∝ exp − (β − β̄) Ω̄ (β − β̄) (R.28)
2
This is the kernel of a multivariate normal distribution with mean β̄ and covariance matrix Ω̄. Hence:
Obtain then the conditional posterior distribution for f2−1 , · · · , fn−1 . This is more complicated. Con-
sider first only the likelihood function (R.12):
332
A. Derivations
T
1
,
f (y|β, f −1 , λ) = |F Λt F , |−1/2 exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
(R.30)
t=1 2
Focus on the term within the exponential bracket and rearrange:
,
(yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
= ε,t (F Λt F , )−1 εt
= ε,t (F , )−1 Λ−1
t F
−1
εt
,
= ε,t (F −1 ) Λ−1
t F
−1
εt
, −1/2 , −1/2
= ε,t (F −1 ) (Λt ) Λt F −1 εt
−1/2 , −1/2
= (Λt F −1 εt ) (Λt F −1 εt ) (R.31)
333
A. Derivations
−1/2
(Λ F −1 εt )
t
s̄−0.5
1 exp(−0.5λ1,t ) 0 ··· ··· 0
... ..
s̄−0.5
0 2 exp(−0.5λ2,t ) .
.. ... . ..
exp(−0.5λ3,t ) . .
=
. s̄−0.5
3 .
.. ... ...
. 0
0 ··· ··· 0 s̄n−0.5 exp(−0.5λn,t )
··· ···
1 0 0
ε1,t
.. ..
−1
f21
1 . .
ε2,t
f −1 −1 .. ..
ε
× f32 1 . .
31 3,t
.
.. .. ... ... ..
. . 0
−1 −1 −1 ε
fn1 fn2 · · · fn(n−1) 1 n,t
s̄−0.5
1 exp(−0.5λ1,t ) 0 ··· ··· 0
.. ..
s̄−0.5 .
0 2 exp(−0.5λ2,t ) .
.. .. . ..
exp(−0.5λ3,t ) . .
=
. . s̄−0.5
3 .
.. .. ..
. . . 0
0 ··· ··· 0 s̄−0.5
n exp(−0.5λn,t )
ε1,t
−1
f21 ε1,t + ε2,t
−1 −1
×
f31 ε1,t + f32 ε2,t + ε3,t
..
.
−1 −1 −1
fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t
s̄−0.5
1 exp(−0.5λ1,t )(ε1,t )
−0.5 −1
s̄2 exp(−0.5λ2,t )(f21 ε1,t + ε2,t )
−0.5 −1 −1
=
s̄3 exp(−0.5λ3,t )(f31 ε1,t + f32 ε2,t + ε3,t )
(R.32)
..
.
−1 −1 −1
s̄−0.5
n exp(−0.5λn,t )(fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t )
334
A. Derivations
−1/2 , −1/2
(Λt F −1 εt ) (Λt F −1 εt )
2 2 2
= s̄−1 −1 −1 −1 −1 −1
1 exp(−λ1,t )(ε1,t ) + s̄2 exp(−λ2,t )(f21 ε1,t + ε2,t ) + s̄3 exp(−λ3,t )(f31 ε1,t + f32 ε2,t + ε3,t )
−1 2
+ · · · + s̄−1 −1 −1
n exp(−λn,t )(fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t )
2
n i−1
−1
fij−1 εj,t
X X
= s̄i exp(−λi,t )εi,t + (R.33)
i=1 j=1
,
Denote by ε−i,t the vector of residuals up to εi−1,t : ε−i,t = (ε1,t ε2,t · · · εi−1,t ) . Then (R.33)
rewrites:
n
−1/2 , −1/2
,
2
(Λt F −1 εt ) (Λt F −1 εt ) s̄−1 (fi−1 ) ε−i,t
X
= i exp(−λi,t ) εi,t + (R.34)
i=1
f (y|β, f −1 , λ)
T n !
1X
2
−1 ,
, −1/2
s̄−1
Y
= |F Λt F | exp − exp(−λ ) ε + (f ) ε −i,t (R.35)
t=1 2 i=1 i i,t i,t i
Or, equivalently:
f (y|β, f −1 , λ)
T n
1 −1
2
,
|F Λt F , |−1/2 s̄i exp(−λi,t ) εi,t + (fi−1 ) ε−i,t
Y Y
= exp − (R.36)
t=1 i=1 2
The reformulation can go further. From (A.15) and (A.16), noting that the diagonals of both F and
F , are made of ones, it is easy to obtain:
Also, noting that Λt is diagonal, it follows again from (A.15) that its determinant is given by the
product of its diagonal entries. Thus:
n
!−1/2 n
1
, −1/2 −1/2
Y Y −1/2
|F Λt F | = |Λt | = s̄i exp(λi,t ) = s̄i exp − λi,t (R.38)
i=1 i=1 2
335
A. Derivations
f (y|β, f −1 , λ)
T Y
n
1 1
2
−1/2 −1 ,
exp − λi,t exp − s̄−1
Y
= s̄i exp(−λ ) ε + (f ) ε −i,t
t=1 i=1 2 2 i i,t i,t i
(R.39)
It is now possible to obtain the conditional posterior for fi−1 . Starting from Bayes rule (R.8) and
relegating to the proportionality constant any term not involving fi−1 yields:
1
,
× exp − fi−1 − fi0−1 Υ−1
i0 fi−1 − fi0−1 (R.41)
2
1 −1
−1 , −1
−1 −1
× exp − fi − fi0 Υi0 fi − fi0 (R.42)
2
Rearrange this:
336
A. Derivations
Define:
T
!−1
s̄−1 ε−i,t exp(−λi,t )ε,−i,t Υ−1
X
Ῡi = i + i0 (R.45)
t=1
and:
T
!
f¯i−1 −s̄−1 Υ−1 −1
X
= Ῡi i ε−i,t exp(−λi,t )εi,t + i0 fi0 (R.46)
t=1
337
A. Derivations
T
, ,
εi,t s̄−1 −1 −1 −1
− 2(fi−1 ) Ῡ−1 ¯−1
X
= i exp(−λi,t )εi,t + (fi ) Ῡi fi i fi
t=1
+
,
(fi0−1 ) Υ−1 −1 ¯−1 , −1 ¯−1 − (f¯−1 ), Ῡ−1 f¯−1
i0 fi0 + (fi ) Ῡi fi i i i
−1 , −1 −1 , −1 −1 ,
= (fi ) Ῡi fi + (f¯i ) Ῡi f¯i − 2(fi ) Ῡi f¯i−1
−1 −1 −1
T
, ,
εi,t s̄−1 −1 −1 −1 ¯−1 −1 ¯−1
X
+ i exp(−λi,t )εi,t + (fi0 ) Υi0 fi0 − (fi ) Ῡi fi
t=1
T
, −1 , −1 −1 ¯−1 , −1 ¯−1
= (fi−1 − f¯i−1 ) Ῡ−1 −1
− f¯i−1 ) + εi,t s̄−1
X
i (fi i exp(−λi,t )εi,t + (fi0 ) Υi0 fi0 − (fi ) Ῡi fi
t=1
(R.47)
T
( )!
1 ,
−1 , −1 −1 ¯−1 , −1 ¯−1
(fi−1 − f¯i−1 ) Ῡ−1 −1 ¯−1 ) + −1
X
= exp − i (f i − f i ε s̄
i,t i exp(−λ i,t i,t + (fi0 ) Υi0 fi0 − (fi ) Ῡi fi
)ε
2 t=1
1 n −1 ¯−1 , −1 −1 ¯−1 o
= exp − (fi − fi ) Ῡi (fi − fi )
2(
T
)!
1 X , ,
¯−1 −1 ¯−1
× exp − ε s̄−1 exp(−λi,t )εi,t + (fi0−1 ) Υ−1 −1
i0 fi0 − (fi ) Ῡi fi
2 t=1 i,t i
1 n −1 ¯−1 , −1 −1 ¯−1 o
∝ exp − (fi − fi ) Ῡi (fi − fi ) (R.48)
2
This is the kernel of a multivariate normal distribution with mean f¯i−1 and covariance Ῡi :
Obtain the conditional distribution for φ1 , · · · , φn . Start from Bayes rule (R.8) and relegate to the
proportionality constant any term not involving φi :
For the conditional posterior of φi , the most convenient formulation of π(λi |φi ) is the joint formulation
(5.2.16). Then, substituting for (5.2.16) and (5.2.24), one obtains:
338
A. Derivations
Define:
ᾱ = T + α0 (R.52)
and:
339
A. Derivations
Consider first the likelihood function f (y|β, f −1 , λ). From (R.39), it can be expressed as:
f (y|β, f −1 , λ)
T Y
n
1 1
2
−1/2 −1 ,
exp − λi,t exp − s̄−1
Y
= s̄i exp(−λ ) ε + (f ) ε −i,t
t=1 i=1 2 2 i i,t i,t i
(R.57)
The likelihood function contains many multiplicative terms not involving λi,t . Relegate them to the
proportionality constant to obtain:
= λ2i,t φ−1 2 −1 −1 2 2 −1
i (1 + γ ) − 2λi,t (φi γ(λi,t−1 + λi,t+1 )) + φi γ λi,t−1 + φi λi,t+1
= λi,t φ−1 2 −1 −1 2 2 −1
i (1 + γ )λi,t − 2λi,t (φi γ(λi,t−1 + λi,t+1 )) + φi γ λi,t−1 + φi λi,t+1
(R.60)
340
A. Derivations
= λi,t φ−1 2 −1 −1 −1 2 2 −1
i (1 + γ )λi,t − 2λi,t φ̄ φ̄(φi γ(λi,t−1 + λi,t+1 )) + φi γ λi,t−1 + φi λi,t+1
Define:
φi
φ̄ = (φi−1 (1 + γ 2 ))−1 = (R.62)
1 + γ2
and:
γ
λ̄ = φ̄(φ−1 −1 2 −1 −1
i γ(λi,t−1 + λi,t+1 )) = (φi (1 + γ )) (φi γ(λi,t−1 + λi,t+1 )) = (λ + λi,t+1 ) (R.63)
1 + γ 2 i,t−1
341
A. Derivations
Determine the value of the acceptance function. From (4.8.73), it is given by:
(n−1) (n)
α(λi,t , λi,t )
(n) (n) (n−1)
π(λi,t )q(λi,t , λi,t )
= (n−1) (n−1) (n)
(R.67)
π(λi,t )q(λi,t , λi,t )
2
(n) (n−1) (n) (λ −λ̄)
Notice that the transition kernel q(λi,t , λi,t ) is just the independent kernel q(λi,t ) = exp − 21 i,tφ̄ .
Following, one obtains:
(n−1) (n)
α(λi,t , λi,t )
(n) (n) (n−1)
π(λi,t )q(λi,t , λi,t )
= (n−1) (n−1) (n)
π(λi,t )q(λi,t , λi,t )
2
! 2
!
2 (n) (n−1)
, (λ −λ̄) (λ −λ̄)
(n) (n)
exp − 21 exp(−λi,t )s̄−1
i εi,t + (fi−1 ) ε−i,t + λi,t exp − 21 i,t φ̄ exp − 21 i,t φ̄
= 2 (n−1) 2
!
(n) 2
!
, (λ −λ̄) (λ −λ̄)
(n−1) (n−1)
exp − 12 exp(−λi,t )s̄−1
i εi,t + (fi−1 ) ε−i,t + λi,t exp − 21 i,t φ̄ exp − 12 i,t φ̄
2
,
(n) (n)
exp − 12 exp(−λi,t )s̄−1
i εi,t + (fi−1 ) ε−i,t + λi,t
= 2
,
(n−1) (n−1)
exp − 12 exp(−λi,t )s̄−1
i εi,t + (fi−1 ) ε−i,t + λi,t
1n
2
,
o
(n) (n−1)
= exp − exp(−λi,t ) − exp(−λi,t ) s̄−1
i εi,t + (fi−1 ) ε−i,t
2n
1 (n) (n−1)
o
× exp − λi,t − λi,t (R.68)
2
Hence:
(n−1) (n)
, λi,t )
α(λi,t
1n
2
−1 ,
o
(n) (n−1) −1
= exp − exp(−λi,t ) − exp(−λi,t ) s̄i εi,t + (fi ) ε−i,t
2n
1 (n) (n−1)
o
× exp − λi,t − λi,t (R.69)
2
Here the significant simplification is made possible from the fact that the candidate is directly drawn
from part of the conditional posterior.
Obtain the conditional posterior for period t = 1. Start from Bayes rule (R.21) and relegate to
the proportionality constant any term not involving λi,1 :
π(λi,1 |y, β, f −1 , λ−i,−1 , φ|y) ∝ f (y|β, f −1 , λ)π(λi,1 |φi )π(λi,2 |λi,1 , φi ) (R.70)
342
A. Derivations
Relegate to the proportionality constant any term not involving λi,1 in the likelihood function to
obtain:
= φ−1
i ((ω
−1
+ γ 2 )λ2i,1 + λ2i,2 − 2γλi,1 λi,2 )
= λi,1 (φ−1
i (ω
−1
+ γ 2 ))λi,1 − 2λi,1 φ−1 −1 2
i γλi,2 + φi λi,2 (R.73)
= λi,1 (φ−1
i (ω
−1
+ γ 2 ))λi,1 − 2λi,1 φ̄−1 φ̄φ−1 −1 2 −1 −1
i γλi,2 + φi λi,2 + λ̄φ̄ λ̄ − λ̄φ̄ λ̄ (R.74)
Define:
φi
φ̄ = (φ−1
i (ω
−1
+ γ 2 ))−1 = (R.75)
ω −1 + γ2
and:
343
A. Derivations
γλi,2
λ̄ = φ̄φ−1
i γλi,2 = (R.76)
ω −1 + γ2
Then (R.74) rewrites:
Hence:
2
1 ω −1 λ2i,1 + (λi,2 − γλi,1 )
exp −
2 φi
1n
o
−1 −1 2 −1
= exp − (λi,1 − λ̄)φ̄ (λi,1 − λ̄) + φi λi,2 − λ̄φ̄ λ̄
2
1 1 n −1 2
o
−1 −1
= exp − (λi,1 − λ̄)φ̄ (λi,1 − λ̄) exp − φi λi,2 − λ̄φ̄ λ̄
2 2
1
−1
∝ exp − (λi,1 − λ̄)φ̄ (λi,1 − λ̄)
2 2
1 (λi,1 − λ̄)
= exp − (R.78)
2 φ̄
Following:
344
A. Derivations
(n−1) (n)
α(λi,1 , λi,1 )
(n) (n) (n−1)
π(λi,1 )q(λi,1 , λi,1 )
= (n−1) (n−1) (n)
π(λi,1 )q(λi,1 , λi,1 )
2
! 2
!
2 (n) (n−1)
, (λ −λ̄) (λ −λ̄)
(n) (n)
exp − 21 exp(−λi,1 )s̄−1
i εi,1 + (fi−1 ) ε−i,1 + λi,1 exp − 12 i,1φ̄ exp − 12 i,1 φ̄
= 2 (n−1) 2
!
(n) 2
!
, (λ −λ̄) (λ −λ̄)
(n−1) (n−1)
exp − 12 exp(−λi,1 )s̄−1
i εi,1 + (fi−1 ) ε−i,1 + λi,1 exp − 12 i,1 φ̄ exp − 12 i,1φ̄
2
,
(n) (n)
exp − 12 exp(−λi,1 )s̄−1
i εi,1 + (fi−1 ) ε−i,1 + λi,1
= 2
,
(n−1) (n−1)
exp − 12 exp(−λi,1 )s̄−1
i εi,1 + (fi−1 ) ε−i,1 + λi,1
1n
2
,
o
(n) (n−1)
= exp − exp(−λi,1 ) − exp(−λi,1 ) s̄−1
i εi,1 + (fi−1 ) ε−i,1
2n
1 (n) (n−1)
o
× exp − λi,1 − λi,1 (R.80)
2
Obtain finally the conditional posterior for period t = T . Start from Bayes rule (R.21) and relegate
to the proportionality constant any term not involving λi,T :
1 (λi,T − γλi,T −1 )2
!
× exp − (R.82)
2 φi
345
A. Derivations
Relegate to the proportionality constant any term not involving λi,T in the likelihood function to
obtain:
There is no need to rearrange the expression since the second row only comprises one term. It is the
kernel of a normal distribution with mean λ̄ = γλi,T −1 and variance φ̄ = φi . Finally, the acceptance
function is:
(n−1) (n)
α(λi,T , λi,T )
(n) (n) (n−1)
π(λi,T )q(λi,T , λi,T )
= (n−1) (n−1) (n)
π(λi,T )q(λi,T , λi,T )
2 2
! !
2 (n) (n−1)
(n)
, (n) (λ −λ̄) (λ −λ̄)
exp − 12 exp(−λi,T )s̄−1
i εi,T + (fi−1 ) ε−i,T + λi,T exp − 21 i,Tφ̄ exp − 12 i,T φ̄
= 2 (n−1) 2
!
(n) 2
!
(n−1)
, (n−1) (λ −λ̄) (λ −λ̄)
exp − 21 exp(−λi,T )s̄−1
i εi,T + (fi−1 ) ε−i,T + λi,T exp − 12 i,T φ̄ exp − 12 i,Tφ̄
2
,
(n) (n)
exp − 12 exp(−λi,T )s̄−1
i εi,T + (fi−1 ) ε−i,T + λi,T
= 2
,
(n−1) (n−1)
exp − 21 exp(−λi,T )s̄−1
i εi,T + (fi−1 ) ε−i,T + λi,T
1n
2
−1 ,
o
(n) (n−1)
= exp − exp(−λi,T ) − exp(−λi,T ) s̄−1
i ε i,T + (f i ) ε −i,T
2n
1 (n) o
(n−1)
× exp − λi,T − λi,T (R.84)
2
346
A. Derivations
1 (γi − γ̄)2
!
−1/2
π(γi ) = (2πζ0 ) exp − (S.1)
2 ζ0
Relegating to the proportionality constant any multiplicative term not involving γi :
1 (γi − γ̄)2
!
π(γi ) ∝ exp − (S.2)
2 ζ0
Obtain then Bayes rule for the model:
π(y|β, f −1 , λ, γ, φ)π(β, f −1 , λ, γ, φ)
π(β, f −1 , λ, γ, φ|y) = (S.3)
f (y)
Relegating f (y) to the proportionality constant:
Since γ and φ are only used to determine λ, they become irrelevant when λ is known. Therefore,
conditioning on λ makes γ and φ redundant, and these terms can be omitted from the likelihood
function:
Relying on a standard independence assumption between β, f −1 and λ on the one hand, γ and φ on
the other hand, and relying on the hierarchical framework developed in section (1.2) to address the
dependence between λ, γ and φ, one obtains:
π(β, f −1 , λ, γ, φ|y)
∝ π(y|β, f −1 , λ)π(β, f −1 , λ, γ, φ)
= π(y|β, f −1 , λ)π(β)π(f −1 )π(λ, γ, φ)
π(λ, γ, φ)
= π(y|β, f −1 , λ)π(β)π(f −1 ) π(γ, φ)
π(γ, φ)
= π(y|β, f −1 , λ)π(β)π(f −1 )π(λ|γ, φ)π(γ, φ)
= π(y|β, f −1 , λ)π(β)π(f −1 )π(λ|γ, φ)π(γ)π(φ) (S.6)
Assuming further independence between the different fi−1 , λi , γi and φi , one obtains:
π(β, f −1 , λ, γ, φ|y)
n n n n
! ! ! !
−1
π(fi−1 )
Y Y Y Y
∝ π(y|β, f , λ)π(β) π(λi |γ, φ) π(γi ) π(φi ) (S.7)
i=2 i=1 i=1 i=1
347
A. Derivations
Noting that λi is determined only by γi and φi , conditioning on γ−i and φ−i is redundant and those
terms can be omitted to obtain:
π(β, f −1 , λ, γ, φ|y)
n n n n
! ! ! !
∝ π(y|β, f −1 , λ)π(β) π(fi−1 )
Y Y Y Y
π(λi |γi , φi ) π(γi ) π(φi ) (S.8)
i=2 i=1 i=1 i=1
Using the same reasoning as (R.17)-(R.20) for the standard model, it is possible to write:
T
Y
π(λi |γi , φi ) = π(λi,1 |φi ) π(λi,t |λi,t−1 , γi , φi ) (S.9)
t=2
π(β, f −1 , λ, γ, φ|y)
n n T n n
! ( )! ! !
∝ π(y|β, f −1 , λ)π(β) π(fi−1 )
Y Y Y Y Y
π(λi,1 |φi ) π(λi,t |λi,t−1 , γi , φi ) π(γi ) π(φi )
i=2 i=1 t=2 i=1 i=1
(S.10)
Obtain the conditional posterior for γi . Start from Bayes rule (S.10) and relegate to the proportion-
ality constant any term not involving γi :
T
π(γi |y, β, f −1 , λ, γi , φ) ∝ π(γi )
Y
π(λi,t |λi,t−1 , γi , φi ) (S.11)
t=2
T
Y
∝ π(γi ) × π(λi,t |λi,t−1 , γi , φi )π(γi )
t=2
1 (γi − γ0 )2 T
1 (λi,t − γi λi,t−1 )2
! !
Y
= exp − × exp −
2 ζ0 t=2 2 φi
(γi − γ0 )2 X T
(λi,t − γi λi,t−1 )2
( )!
1
= exp − + (S.12)
2 ζ0 t=2 φi
348
A. Derivations
(γi − γ0 )2 X T
(λi,t − γi λi,t−1 )2
+
ζ0 t=2 φi
T
= ζ0−1 (γi − γ0 )2 + φ−1 (λi,t − γi λi,t−1 )2
X
i
t=2
T T T
!
ζ0−1 (γi2 γ02 φ−1 λ2i,t γi2 λ2i,t−1
X X X
= + − 2γi γ0 ) + i + − 2γi λi,t λi,t−1
t=2 t=2 t=2
T T T
!
γi ζ0−1 γi γ0 ζ0−1 γ0 2γi ζ0−1 γ0 φ−1 λ2i,t φ−1 λ2i,t−1 2γi φ−1
X X X
= + − + i + γi λi,t λi,t−1
i γi − i
t=2 t=2 t=2
T T T
! !
−1 2 −1 −1 −1 −1 −1
λ2i,t
X X X
= γi φi λi,t−1 + ζ0 γi − 2γi φi λi,t λi,t−1 + ζ0 γ0 + γ0 ζ0 γ0 + φi
t=2 t=2 t=2
TX−1 T T
! !
φ−1 λ2i,t + ζ0−1 γi − 2γi φ−1 λi,t λi,t−1 + ζ0−1 γ0 + γ0 ζ0−1 γ0 + φ−1 λ2i,t
X X
= γi i i i (S.13)
t=1 t=2 t=2
Define:
−1
TX
!−1
ζ̄ = φ−1
i λ2i,t + ζ0−1 (S.15)
t=1
and:
T
!
φ−1 ζ0−1 γ0
X
γ̄ = ζ̄ i λi,t λi,t−1 + (S.16)
t=2
T
= γi ζ̄ −1 γi − 2γi ζ̄ −1 γ̄ + γ0 ζ0−1 γ0 + φ−1 λ2i,t + γ̄ ζ̄ −1 γ̄ − γ̄ ζ̄ −1 γ̄
X
i
t=2
T
= (γi − γ̄)ζ̄ −1 (γi − γ̄) + γ0 ζ0−1 γ0 + φ−1 λ2i,t − γ̄ ζ̄ −1 γ̄
X
i (S.17)
t=2
349
A. Derivations
(γi − γ0 )2 X T
(λi,t − γi λi,t−1 )2
( )!
1
∝ exp − +
2 ζ0 t=2 φi
T
( )!
1
(γi − γ̄)ζ̄ −1 (γi − γ̄) + γ0 ζ0−1 γ0 + φ−1 λ2i,t − γ̄ ζ̄ −1 γ̄
X
= exp − i
2 t=2
T
( )!
1 1
= exp − (γi − γ̄)ζ̄ −1 (γi − γ̄) exp − γ0 ζ0−1 γ0 + φ−1 λ2i,t − γ̄ ζ̄ −1 γ̄
X
i
2 2 t=2
1
∝ exp − (γi − γ̄)ζ̄ −1 (γi − γ̄) (S.18)
2
This is the kernel of a normal distribution with mean γ̄ and variance ζ̄: π(γi |y, β, f −1 , λ, γ−i , φ) ∼
N (γ̄, ζ̄).
Since φ is only used to determine λ, it becomes irrelevant when λ is known. Therefore, conditioning
on λ makes φ redundant, and this term can be omitted from the likelihood function:
Relying on a standard independence assumption between β, the elements f2−1 , · · · , fn−1 and λ, and
using the hierarchical framework developed in section (1.2) to address the dependence between λ
350
A. Derivations
π(β, f −1 , λ, φ|y)
∝ f (y|β, f −1 , λ, φ)π(β)π(f −1 )π(λ, φ)
π(λ, φ)
= f (y|β, f −1 , λ, φ)π(β)π(f −1 ) π(φ)
π(φ)
= f (y|β, f −1 , λ, φ)π(β)π(f −1 )π(λ|φ)π(φ)
n
!
−1
π(fi−1 )
Y
= f (y|β, f , λ, φ)π(β) π(λ|φ)π(φ) (T.4)
i=2
Hence: n
!
−1 −1
π(fi−1 )
Y
π(β, f , λ, φ|y) ∝ f (y|β, f , λ, φ)π(β) π(λ|φ)π(φ) (T.5)
i=2
Compute the conditional posteriors in turn, starting with that of β. Use Bayes rule (T.5) and relegate
to the proportionality constant any term not involving β:
To obtain the most efficient formulation for the posterior, some reformulation is required. Consider
first the likelihood function f (y|β, f −1 , λ). From (5.4.6), it is given by:
f (y|β, f −1 , λ)
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F | (T.7)
t=1 2
f (y|β, f −1 , λ)
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
= |F Λt F |
t=1 2
T
1
,
|exp(λt )Σ|−1/2 exp − (yt − X̄t β) (exp(λt )Σ)−1 (yt − X̄t β)
Y
=
t=1 2
T
1
−1/2 ,
exp − (yt − X̄t β) (Σ ⊗ exp(λt ))−1 (yt − X̄t β) (A.17)(A.5)
Y
= (exp(nλt ) |Σ|)
t=1 2
T
1
−1/2 ,
exp − (yt − X̄t β) (Σ ⊗ exp(λt ))−1 (yt − X̄t β)
Y
= exp(−(n/2)λt )|Σ| (T.8)
t=1 2
This can be reformulated further. Note that yt = vec(yt, ), and also that X̄t β = vec(Xt B) from (A.8),
where Xt and B are defined as in (5.1.5) and (5.1.6). It then follows from (A.13) that:
351
A. Derivations
,
n o
(yt − X̄t β) (Σ ⊗ exp(λt ))−1 (yt − X̄t β) = tr Σ−1 (yt, − Xt B), exp(−λt )(yt, − Xt B) (T.9)
f (y|β, f −1 , λ)
T
1 n
o
−1/2
exp − tr Σ−1 (yt, − Xt B), exp(−λt )(yt, − Xt B)
Y
= exp(−(n/2)λt )|Σ| (T.10)
t=1 2
Consider then the prior for β. It is: π(β) ∼ N (β0 , Σ ⊗ Φ0 ). Following, its full density is given by:
1
−q/2
π(β) = (2π) |Σ ⊗ Φ0 | exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 )
−1/2
(T.11)
2
Relegating to the proportionality constant any multiplicative term not involving β, the kernel is
given by:
1
π(β) ∝ exp − (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 ) (T.12)
2
Denote by B0 the k × n matrix form of β0 such that β0 = vec(B0 ). Then, using once again (A.8),
n o
one obtains (β − β0 ), (Σ ⊗ Φ0 )−1 (β − β0 ) = tr Σ−1 (B − B0 ), Φ−1
0 (B − B0 , and (T.12) can be refor-
)
mulated as:
1 n
o
π(β) ∝ exp − tr Σ−1 (B − B0 ), Φ−1 0 (B − B0 ) (T.13)
2
Then, substituting for (T.10) and (T.13) in (T.6), one obtains:
π(β|y, f −1 , λ)
∝ f (y|β, f −1 , λ)π(β)
T
1 n
o
−1/2
exp − tr Σ−1 (yt, − Xt B), exp(−λt )(yt, − Xt B)
Y
∝ exp(−(n/2)λt )|Σ|
t=1 2
1 n
o
× exp − tr Σ−1 (B − B0 ), Φ−1
0 (B − B0 ) (T.14)
2
π(β|y, f −1 , λ)
T
1 n −1 ,
o
, ,
Y
∝ exp − tr Σ (yt − Xt B) exp(−λt )(yt − Xt B)
t=1 2
1 n −1
o
× exp − tr Σ (B − B0 ), Φ−1
0 (B − B0 ) (T.15)
2
352
A. Derivations
Rearrange:
π(β|y, f −1 , λ)
T
1 n −1 ,
o
, ,
Y
∝ exp − tr Σ (yt − Xt B) exp(−λt )(yt − Xt B)
t=1 2
1 n −1
o
, −1
× exp − tr Σ (B − B0 ) Φ0 (B − B0 )
2
T
!
1X n
−1 , , ,
o
= exp − tr Σ (yt − Xt B) exp(−λt )(yt − Xt B)
2 t=1
1 n
o
× exp − tr Σ−1 (B − B0 ), Φ−1 0 (B − B0 )
2 (
T
)!
1 −1
X , , ,
= exp − tr Σ (yt − Xt B) exp(−λt )(yt − Xt B) (Q.17)
2 t=1
1 n −1
o
, −1
× exp − tr Σ (B − B0 ) Φ0 (B − B0 )
2 (
T
)!
1 , , , ,
= exp − tr Σ−1 (yt − Xt B) exp(−λt )(yt − Xt B) + Σ−1 (B − B0 ) Φ−1
X
0 (B − B0 ) (Q.17)
2 t=1
T
( !)!
1 −1
(yt, − Xt B), exp(−λt )(yt, − Xt B) + (B − B0 ), Φ−1
X
= exp − tr Σ 0 (B − B0 ) (Q.17)
2 t=1
(T.16)
T
(yt, − Xt B), exp(−λt )(yt, − Xt B) + (B − B0 ), Φ−1
0 (B − B0 ) and re-
P
Consider specifically the term
t=1
arrange:
T
(yt, − Xt B), exp(−λt )(yt, − Xt B) + (B − B0 ), Φ−1
X
0 (B − B0 )
t=1
T T T
! ! !
yt exp(−λt )yt, + B, Xt, exp(−λt )Xt B − 2B , Xt, exp(−λt )yt,
X X X
=
t=1 t=1 t=1
, −1
+ B , Φ−1 , −1
0 B + B0 Φ0 B0 − 2B Φ0 B0
T T
! !
yt exp(−λt )yt, ,
Xt, Φ−1
X X
= +B exp(−λt )Xt + 0 B
t=1 t=1
T
!
,
Xt, exp(−λt )yt, Φ−1 + B0, Φ−1
X
− 2B + 0 B0 0 B0 (T.17)
t=1
353
A. Derivations
Define:
T
!−1
Xt, Φ−1
X
Φ̄ = exp(−λt )Xt + 0 (T.19)
t=1
and:
T
!
Xt, exp(−λt )yt, Φ−1
X
B̄ = Φ̄ + 0 B0 (T.20)
t=1
T
!
yt exp(−λt )yt, + B , Φ̄−1 B − 2B , Φ̄−1 B̄ + B0, Φ−1 , −1 , −1
X
= 0 B0 + B̄ Φ̄ B̄ − B̄ Φ̄ B̄
t=1
T
!
, −1 , −1 , −1
yt exp(−λt )yt, + B0, Φ−1 , −1
X
= B Φ̄ B + B̄ Φ̄ B̄ − 2B Φ̄ B̄ + 0 B0 − B̄ Φ̄ B̄
t=1
T
!
, −1
yt exp(−λt )yt, + B0, Φ−1 , −1
X
= (B − B̄) Φ̄ (B − B̄) + 0 B0 − B̄ Φ̄ B̄ (T.21)
t=1
π(β|y, f −1 , λ, φ)
T
( !)!
1 −1 , −1 X , , −1 , −1
∝ exp − tr Σ (B − B̄) Φ̄ (B − B̄) + yt exp(−λt )yt + B0 Φ0 B0 − B̄ Φ̄ B̄
2 t=1
1 n
o
,
= exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄)
2 (
T
!)!
1 −1
X , , −1 , −1
× exp − tr Σ yt exp(−λt )yt + B0 Φ0 B0 − B̄ Φ̄ B̄ (Q.17)
2 t=1
1 n −1
o
, −1
∝ exp − tr Σ (B − B̄) Φ̄ (B − B̄) (T.22)
2
Hence:
1 n
,
o
−1
π(β|y, f , λ, φ) ∝ exp − tr Σ−1 (B − B̄) Φ̄−1 (B − B̄) (T.23)
2
This is the kernel of a matrix normal distribution with location B̄ and scale matrices Σ and Φ̄:
π(β|y, f −1 , λ, φ) ∼ MN (B̄, Σ, Φ̄).
Derive then the conditional posterior for the elements fi−1 , i = 1, · · · , n related to the F matrix.
The resolution method is similar to the previous models, but has now to cope with the fact that
354
A. Derivations
there is only one volatility term λt . Consider first the likelihood function only:
f (y|β, f −1 , λ)
T
1
, −1/2 ,
exp − (yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
Y
∝ |F Λt F | (T.24)
t=1 2
Pay specifically attention to the term within the exponential bracket and rearrange:
,
(yt − X̄t β) (F Λt F , )−1 (yt − X̄t β)
= ε,t (F Λt F , )−1 εt
= ε,t (F , )−1 Λ−1
t F
−1
εt
,
= ε,t (F −1 ) Λ−1
t F
−1
εt
, −1/2 , −1/2
= ε,t (F −1 ) (Λt ) Λt F −1 εt
−1/2 , −1/2
= (Λt F −1 εt ) (Λt F −1 εt ) (T.25)
355
A. Derivations
−1/2
term Λt F −1 εt in (T.25) can be written and developed as:
−1/2
(Λt F −1 εt )
s̄−0.5
1 exp(−0.5λt ) 0 ··· ··· 0
.. ..
s̄−0.5 .
0 2 exp(−0.5λt ) .
.. .. . ..
s̄3−0.5 exp(−0.5λt ) . .
=
. . .
.. ... ...
. 0
0 ··· ··· 0 s̄−0.5
n exp(−0.5λt )
··· ···
1 0 0
ε1,t
.. ..
−1
f21
1 . .
ε2,t
f −1 −1 .. ..
ε
× f32 1 . .
31 3,t
.
.. .. .. .. ..
.
. . . 0
−1 −1 −1 ε
fn1 fn2 · · · fn(n−1) 1 n,t
s̄−0.5
1 exp(−0.5λt ) 0 ··· ··· 0
... ..
s̄−0.5
0 2 exp(−0.5λt ) .
.. ... . ..
s̄3−0.5 exp(−0.5λt ) . .
=
. .
.. .. ..
. . . 0
0 ··· ··· 0 s̄−0.5
n exp(−0.5λt )
ε1,t
−1
f21 ε1,t + ε2,t
−1 −1
×
f31 ε1,t + f32 ε2,t + ε3,t
..
.
−1 −1 −1
fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t
s̄−0.5
1 exp(−0.5λt )(ε1,t )
−0.5 −1
s̄2 exp(−0.5λt )(f21 ε1,t + ε2,t )
−0.5 −1 −1
=
s̄3 exp(−0.5λt )(f31 ε1,t + f32 ε2,t + ε3,t )
(T.26)
..
.
−1 −1 −1
s̄−0.5
n exp(−0.5λt )(fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t )
356
A. Derivations
Following:
−1/2 , −1/2
(Λt F −1 εt ) (Λt F −1 εt )
2 2 2
= s̄−1 −1 −1 −1 −1 −1
1 exp(−λt )(ε1,t ) + s̄2 exp(−λt )(f21 ε1,t + ε2,t ) + s̄3 exp(−λt )(f31 ε1,t + f32 ε2,t + ε3,t )
−1 2
+ · · · + s̄−1 −1 −1
n exp(−λt )(fn1 ε1,t + fn2 ε2,t + · · · + fn(n−1) εn−1,t + εn,t )
2
n i−1
−1
fij−1 εj,t
X X
= s̄i exp(−λt )εi,t +
i=1 j=1
2
n i−1
s̄−1 fij−1 εj,t
X X
= exp(−λt ) i
ε +
i,t (T.27)
i=1 j=1
f (y|β, f −1 , λ)
T n
!
, −1/2 1
−1 ,
2
s̄−1
Y X
∝ |F Λt F | exp − exp(−λt ) i ε i,t + (f i ) ε −i,t
t=1 2 i=1
T n
( )
1
2
,
, −1/2
exp − exp(−λt )s̄−1 εi,t + (fi−1 ) ε−i,t
Y Y
= |F Λt F | i
t=1 i=1 2
(T )( T n )
1
2
,
, −1/2
exp − exp(−λt )s̄−1 εi,t + (fi−1 ) ε−i,t
Y YY
= |F Λt F | i (T.29)
t=1 t=1 i=1 2
Reformulate further. From (R.37), one obtains |F Λt F , | = |Λt |. Then, using definition (6.2.23) of Λt :
n
!−1/2 n
!−1/2 n
n
Y
, −1/2 −1/2
Y Y −1/2
|F Λt F | = |Λt | = s̄i exp(λt ) = exp(nλt ) s̄i = exp − λt s̄i
i=1 i=1 2 i=1
(T.30)
357
A. Derivations
f (y|β, f −1 , λ) (T.31)
(T )( T n )
1
2
,
−1/2
|F Λt F , | exp − exp(−λt )s̄−1 εi,t + (fi−1 ) ε−i,t
Y YY
= i
t=1 t=1 i=1 2
(T ( n
)) ( T n )
n 1
Y 2
−1/2 ,
exp − exp(−λt )s̄−1 εi,t + (fi−1 ) ε−i,t
Y YY
= exp − λt s̄i i
t=1 2 i=1 t=1 i=1 2
( n )( T T Y
) ( Y n )
n 1
2
Y −T /2 ,
exp − exp(−λt )s̄−1 εi,t + (fi−1 ) ε−i,t
Y
= s̄i exp − λt i
i=1 t=1 2 t=1 i=1 2
(T.32)
Now obtain the conditional posterior strictly speaking. Consider Bayes rule (T.5) and relegate to
the proportionality constant any multiplicative term not involving fi−1 :
358
A. Derivations
Following:
T
!
1X 1
2 ,
,
= exp − exp(−λt )s̄−1
i εi,t + (fi−1 ) ε−i,t × exp − fi−1 − fi0−1 Υ−1
i0 fi−1 − fi0−1
2 t=1 2
T
( )!
1 X ,
2 ,
= exp − exp(−λt )s̄−1
i εi,t + (fi−1 ) ε−i,t + fi−1 − fi0−1 Υ−1
i0 fi−1 − fi0−1 (T.36)
2 t=1
359
A. Derivations
Define:
T
!−1
s̄−1 ε−i,t exp(−λt )ε,−i,t Υ−1
X
Ῡi = i + i0 (T.39)
t=1
and:
T
!
f¯i−1 −s̄−1 Υ−1 −1
X
= Ῡi i ε−i,t exp(−λt )εi,t + i0 fi0 (T.40)
t=1
T
, ,
εi,t exp(−λt )s̄−1 −1 −1 −1
− 2(fi−1 ) Ῡ−1 ¯−1
X
= i εi,t + (fi ) Ῡi fi i fi
t=1
+
,
(fi0−1 ) Υ−1 −1 ¯−1 , −1 ¯−1 − (f¯−1 ), Ῡ−1 f¯−1
i0 fi0 + (fi ) Ῡi fi i i i
−1 , −1 −1 −1 , −1 ¯−1 −1 , −1 ¯−1
= ¯
(fi ) Ῡi fi + (fi ) Ῡi fi − 2(fi ) Ῡi fi
T
−1 , −1 −1 ¯−1 , −1 ¯−1
εi,t exp(−λt )s̄−1
X
+ i εi,t + (fi0 ) Υi0 fi0 − (fi ) Ῡi fi
t=1
,
= (fi−1 − f¯i−1 ) Ῡ−1 −1
i (fi − f¯i−1 )
T
−1 , −1 −1 ¯−1 , −1 ¯−1
εi,t exp(−λt )s̄−1
X
+ i εi,t + (fi0 ) Υi0 fi0 − (fi ) Ῡi fi (T.41)
t=1
This is the kernel of a normal distribution with mean f¯i−1 and covariance Ῡi :
π(fi−1 |y, β, f−i
−1
, λ, φ) ∼ N (f¯i−1 , Ῡi ).
360
A. Derivations
π(φ|y, β, f −1 , λ, s)
!
1 , −1 −δ0 /2
−1/2 −α0 /2−1
∝ |Φ0 | exp − L Φ0 L × φ exp (T.43)
2 φ
Rearrange:
π(φ|y, β, f −1 , λ)
!
1 , −1 −δ0 /2
−1/2 −α0 /2−1
∝ |Φ0 | exp − L Φ0 L × φ exp
2 φ
!
1 , −δ0 /2
−1 −1/2 −1 −1
, , −α0 /2−1
= φ(G I−ω G)
exp − L φ(G I−ω G) L φ exp
2 φ
" # !
−1/2 1 −δ0
= φ−T /2 (G, I−ω G)−1 exp − L, G, I−ω GL φ−α0 /2−1 exp (A.17)
2φ 2φ
" # !
−T /2 1 , , , −α0 /2−1 −δ0
∝φ exp − L G I−ω GL φ exp
2φ 2φ
!
1
= φ−(T +α0 )/2−1 exp − {L, G, I−ω GL + δ0 } (T.44)
2φ
(T.45)
Define:
ᾱ = T + α0 (T.46)
and:
δ̄ = L, G, I−ω GL + δ0 (T.47)
361
A. Derivations
Substituting for the reformulated likelihood (T.32) and for the conditional density (5.4.12) yields:
Relegating to the proportionality constant any term not involving λt , (T.50) rewrites:
With a reasoning similar to (R.59)-(R.66) to rearrange the second row, (T.51) reformulates as:
with:
φ
φ̄ = (T.53)
1 + γ2
and:
γ
(λt−1 + λt+1 ) (T.54)
1 + γ2
362
A. Derivations
Following the same reasoning as with (R.67)-(R.69), the acceptance function is given by:
(n−1) (n)
α(λt , λt )
n
2
(n) P (n)
exp exp(−λt ) s̄−1
− 12 i εi,t + (fi−1 ), ε−i,t + nλt
i=1
= n 2
(n−1) P (n−1)
exp − 21 exp(−λt ) s̄−1
i εi,t + (fi−1 ), ε−i,t + nλt
i=1
n
!
1n (n) (n−1)
o 2
) s̄−1 −1 ,
X
= exp − exp(−λt ) − exp(−λt i ε i,t + (f i ) ε −i,t
2 i=1
n (n)
(n−1)
× exp − {λt − λt } (T.55)
2
Consider the case t = 1. Starting from Bayes rule (5.4.11) and relegating to the proportionality
constant any term not involving λ1 , one obtains:
Substituting for the reformulated likelihood (T.32) and for the conditional densities (5.4.12) and
(5.4.13) yields:
363
A. Derivations
The second row is similar to the second row of (R.71). Following a similar reasoning allows to obtain:
with:
φ
φ̄ = (T.60)
ω −1 + γ 2
and:
γλ2
λ̄ = (T.61)
ω −1 + γ 2
Consider finally the case t = T . Starting from Bayes rule (5.4.11) and relegating to the proportionality
constant any term not involving λT , one obtains:
Substituting for the reformulated likelihood (T.32) and for the conditional density (5.4.12) yields:
364
A. Derivations
π(β, Ω, Σ |y )
f (y |β, Ω, Σ)π(β, Ω, Σ)
=
π(y)
∝ f (y |β, Ω, Σ)π(β, Ω, Σ)
= f (y |β, Ω, Σ)π(β, Ω)π(Σ)
π(β, Ω)
= f (y |β, Ω, Σ) π(Ω)π(Σ)
π(Ω)
= f (y |β, Ω, Σ)π(β |Ω)π(Ω)π(Σ) (U.1)
Because Ω only serves to determine β, it becomes redundant once β is known, so that it can be
ommited form the likelihood function. One then eventually obtains:
Then obtain the conditional formulation for the prior π(β |Ω):
π(β |Ω)
= π(β1 , β2 , · · · , βT |Ω)
π(β1 , β2 , · · · , βT |Ω)
= π(β1 , β2 , · · · , βT −1 |Ω)
π(β1 , β2 , · · · , βT −1 |Ω)
= π(βT |Ω, β1 , β2 , · · · , βT −1 )π(β1 , β2 , · · · , βT −1 |Ω)
The Markovian property implies that once βT −1 is known, knowledge of β1 , · · · , βT −2 becomes re-
dundant and hence those terms can be omitted from the conditioning, so that:
π(β |Ω)
= π(βT |Ω, βT −1 )π(β1 , β2 , · · · , βT −1 |Ω)
Repeating the same process for the other periods, one eventually obtains:
T
Y
π(β |Ω) = π(β1 |Ω) π(βt |Ω, βt−1 ) (U.3)
t=2
Start with the special case t = 1. The law of motion 6.1.6 implies: β1 = β0 + ν1 . Then, E(β1 ) =
E(β0 ) + E(ν1 ) = 0, and var(β1 ) = τ Ω from 6.1.14. Thus:
365
A. Derivations
For any other period, the law of motion 6.1.6 is: βt = βt−1 + νt . This implies E(βt |Ω, βt−1 ) = βt−1
and var(βt |Ω, βt−1 ) = Ω so that:
π(β |Ω )
T
Y
= π(β1 |Ω ) π(βt |Ω, βt−1 )
t=2
T
1 1
−q −1/2
exp − β1, (τ Ω)−1 β1 × (2π)−q |Ω|−1/2 exp − (βt − βt−1 ), Ω−1 (βt − βt−1 )
Y
= (2π) |τ Ω|
2 t=2 2
T
( )!
−T q −q/2 −T /2 1 , −1
(βt − βt−1 ), Ω−1 (βt − βt−1 )
X
= (2π) τ |Ω| exp − β1 (τ Ω) β1 +
2 t=2
T
( )!
−T /2 1 , −1
(βt − βt−1 ), Ω−1 (βt − βt−1 )
X
∝ |Ω| exp − β1 (τ Ω) β1 + (U.6)
2 t=2
Obtain the conditional distributions. First obtain the conditional distribution for β. Start from
Bayes rule 6.1.7 and relegate to the proportionality constant any term not involving β to obtain:
Substitute for the likelihood 6.1.11 and the prior 6.1.19 to obtain:
1 1
−1/2
,
π(β |y, Ω, Σ) ∝ Σ̄ − X̄B) Σ̄ (y − X̄B) × |Ω0 | exp − B , Ω−1
exp − (y −1
0 B (U.8)
2 2
Relegate to the proportionality constant any term not involving β and rearrange:
π(β |y, Ω, Σ)
1 1 , −1
, −1
∝ exp − (y − X̄B) Σ̄ (y − X̄B) exp − B Ω0 B
2h 2
1 , −1 , −1
i
= exp − (y − X̄B) Σ̄ (y − X̄B) + B Ω0 B (U.9)
2
366
A. Derivations
,
(y − X̄B) Σ̄−1 (y − X̄B) + B , Ω−1
0 B
= B , Ω0−1 + X̄ , Σ̄−1 X̄ B − 2B , Ω̄−1 Ω̄ X̄ , Σ̄−1 y + y , Σ̄−1 y + B̄ , Ω̄−1 B̄ − B̄ , Ω̄−1 B̄ (U.11)
Define:
Ω̄−1 = Ω−1 , −1
0 + X̄ Σ̄ X̄ (U.12)
and
B̄ = Ω̄ X̄ , Σ̄−1 y (U.13)
π(β |y , Ω, Σ)
1h
i
, −1 , −1 , −1
∝ exp − (B − B̄) Ω̄ (B − B̄) + y Σ̄ y − B̄ Ω̄ B̄
2
1 1 h , −1
i
, −1 , −1
= exp − (B − B̄) Ω̄ (B − B̄) exp − y Σ̄ y − B̄ Ω̄ B̄
2 2
1
, −1
∝ exp − (B − B̄) Ω̄ (B − B̄) (U.15)
2
Obtain then the conditional distribution for Ω. We want to find the posterior for each individual ωi .
Start from Bayes rule 6.1.7 and relegate to the proportionality constant any term not involving ωi
to obtain:
367
A. Derivations
π(Ω |y , β, Σ)
T
( )!
−T /2 1
β1, (τ Ω)−1 β1 + (βt − βt−1 ), Ω−1 (βt − βt−1 )
X
∝ |Ω| exp − (U.17)
2 t=2
q !−T /2 q !
−T /2
Y Y −T /2
|Ω| = ωi = ωi (U.18)
i=1 i=1
π(Ω |y , β, Σ)
q ! q ( 2 q XT
)!
Y −T /2 1 X βi,1 X (βi,t − βi,t−1 )2
∝ ωi exp − + (U.20)
i=1 2 i=1 τ ωi i=1 t=2 ωi
368
A. Derivations
Relegate to the proportionality constant any term not involving ωi and rearrange to obtain:
χ0 + T
χ̄ = (U.24)
2
and:
T
2
(βi,t − βi,t−1 )2 + ψ0
P
βi,1 /τ +
t=2
ψ̄ = (U.25)
2
Finally, obtain the conditional posterior for Σ. Start from Bayes rule 6.1.7 and relegate to the
proportionality constant any term not involving Σ to obtain:
Substituting for the likelihood function 6.1.8 and the prior distribution 6.1.23 yields:
π(Σ |y, β, Ω)
T
1
−1/2 ,
exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt )
Y
∝ |Σ|
t=1 2
1 n
o
× |Σ|−(α+n+1)/2 exp − tr Σ−1 S (U.27)
2
369
A. Derivations
Rearrange:
π(Σ |y, β, Ω)
T
1
−1/2 ,
exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt )
Y
∝ |Σ|
t=1 2
1 n −1 o
−(κ+n+1)/2
× |Σ| exp − tr Σ S
2
T
!
1 1 n
o
−T /2 , −1
(yt − X̄t βt ) Σ (yt − X̄t βt ) × |Σ|−(κ+n+1)/2 exp − tr Σ−1 S
X
∝ |Σ| exp −
2 t=1 2
T
" #!
1 X ,
n o
= exp − (yt − X̄t βt ) Σ−1 (yt − X̄t βt ) + tr Σ−1 S × |Σ|−(T +κ+n+1)/2
2 t=1
T
" #!
1 X n ,
o n o
= exp − tr (yt − X̄t βt ) Σ−1 (yt − X̄t βt ) + tr Σ−1 S × |Σ|−(T +κ+n+1)/2
2 t=1
T
" #!
1 X n ,
o n o
= exp − tr Σ−1 (yt − X̄t βt )(yt − X̄t βt ) + tr Σ−1 S × |Σ|−(T +κ+n+1)/2
2 t=1
T
" ( )#!
1 ,
Σ−1 (yt − X̄t βt )(yt − X̄t βt ) + Σ−1 S × |Σ|−(T +κ+n+1)/2
X
= exp − tr
2 t=1
T
( !)!
1 ,
= exp − tr Σ−1 × |Σ|−(T +κ+n+1)/2
X
(yt − X̄t βt )(yt − X̄t βt ) + S (U.28)
2 t=1
Defining:
ᾱ = T + κ (U.29)
and:
T
X ,
S̄ = (yt − X̄t βt )(yt − X̄t βt ) + S (U.30)
t=1
1 n
o
π(Σ |y, β, Ω) ∝ exp − tr Σ−1 S̄ × |Σ|−(κ̄+n+1)/2 (U.31)
2
370
A. Derivations
f (β, Ω, f −1 , λ, φ |y )
f (y |β, Ω, f −1 , λ, φ)π(β, Ω, f −1 , λ, φ)
=
f (y)
∝ f (y |β, Ω, f , λ, φ)π(β, Ω, f −1 , λ, φ)
−1
Since Ω becomes unnecessary when β is known, and similarly φ becomes unnecessary when λ is
known, the likelihood function can be written as:
f (y |β, f −1 , λ) (V.2)
Consider then elements in turn. Assuming independence between the different elements f2−1 , · · · , fn−1
of f −1 , one obtains:
n
π(f −1 ) = π(fi−1 )
Y
(V.4)
i=2
Noting that from (5.2.3) only φi is used to determine λi , conditioning on φ−i is irrelevant and can
be omitted so that:
n
Y
π(λ|φ) = π(λi |φi ) (V.6)
i=1
Finally, assuming once again independence between the elements φ1 , · · · , φn of φ, one obtains:
n
Y
π(φ) = π(φi ) (V.7)
i=1
371
A. Derivations
n n n
! ! !
−1 −1
π(fi−1 )
Y Y Y
f (β, Ω, f , λ, φ |y ) ∝ f (y |β, f , λ)π(β |Ω)π(Ω) π(λi |φi ) π(φi ) (V.8)
i=2 i=1 i=1
372
Bibliography
Arias, J. E., Rubio-Ramirez, J. F., and Waggoner, D. F. (2014). Inference Based on SVARs Iden-
tified with Sign and Zero Restrictions: Theory and Applications. Dynare Working Papers 30,
CEPREMAP.
Banbura, M., Giannone, D., and Reichlin, L. (2010). Large Bayesian vector auto regressions. Journal
of Applied Econometrics, 25(1):71–92.
Bernstein, D. (2005). Matrix Mathematics: Theory, Facts, and Formulas. Princeton University
Press.
Canova, F. and Ciccarelli, M. (2006). Estimating multi-country VAR models. Working Paper Series
603, European Central Bank.
Canova, F. and Ciccarelli, M. (2013). Panel vector autoregressive models: a survey. Working Paper
Series 1507, European Central Bank.
Carriero, A., Clark, T. E., and Marcellino, M. (2012). Common drifting volatility in large Bayesian
VARs. Working Paper Series 1206, Federal Reserve Bank of Cleveland.
Chan, J. and Jeliazkov, I. (2009). Efficient Simulation and Integrated Likelihood Estimation in State
Space Models . International Journal of Mathematical Modelling and Numerical Optimisation,
1(1-2):101–120.
Chib, S. (1995). Marginal Likelihood from the Gibbs Output. Journal of the American Statistical
Association, 90(432):1313–1321.
Chib, S. and Greenberg, E. (1995). Understanding the Metropolis-Hastings Algorithm. The American
Statistician, 49(4):327–335.
Ciccarelli, M., Ortega, E., and Valderrama, M. T. (2012). Heterogeneity and cross-country spillovers
in macroeconomic-financial linkages. Working Papers 1241, Banco de Espana;Working Papers
Homepage.
373
Bibliography
Cogley, T. and Sargent, T. J. (2005). Drift and Volatilities: Monetary Policies and Outcomes in the
Post WWII U.S. Review of Economic Dynamics, 8(2):262–302.
Doan, T., Litterman, R., and Sims, C. (1984). Forecasting and conditional projection using realistic
prior distributions. Econometric Reviews, 3(1):1–100.
Gelman, A. (2006). Prior distributions for variance parameters in hierarchical models. Bayesian
Analysis, 1(3):515–534.
Giannone, D., Lenza, M., and Primiceri, G. E. (2012). Prior Selection for Vector Autoregressions.
Working Papers ECARES ECARES 2012-002, ULB – Universite Libre de Bruxelles.
Giannone, D., Lenza, M., and Primiceri, G. E. (2015). Prior selection for vector autoregressions.
Review of Economics and Statistics, 27(2):436–451.
Giannone, D., Lenza, M., and Primiceri, G. E. (2016). Priors for the long run. CEPR Discussion
Papers 11261, C.E.P.R. Discussion Papers.
Gneiting, T. and Raftery, A. (2007). Strict Proper Scoring Rules, Prediction, and Estimation. Journal
of the American Statistical Association, 102(477).
Gordon, N., Salmond, D., and Smith, A. (1993). Novel approach to nonlinear/non-gaussian bayesian
state estimation. IEEE Proceedings F, Radar and Signal Processing, 140(2):107–113.
Gupta, A. K. and Nagar, D. K. (1999). Matrix Variate Distributions. Chapman & Hall/CRC.
Jacquier, E., Polson, N., and Rossi, P. (1994). Bayesian Analysis of Stochastic Volatility Models.
Journal of Business and Economic Statistics, 12(4):371–389.
Jarocinski, M. (2010a). Conditional forecasts and uncertainty about forecast revisions in vector
autoregressions. Economics Letters, 108(3):257–259.
Jarocinski, M. (2010b). Responses to monetary policy shocks in the east and the west of Europe: a
comparison. Journal of Applied Econometrics, 25(5):833–868.
Kadiyala, K. R. and Karlsson, S. (1997). Numerical Methods for Estimation and Inference in Bayesian
VAR-Models. Journal of Applied Econometrics, 12(2):99–132.
374
Bibliography
Karlsson, S. (2012). Forecasting with Bayesian Vector Autoregressions. Working Papers 2012:12,
Oerebro University, School of Business.
Litterman, R. (1986). Forecasting with Bayesian Vector Autoregressions – Five years of experience
: Robert b. Litterman, Journal of Business and Economic Statistics 4 (1986) 25-38. International
Journal of Forecasting, 2(4):497–498.
Luetkepohl, H. (1993). Introduction to Multiple Time Series Analysis. Springer - Verlag, 2st ed.
2006. corr. 2nd printing edition.
Marsaglia, G. and Tsang, W. W. (2000). A simple method for generating gamma variables. ACM
Transactions on Mathematical Software, 26(3):363–372.
Matheson, J. and Winkler, R. (1976). Scoring Rules for Continuous Probability Distributions. Man-
agement Science, 22:1087–1096.
Pesaran, H. and Smith, R. (1995). Estimating long-run relationships from dynamic heterogeneous
panels. Journal of Econometrics, 1:79–113.
Pozrikidis, C. (2014). An Introduction to Grids, Graphs, and Networks. Oxford University Press.
Robertson, J. C., Tallman, E. W., and Whiteman, C. H. (2005). Forecasting Using Relative Entropy.
Journal of Money, Credit and Banking, 37(3):383–401.
Simon, C. and Blume, L. (1994). Mathematics for economists. W. W. Norton & Company.
Sims, C. A. (1992). A Nine Variable Probabilistic Macroeconomic Forecasting Model. Cowles Foun-
dation Discussion Papers 1034, Cowles Foundation for Research in Economics, Yale University.
Villani, M. (2005). Inference in Vector Autoregressive Models with an Informative Prior on the
Steady-State. Technical report, Sveriges Riksbank.
Villani, M. (2009). Steady-state priors for vector autoregressions. Journal of Applied Econometrics,
24(4):630–650.
Waggoner, D. F. and Zha, T. (1999). Conditional Forecasts In Dynamic Multivariate Models. The
Review of Economics and Statistics, 81(4):639–651.
Warne, A., Coenen, G., and Christoffel, K. (2013). Marginalised Predictive Likelihood Comparisons
with Application to DSGE, DSGE-VAR, and VAR Models. Technical report, Center for Financial
Studies.
375
Bibliography
Zellner, A. and Hong, C. (1989). Forecasting international growth rates using bayesian shrinkage
and other procedures. Journal of Econometrics, 40(1):183–202.
376