Exercises in Advanced Risk and Portfolio Management PDF
Exercises in Advanced Risk and Portfolio Management PDF
Exercises in Advanced Risk and Portfolio Management PDF
R
(ARPM)
with Solutions and Code, supporting the 6-day intensive course ARPM Bootcamp
Attilio Meucci
[email protected]
Contents
0.1 Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1 Univariate statistics 1
E 1 Pdf of an invertible transformation of a univariate random variable (www.1.1) . . . . . . 1
E 2 Cdf of an invertible transformation of a univariate random variable (www.1.1) . . . . . . 2
E 3 Quantile of an invertible transformation of a random variable (www.1.1) . . . . . . . . . 2
E 4 Pdf of a positive affine transformation of a univariate random variable (www.1.2) . . . . 3
E 5 Cdf of a positive affine transformation of a univariate random variable (www.1.2) . . . . 3
E 6 Quantile of a positive affine transformation of a univariate random variable (www.1.2) . 3
E 7 Characteristic function of a positive affine transformation of a univariate random variable
(www.1.2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
E 8 Pdf of an exponential transformation of a univariate random variable (www.1.3) . . . . . 4
E 9 Cdf of an exponential transformation of a univariate random variable (www.1.3) . . . . 4
E 10 Characteristic function of an exponential transformation of a univariate random variable
(www.1.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
E 11 Affine equivariance of the expected value (www.1.4) . . . . . . . . . . . . . . . . . . . 5
E 12 Affine equivariance of the median (www.1.4) . . . . . . . . . . . . . . . . . . . . . . . 5
E 13 Affine equivariance of the range (www.1.4) . . . . . . . . . . . . . . . . . . . . . . . . 5
E 14 Affine equivariance of the mode (www.1.4) . . . . . . . . . . . . . . . . . . . . . . . . 6
E 15 Expected value vs. median of symmetrical distributions (www.1.5) . . . . . . . . . . . . 6
E 16 Raw moments to central moments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
E 17 Relation between the characteristic function and the moments (www.1.6) . . . . . . . . 8
E 18 First four central moments (www.1.6) . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
E 19 Central moments of a normal random variable . . . . . . . . . . . . . . . . . . . . . . 9
E 20 Histogram vs. pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
E 21 Sum of random variables via the characteristic function . . . . . . . . . . . . . . . . . 11
E 22 Sum of random variables via simulation . . . . . . . . . . . . . . . . . . . . . . . . . 11
E 23 Simulation of univariate random normal variable . . . . . . . . . . . . . . . . . . . . 12
E 24 Simulation of a Student t random variable . . . . . . . . . . . . . . . . . . . . . . . . 12
E 25 Simulation of a lognormal random variable . . . . . . . . . . . . . . . . . . . . . . . . 13
E 26 Raw moments of a lognormal random variable . . . . . . . . . . . . . . . . . . . . . . 14
E 27 Comparison of the gamma and chi-square distributions . . . . . . . . . . . . . . . . . 14
2 Multivariate statistics 15
E 28 Distribution of the grades (www.2.1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
E 29 Simulation of random variables by inversion (www.2.1) . . . . . . . . . . . . . . . . . 15
E 30 Pdf of an invertible function of a multivariate random variable (www.2.2) . . . . . . . . 16
E 31 Cdf of an invertible function of a multivariate random variable (www.2.2) . . . . . . . 17
ii
CONTENTS iii
E 217 First-order sensitivity analysis the quantile-based index of satisfaction (www.5.4) . . . 172
E 218 Second-order sensitivity analysis of the quantile-based index of satisfaction I (www.5.4) 173
E 219 Second-order sensitivity analysis of the quantile-based index of satisfaction II (www.5.4) 176
E 220 Value-at-Risk in elliptical markets I . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
E 221 Value-at-Risk in elliptical markets II . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
E 222 Value-at-Risk in elliptical markets III . . . . . . . . . . . . . . . . . . . . . . . . . . 178
E 223 Cornish-Fisher approximation of the Value-at-Risk . . . . . . . . . . . . . . . . . . . 179
E 224 Spectral representation (www.5.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
E 225 Spectral indices of satisfaction and risk aversion . . . . . . . . . . . . . . . . . . . . 181
E 226 Cornish-Fisher approximation of the spectral index of satisfaction (www.5.5) . . . . . 181
E 227 Extreme value theory I (www.5.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
E 228 Extreme value theory II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
E 229 Extreme value theory approximation of Value-at-Risk . . . . . . . . . . . . . . . . . . 183
E 230 First-order sensitivity analysis of the expected shortfall (www.5.5) . . . . . . . . . . . 184
E 231 Second-order sensitivity analysis of the expected shortfall (www.5.5) . . . . . . . . . . 185
E 232 Expected shortfall in elliptical markets I . . . . . . . . . . . . . . . . . . . . . . . . . 186
E 233 Expected shortfall in elliptical markets II . . . . . . . . . . . . . . . . . . . . . . . . 187
E 234 Expected shortfall in elliptical markets III . . . . . . . . . . . . . . . . . . . . . . . . 187
E 235 Expected shortfall and linear factor models . . . . . . . . . . . . . . . . . . . . . . . 188
E 236 Simulation of the investor’s objectives . . . . . . . . . . . . . . . . . . . . . . . . . . 188
E 237 Arrow-Pratt aversion and prospect theory . . . . . . . . . . . . . . . . . . . . . . . . 189
Bibliography 270
0.1 Preface
This exercise book supports the review sessions of the 6-day intensive course Advanced Risk and Portfolio
Management (ARPM) Bootcamp
R
. The latest version of this exercise book is available at www.symmys.
com/node/170.
This exercise book complements the Textbook Risk and Asset Allocation - Springer, by Attilio Meucci
(Meucci, 2005). Each chapter of this exercise book refers to the respective chapter in the textbook. Icons
indicate if an exercise is theoretical or code-based. The number of stars corresponds to the difficulty of
an exercise.
The MATLAB
R
files and this exercise book are provided "as is": no claim of accuracy is made and no
responsibility is taken for possible errors. Both this exercise book and the MATLAB
R
scripts can and
must be used and distributed freely. Please quote the author and the source: "Attilio Meucci, ARPM -
Advanced Risk and Portfolio Management".
Any feedback is highly appreciated, please contact the author at .
Attilio Meucci is grateful to David Ardia for his help editing and consolidating this exercise book.
Chapter 1
Univariate statistics
X 7→ Y ≡ g(X) , (1.1)
fX (g −1 (y))
fY (y) = . (1.2)
|g 0 (g −1 (y))|
Solution of E 1
By the definition (1.3, AM 2005) of the pdf fY we have:
where the third equality follows from the invertibility of the function g. On the other hand, from a Taylor
expansion we obtain:
1
g −1 (y + dy) = g −1 (y) + dy . (1.4)
g 0 (g −1 (y))
Substituting (1.4) in the last expression of (1.3) we obtain:
Z g −1 (y)+ g0 (g−1
1
dy
(y)) 1
fX (x)dx = fX (g −1 (y))
fY (y)dy = 0 −1
dy , (1.5)
g −1 (y) g (g (y))
which yields the desired result.
1
E 2 – Cdf of an invertible transformation of a univariate random variable (www.1.1)
(see E 1)
Consider the same setup than in E 1. Show that:
Solution of E 2
By the definition (1.7, AM 2005) of the cdf FY we have:
FY (y) ≡ P {Y ≤ y}
= P {g(X) ≤ y}
(1.7)
= P X ≤ g −1 (y)
= FX (g −1 (y)) ,
where the third equality follows from the invertibility of the function g, under the assumption that g is an
increasing function of its argument.
Note. In case g is a decreasing function of its argument we obtain:
FY (y) ≡ P{Y ≤ y}
= P{g(X) ≤ y}
(1.8)
= P{X ≥ g −1 (y)} = 1 − P{X ≤ g −1 (y)}
= 1 − FX (g −1 (y)) .
Solution of E 3
Consider the following series of identities that follow from the definition (1.7, AM 2005) of the cdf FY :
where the second equality follows from the invertibility of the function g, under the assumption that g
is an increasing function of its argument. By applying the FY−1 to the first and last terms and using the
definition (1.17, AM 2005) of the quantile QY we obtain the desired result.
Note. In the case where g is a decreasing function of its argument we have:
CHAPTER 1. UNIVARIATE STATISTICS 3
X 7→ Y ≡ g(X) ≡ m + sX , (1.12)
1 y−m
fY (y) = fX . (1.13)
s s
Solution of E 4
We use the fact that:
y−m
g −1 (y) = , g 0 (x) = s , (1.14)
s
in (1.2).
E 5 – Cdf of a positive affine transformation of a univariate random variable (www.1.2)
(see E 4)
Consider the same setup than in E 4. Show that:
y−m
FY (y) = FX . (1.15)
s
Solution of E 5
We use the fact that:
y−m
g −1 (y) = , g 0 (x) = s , (1.16)
s
in (1.6).
E 6 – Quantile of a positive affine transformation of a univariate random variable
(www.1.2) (see E 4)
Consider the same setup than in E 4. Show that:
Solution of E 6
We use the fact that:
y−m
g −1 (y) = , g 0 (x) = s , (1.18)
s
in (1.9).
E 7 – Characteristic function of a positive affine transformation of a univariate
random variable (www.1.2) (see E 4)
Consider the same setup than in E 4. Show that:
Solution of E 7
We use the definition (1.12, AM 2005) of the characteristic function:
n o
φY (ω) ≡ E{eiωY } = E eiω(m+sX) = eiωm E eisωX .
(1.20)
X 7→ Y ≡ g(X) ≡ eX , (1.21)
show that:
1
fY (y) = fX (ln(y)) . (1.22)
y
Solution of E 8
We use the fact that:
in (1.2).
E 9 – Cdf of an exponential transformation of a univariate random variable (www.1.3)
(see E 8)
Consider the same setup than in E 8. Show that:
Solution of E 9
We use the fact that:
in (1.6).
CHAPTER 1. UNIVARIATE STATISTICS 5
Solution of E 10
We use the fact that:
1 y−m
Mod{m + sX} ≡ argmax {fm+sX (y)} = argmax fX
y∈R y∈R s s
y−m (1.32)
= argmax fX = m + s argmax {fX (x)}
y∈R s x∈R
≡ m + s Mod{X} .
Z x
e Z ∞
fX (x)dx + fX (x)dx = 1 . (1.33)
−∞ x
e
If x
e is the symmetry point, then both terms in the left-hand side are equal:
Z x
e
2 fX (x)dx = 1 , (1.34)
−∞
and therefore:
Z x
e
1
x) ≡
FX (e fX (x)dx = . (1.35)
−∞ 2
Z
E{X} ≡ x fX (x)dx
R
Z
e + (x − x
=x e)fX (x)dx (1.36)
ZR
=x
e + u fX (e x + u)du = x
e.
R
where the last integral in (1.36) is null since due to (1.28, AM 2005) we have:
Z 0 Z +∞
x + u)du = −
u fX (e x − u)du = 0 .
u fX (e (1.37)
−∞ 0
1 −1 1
Med{X} ≡ QX = FX =x
e. (1.38)
2 2
RMX n
n ≡ E{X }, n = 1, 2, . . . , (1.39)
CMX X
1 ≡ RM1
(1.40)
CMX n
n ≡ E{(X − E{X}) }, n = 2, 3, . . . .
Determine how to map the first n raw moments into the first n central moments, and how to map the first
n central moments into the first n raw moments. Write two MATLAB
R
functions which implement the
respective mappings.
Solution of E 16
Consider first the mapping of the raw moments to the central moments. For n > 1, from the definition of
central moment (1.40) and the binomial expansion we obtain:
CMX n
n ≡ E{(X − E{X}) }
(n−1 )
X
=E (−1)n−k CMX k
n−k X + X
n
k=0
n−1
X (1.41)
(−1)n−k CMX
k
= n−k E X + E {X n }
k=0
n−1
X
= (−1)n−k CMX X X
n−k RMk + RMn .
k=0
Now, for the mapping of the central moments to the raw moments, we have from (1.41) the following
recursive formula:
n−1
X
RMX X
n = CMn + (−1)n−k+1 CMX X
n−k RMk , (1.42)
k=0
(iω)k
φX (ω) = 1 + (iω) RMX
1 +··· + RMX
k +··· , (1.43)
k!
where the generic coefficient RMX
k is defined in terms of the derivatives of the characteristic function as
follows:
dk φX (ω)
−k
RMX
k ≡i . (1.44)
dω k ω=0
Show that that RMX k is the k-th raw moment of X defined in (1.47, AM 2005). Hence, show that raw
moment of a random variable X, and in particular the expected value of X, can be easily computed by
differentiating its characteristic function.
Solution of E 17
By performing the derivatives on the definition (1.12, AM 2005) of the characteristic function we obtain:
dk dk
Z
iωx
{φ X (ω)} ≡ e fX (x)dx
dω k dω k R
Z (1.45)
= ik eiωx xk fX (x)dx .
R
Therefore:
dk φX (ω)
Z
k
xk fX (x)dx = ik E X k ,
k
=i (1.46)
dω
ω=0 R
and substituting this in (1.44) concludes the solution. The expected value is obtained as a special case
with k = 1.
k
X k!(−1)k−j
CMX
k = RMX X k−j
j (RM1 ) , (1.47)
j=0
j!(k − j)!
CHAPTER 1. UNIVARIATE STATISTICS 9
see e.g. Abramowitz and Stegun (1974), derive the following first four central moments:
CMX X 2 X
2 = −(RM1 ) + RM2
CMX X 3 X X X
3 = 2(RM1 ) − 3(RM1 )(RM2 ) + RM3 (1.48)
CMX
4 = −3(RMX
1 )
4
+ 6(RMX 2 X
1 ) (RM2 ) − 4 RMX
1 RMX
3 + RMX
4 ,
and show that these expressions in turn allow to easily compute variance, standard deviation, skewness
and kurtosis.
Solution of E 18
Simply express formula (1.47) for k = 2, 3, 4. Expressions for the variance, standard deviation, skewness
and kurtosis follow from their definitions:
CMX n
n ≡ E {(X − E {X}) } , (1.53)
of a normal distribution:
X ∼ N(µ, σ 2 ) , (1.54)
Z
MX (z) ≡ ezx fX (x)dx , (1.55)
RMX n
n ≡ E {X } , (1.56)
is the raw moment. This follows from explicitly applying D on both sides of (1.55). The moment
generating function is the characteristic function φX (ω) defined in (1.12, AM 2005) evaluated at ω ≡ z/i:
MX (z) = φX (z/i) . (1.57)
Solution of E 19
First we focus on the raw moments of the standard normal distribution:
Y ∼ N(0, 1) . (1.58)
1 2
From (1.69, AM 2005) and (1.57) we obtain MY (z) ≡ e 2 z . Computing the derivatives:
1 2
D0 MY (z) = e 2 z
1 2
D1 MY (z) = ze 2 z
1 2 1 2
D2 MY (z) = e 2 z + z 2 e 2 z
1 2 1 2
D3 MY (z) = z 3 e 2 z + 3ze 2 z
1 2 1 2 1 2 (1.59)
D4 MY (z) = 3e 2 z + 6z 2 e 2 z + z 4 e 2 z
1 2 1 2 1 2
D5 MY (z) = 10z 3 e 2 z + z 5 e 2 z + 15ze 2 z
1 2 1 2 1 2 1 2
D6 MY (z) = 15e 2 z + 45z 2 e 2 z + 15z 4 e 2 z + z 6 e 2 z
..
.
0 if n is odd
RMYn = (1.60)
(n − 1)!! if n is even ,
CMX X−µ
n = RMn , (1.61)
d
because X − µ = σY . Hence CMX n X−µ
n = σ RMn and:
0 if n is odd
CMX = (1.63)
n σ n (n − 1)!! if n is even .
CHAPTER 1. UNIVARIATE STATISTICS 11
d
Xt = X, t = 1, . . . T , (1.64)
and their realizations iT ≡ {x1 , . . . , xT }. Consider the histogram of the empirical pdf Em(iT ) stemming
from the realization iT , as defined in (1.119, AM 2005), where the width of all the bins is ∆. Show that
the histogram represents a regularized version of the true pdf, rescaled by the factor T ∆.
Solution of E 20
The Glivenko-Cantelli theorem (4.34, AM 2005) states that, under a few mild conditions, the empirical
distribution converges to the true distribution of X as the number of observations T goes to infinity. In
terms of the pdf, the Glivenko-Cantelli theorem reads:
T
1 X (xt )
f iT ≡ δ −→ fX . (1.65)
T t=1 T →∞
Denoting #∆
i the number of points included in the generic i-th bin, the following relation holds:
Z xi + ∆
2
∆→0
#∆
i ≡T fiT (y)dy −→ fX (xi )T ∆ . (1.66)
xi − ∆ T →∞
2
d
X =Y +Z, (1.67)
where Y and Z are independent. Compute the characteristic function φX of X from the characteristic
functions φY of Y and φZ of Z.
Solution of E 21
n o
φX (ω) ≡ E eiωX = E eiω(Y +Z) = E eiωY eiωZ
(1.68)
= E eiωY E eiωZ ≡ φY (ω)φZ (ω) .
(1.69)
X ∼ St(ν, µ, σ 2 ) , (1.70)
Y ∼ LogN(µ, σ 2 ) , (1.71)
where µ ≡ 0.1 and σ 2 ≡ 0.2. Consider the random variable defined as:
Z ≡X +Y . (1.72)
Write a MATLAB
R
script which you:
• Generate a sample of 10,000 draws X from the Student t above, a sample Y of equal size from the
lognormal, sum them term by term (do not use loops) and obtain a sample Z of their sum;
• Plot the sample Z. Do not join the observations (use the plot option ’.’ as in a scatter plot);
• Plot the histogram of Z. Use hist and choose the number of bins appropriately;
• Plot the empirical cdf of Z. Use [f,z] = ecdf(Z) and plot(z, f);
• Plot the empirical quantile of Z. Use prctile.
Solution of E 22
See the MATLAB
R
script S_NonAnalytical.
Solution of E 23
From (1.71, AM 2005) we have E {X} = µ and from (1.72, AM 2005) Var {X} = σ 2 . For the
implementation, see the MATLAB
R
script S_NormalSample.
X ∼ St(ν, µ, σ 2 ) . (1.73)
Knowing that σ 2 ≡ 6, determine ν and µ such that E {X} ≡ 2 and Var {X} ≡ 7. Then write a
MATLAB
R
script in which you:
• Generate a sample X_a from (1.73) using the built-in Student t number generator;
• Generate a sample X_b from (1.73) using the normal number generator, the chi-square number
generator and the following result:
d Y
X =µ+ p , (1.74)
Z/ν
where Y and Z are independent variables distributed as follows:
• Generate a sample X_c of observations from (1.73) using the uniform generator number, tinv and
(2.27, AM 2005);
• In a figure, subplot the histogram of the simulations of X_a, subplot the histogram of the simulations
of X_b and subplot the histogram of the simulations of X_c;
• Compute the empirical quantile functions of the three simulations corresponding to the confidence
grid G ≡ {0.01, 0.02, . . . , 0.99};
• In a separate figure superimpose the plots of the above empirical quantiles, which should coincide.
Use different colors.
q
ν
√
Note. There is a typo in (1.90, AM 2005), which should be Sd{X} = ν−2 σ2 .
Solution of E 24
From (1.89, AM 2005) E{X} = µ and Var{X} = ν 2
ν−2 σ , which leads to ν = 14. See the MATLAB
R
X ∼ LogN(µ, σ 2 ) . (1.76)
Write a MATLAB
R
function which determine µ and σ 2 from E{X} and Var{X}, and use it to determine
µ and σ such that E {X} ≡ 3 and Var {X} ≡ 5. Then write a MATLAB
2 R
script in which you:
• Generate a large sample X from this distribution using lognrnd;
• Plot the sample. Do not join the observations (use the plot option ’.’ as in a scatterplot);
• Plot the histogram. Use hist and choose the number of bins appropriately;
• Plot the empirical cdf. Use [f,x] = ecdf(X) and plot(x, f);
• Superimpose (use hold on) the exact cdf as computed by logncdf. Use a different color;
• Plot the empirical quantile. Use prctile;
• Superimpose (use hold on) the exact quantile as computed by logninv. Use a different color.
√
Note. The MATLAB
R
built-in functions take µ and σ 2 as inputs.
Solution of E 25
From (1.98, AM 2005)-(1.99, AM 2005) we need to solve for µ and σ 2 the following system:
σ2 2 2
E = eµ+ 2 , V = e2µ+σ (eσ − 1) , (1.77)
or:
2 ln(E) = 2µ + σ 2
2 (1.78)
ln(V ) = 2µ + σ 2 + ln(eσ − 1) .
Therefore:
V 2
ln = ln(eσ − 1) , (1.79)
E2
or:
V
σ 2 = ln 1 + 2 . (1.80)
E
From (1.78) we then obtain:
1 V
µ = ln(E) − ln 1 + 2 . (1.81)
2 E
See the MATLAB
R
function LognormalMoments2Parameters and the script S_LognormalSample for the imple-
mentation.
X ∼ LogN(µ, σ 2 ) . (1.82)
Solution of E 26
From (1.94, AM 2005) we have:
d
X n = enY , (1.83)
where Y ∼ N(µ, σ 2 ) and from (2.163, AM 2005) we have nY ∼ N(nµ, n2 σ 2 ). Therefore:
X n ∼ LogN(nµ, n2 σ 2 ) , (1.84)
and the moments follow from (1.98, AM 2005):
2
σ 2 /2
RMX
n =e
nµ+n
. (1.85)
X ∼ Ga(ν, µ, σ 2 ) . (1.86)
Determine for which values of ν, µ and σ 2 this distribution coincides with the chi-square distribution
with ten degrees of freedom?
Hint. We recall that such variable is defined in distribution as follows:
d
X = Y12 + · · · + Yν2 , (1.87)
d d
where Y1 = · · · = Yν ∼ N(µ, σ 2 ) are independent.
Solution of E 27
For ν ≡ 10, µ ≡ 0 and σ 2 ≡ 1 we obtain X ∼ χ210 , see (1.109, AM 2005).
Chapter 2
Multivariate statistics
Solution of E 28
From the standard uniform distribution defined in (1.54, AM 2005), we have to show that:
0 if u≤0
P {U ≤ u} = u if u ∈ [0, 1] (2.2)
1 if u ≥ 1.
We first observe that by the definition of the cdf (1.7, AM 2005) the variable U always lies in the interval
[0, 1], therefore:
0 if u≤0
P {U ≤ u} = (2.3)
1 if u ≥ 1.
As for the remaining cases, from the definition of the quantile function (1.17, AM 2005) we obtain:
P {U ≤ u} = P {FX (X) ≤ u}
= P {X ≤ QX (u)} (2.4)
= FX (QX (u)) = u .
d
QZ (U ) = Z , (2.5)
d
where = means "has the same distribution as".
15
Solution of E 29
P {QZ (U ) ≤ z} = P {U ≤ FZ (z)}
= P {FZ (Z) ≤ FZ (z)} (2.6)
= P {Z ≤ z} .
E 30 – Pdf of an invertible function of a multivariate random variable (www.2.2) *
X 7→ Y ≡ g(X) , (2.7)
meaning that each entry yn ≡ gn (x) is a non-decreasing function of any of the arguments (x1 , . . . , xN ).
Show that:
fX (g−1 (y))
fY (y) = , (2.8)
|Jg (g−1 (y))|
where Jg denotes the Jacobian of g defined as follows:
∂gm (x)
Jgmn (x) ≡ . (2.9)
∂xn
Solution of E 30
From the definition of the pdf (2.4, AM 2005) we can write:
−1
g−1 (y + dy) ≈ g−1 (y) + Jg (g−1 (y))
dy , (2.11)
Therefore:
Z
fY (y)dy = fX (x)dx
[g−1 (y),g−1 (y)+[Jg (g−1 (y))]−1 dy] (2.12)
−1
= fX (g−1 (y)) Jg (g−1 (y)) dy ,
where the determinant accounts for the difference in volume between the infinitesimal parallelotope with
sides dy and the infinitesimal parallelotope with sides dx, see (A.34, AM 2005). Using (A.83, AM 2005)
we obtain the desired result.
Note. To compute the pdf of the variable Y, we do not need to assume that the function g is increasing.
Indeed, as long as g is invertible, it suffices to replace the absolute value of the determinant in (2.12).
Thus in this slightly more general case we obtain:
CHAPTER 2. MULTIVARIATE STATISTICS 17
fX (g−1 (y))
fY (y) = q . (2.13)
2
|Jg (g−1 (y))|
Solution of E 31
From the definition (2.9, AM 2005) of the cdf FY we have:
X 7→ U ≡ g(X) , (2.16)
where g is defined component-wise in terms of the cdf FXn of the the generic n-th component Xn :
This is an invertible increasing transformation and we can use (2.8). From (1.17, AM 2005) the inverse
of this transformation is the component-wise quantile:
By definition, the copula of X is the distribution of U. Since the pdf is the derivative of the cdf, the
Jacobian (2.9) of the transformation reads:
Solution of E 33
See the MATLAB
R
script S_DisplayNormalCopulaPdf.
Solution of E 34
Use (2.14) with gn−1 (u1 , . . . , un ) ≡ QXn (un ).
0 1 ρ
X ∼ N(µ, Σ) , µ≡ , Σ≡ . (2.24)
0 ρ 1
Pick ρ as you please, but make sure to play around with the values ρ ≡ 0.99, ρ ≡ −0.99 and ρ ≡ 0.
Write a MATLAB
R
script which evaluates the copula cdf at a select grid of bivariate values:
Solution of E 35
See the MATLAB
R
script S_DisplayNormalCopulaCdf.
Solution of E 36
See the MATLAB
R
function LognormalCopulaPdf and the script S_DisplayLogNormalCopulaPdf.
FY (y1 , . . . , yN ) = FX (h−1 −1
1 (y1 ), . . . , hN (yN )) . (2.28)
On the other hand, the invariance property of the quantile (1.9), reads in this context:
X1 ∼ Ga(ν1 , σ12 )
(2.30)
X2 ∼ LogN(µ2 , σ22 ) ,
Solution of E 38
See the MATLAB
R
script S_BivariateSample.
E 39 – FX copula-marginal factorization
Write a MATLAB
R
script in which you:
• Load from DB_FX the daily observations of the foreign exchange rates USD/EUR, USD/GBP and
USD/JPY. Define as variables the daily log-changes of the rates;
• Represent the marginal distribution of the three variables and display the respective histograms;
• Represent the copula of the three variables and display the scatter-plot of the copula of all pairs of
variables.
Hint. Applying the marginal cdf to the simulations of a random variable is equivalent to sorting.
Solution of E 39
See the MATLAB
R
script S_FxCopulaMarginal.
X 7→ Y ≡ g(X) ≡ m + BX , (2.31)
fX (B−1 (y − m))
fY (y) = p . (2.32)
|BB0 |
Solution of E 40
In this case the Jacobian (2.9) is:
Jg ≡ B . (2.33)
CHAPTER 2. MULTIVARIATE STATISTICS 21
2 2
|Jg | = |B| = |B| |B0 | = |BB0 | . (2.34)
fX (B−1 (y − m))
fY (y) = p . (2.35)
|BB0 |
E 41 – Characteristic function of an affine transformation of a multivariate ran-
dom variable (www.2.4) (see E 40)
Consider the same setup than in E 40. Show that:
0
φY (ω) = eiω m φX (B0 ω) . (2.36)
Solution of E 41
From the definition (2.13, AM 2005) of the characteristic function:
n 0 o
φY (ω) ≡ E eiω Y
n 0 o
= E eiω (m+BX)
n o (2.37)
0 0 0
= eiω m E ei(B ω) X
0
= eiω m φX (B0 ω) .
E 42 – Pdf of a non-invertible affine transformation of a multivariate random vari-
able (www.2.4) **
Consider a generic random variable X and a random variable Y defined as an non-invertible affine trans-
formation of X:
X 7→ Y ≡ g(X) ≡ m + BX , (2.38)
where:
Ψ ≡ b0 X . (2.40)
Ψ
Y2
Y≡ ≡ BX . (2.41)
..
.
YN
b1 (b2 , . . . , bN )
B≡ , (2.42)
0N −1 IN −1
Z
fΨ (ψ) = fY (ψ, y2 , . . . , yN ) dy2 · · · dyN
RN −1
Z (2.43)
1
=p fX (B−1 Y)dy2 · · · dyN .
|BB0 | RN −1
Nevertheless, it is in general very difficult to perform this last step, as it involves a multiple integration.
For instance, if b1 6= 0 we can choose the extension B according to (2.42) we obtain:
− (b2 ,...,b N)
1
B−1 = b1 b1 , (2.44)
0N −1 IN −1
Z
1 ψ b2 bN
fΨ (ψ) = p 2 fX − y2 · · · − yN , y2 , . . . , yN dy2 · · · dyN . (2.45)
b1 RN −1 b1 b1 b1
E 43 – Characteristic function of a non-invertible affine transformation of a multi-
variate random variable (www.2.4) (see E 42)
Consider the same setup than in E 42. Determine the expression for the characteristic function φΨ .
Solution of E 43
The characteristic function of (2.40) is obtained by setting to zero in (2.36) the dependence on the ancil-
lary variables (2.41) as in (2.24, AM 2005):
φΨ (ω) = φY (ω, 0N −1 )
(2.46)
ω
= φX B0 .
0N −1
CHAPTER 2. MULTIVARIATE STATISTICS 23
For instance, if we choose the extension B according to (2.42) we obtain from (2.46) that the characteristic
function of (2.40) reads:
Y = a + BX , (2.48)
of the N -dimensional random variable X. Prove that the mode is affine equivariant, i.e. it satisfies (2.51,
AM 2005), which in this context reads:
Hint. From (2.32) we derive the vector of the first order derivatives of the pdf of Y in terms of the pdf of
X:
Solution of E 44
By its definition (2.52, AM 2005), the mode Mod {X} is the maximum. Thus it is determined by the
following first order condition:
∂fX
= 0. (2.52)
∂x x=Mod{X}
∂fY
= 0, (2.54)
∂y y=Mod{Y}
!−1
∂ 2 ln fX
MDis {X} ≡ −
∂x∂x0 x=Mod{X}
!−1
∂ 1 ∂fX
=−
∂x fX ∂x0 x=Mod{X}
!−1 (2.55)
1 ∂ 2 fX
1 ∂fX ∂fX
=− − 2
fX ∂x∂x0 x=Mod{X} fX ∂x ∂x0 x=Mod{X}
!−1
∂ 2 fX
= −fX (Mod {X}) .
∂x∂x0 x=Mod{X}
!−1
∂ 2 fY
MDis {Y} = −fY (Mod {Y})
∂y∂y0 y=Mod{Y}
!−1
(B0 )−1 ∂ 2 fX
−1 (2.56)
= −fY (Mod {Y}) B
|BB0 | ∂x∂x0 x=B−1 (Mod{Y}−a)
p
!−1
(B0 )−1 ∂ 2 fX
−1
= −fY (Mod {Y}) B .
|BB0 | ∂x∂x0 x=Mod{X}
p
!−1
(B0 )−1 ∂ 2 fX
fX (Mod {X})
MDis {Y} = − p B−1
|BB0 | ∂x∂x0 X=Mod{X}
p
|BB0 |
!−1 (2.57)
∂ 2 fX
= −fX (Mod {X})B B0 .
∂x∂x0 x=Mod{X}
Solution of E 46
It is immediate to check from the definition (2.65, AM 2005) that the modal dispersion is a symmetric
matrix. Furthermore, the mode is a maximum for the log-pdf, and therefore the matrix of the second
derivatives of the log-pdf at the mode is negative definite. Therefore, the modal dispersion is positive
definite. Affine equivariance, symmetry and positivity make the modal dispersion a scatter matrix.
X 7→ Y
e ≡a
e + BX
e , (2.59)
Solution of E 47
e (N − K) elements a to a
Adding (N − K) non-collinear rows B to B, e and denoting Y a set of (N − K)
ancillary random variables as follows:
Y
e a B
e
Y≡ , a≡ , B≡ , (2.61)
e
Y a B
we extend the transformation (2.59) to an invertible affine transformation as in (2.31):
X 7→ Y ≡ a + BX . (2.62)
From the definition of expected value and using (2.32) we obtain:
n o Z Z
E ae + BX ≡
e ye fY
e (e
y)de
y= y
e fY,Y
e (e
y, y)de
ydy
RK RN
fX (B−1 (y − a))
Z Z
= ye fY (y)dy = y
e p dy (2.63)
RN RN |BB0 |
Z
fX (x)
= (e
a + Bx)
e p dy .
RN |BB0 |
With the change of variable y ≡ a + Bx we obtain:
n o Z fX (x)
E ae + BX
e = (e
a + Bx)
e p |B| dx
RN |BB0 |
Z
(2.64)
=a
e+B e xfX (x)dx
RN
=a e E {X} .
e+B
E 48 – Affine equivariance of the covariance (www.2.6) (see E 47)
Consider the same setup than in E 47. Prove the affine equivariance (2.64, AM 2005) of the covariance
matrix under generic affine transformations, i.e.:
n o
Cov ae + BX
e =B e0 .
e Cov {X} B (2.65)
Moreover, prove that the covariance matrix is a scatter matrix, i.e. it is affine equivariant, symmetric and
positive definite.
Solution of E 48
From the definition of covariance (2.67, AM 2005) and the equivariance of the expected value (2.60) we
obtain:
n o n o n o0
Cov ae + BX
e ≡E a e −E a
e + BX e + BX
e a e −E a
e + BX e + BX
e
(2.66)
n o
= E B(X
e − E {X})(X − E {X})0 B
e0
e0 ,
e Cov {X} B
=B
where the last equality follows from the linearity of the expectation operator (B.56, AM 2005).
which proves the positiveness of the covariance matrix. Affine equivariance, symmetry and positivity
make the covariance matrix a scatter matrix.
(x − K) x−K 1 2
C (x) = 1 + erf √ + √ e− 22 (x−K) . (2.68)
2 2 2 2π
Solution of E 50
From the definition (B.49, AM 2005) of regularization, the regularized profile of the call option is the
convolution of the exact profile (2.36, AM 2005) with the approximate Dirac delta (B.18, AM 2005).
Therefore, from the definition of convolution (B.43, AM 2005) we obtain:
CHAPTER 2. MULTIVARIATE STATISTICS 27
h i
C (x) ≡ C ∗ δ(0) (x)
Z +∞
1 1 2
=√ max(y − K, 0)e− 22 (x−y) dy
2π −∞
Z +∞
1 1 2
=√ (y − K)e− 22 (y−x) dy
2π K
Z +∞
1 1 2 (2.69)
=√ (u + x − K)e− 22 u du
2π K−x
Z +∞ Z +∞
1 1 2 1 1 2
=√ ue− 22 u du + √ (x − K) e− 22 u du
2π K−x 2π K−x
Z +∞ Z +∞
1 d h 2 − 12 u2 i (x − K) 2 2
=√ − e 2 du + √ e−z dz ,
2π K−x du 2 π √ K−x
2 2
√
where in the last line we used the change of variable u/ 22 ≡ z. Using the relation (B.78, AM 2005)
between the complementary error function and the error function, as well as (B.76, AM 2005), i.e. the
fact that the error function is odd, we obtain the desired result.
(x − K) x−K 1 2
P (x) = − 1 − erf √ + √ e− 22 (x−K) . (2.70)
2 22 2π
Solution of E 51
From the definition (B.49, AM 2005) of regularization, the regularized profile of the put option is the
convolution of the exact profile (2.113, AM 2005) with the approximate Dirac delta (B.18, AM 2005).
Therefore, from the definition of convolution (B.43, AM 2005) we obtain:
h i
P (x) ≡ P ∗ δ(0) (x)
Z +∞
1 1 2
=√ − min(y − K, 0)e− 22 (x−y) dy
2π −∞
Z K
1 1 2
=− √ (y − K)e− 22 (y−x) dy
2π −∞
Z K−x (2.71)
1 1 2
= −√ (u + x − K)e− 22 u du
2π −∞
Z K−x Z K−x
1 1 2 1 1 2
= −√ ue− 22 u du − √ (x − K) e− 22 u du
2π −∞ 2π −∞
K−x
Z K−x " Z √ #
1 d 2 − 12 u
h 2
i (x − K) 2 22 −z 2
=√ e 2 du − √ e dz ,
2π −∞ du 2 π −∞
√
where in the last line we used the change of variable u/ 22 ≡ z. Using the relation (B.78, AM 2005)
between the complementary error function and the error function, as well as (B.76, AM 2005), i.e. the
fact that the error function is odd, we obtain the desired result.
where ν ≡ 40, µ ≈ 0.5 and diag(Σ) ≈ 0.01 (you can choose the off-diagonal element). Consider the
generic vector in the plane:
cos θ
eθ ≡ . (2.74)
sin θ
Consider the random variable Zθ ≡ e0θ X, namely the projection of X on the direction eθ . In the same
MATLAB
R
script:
• Compute and plot the sample standard deviation σθ of Zθ as a function of θ ∈ [0, π] (select a grid
of 100 points);
• Show in a figure that the minimum and the maximum of σθ are provided by versors (normalized
vector) parallel to the principal axes of the ellipsoid defined by the sample mean m and the sample
covariance S as plotted by the function TwoDimEllipsoid;
• Compute the radius rθ , i.e. the distance between the surface of the ellipsoid and the center of the
ellipsoid along the direction of the vector as a function of θ ∈ [0, π] (select a grid of 100 points);
• In a separate figure superimpose the plot of σθ and the plot of rθ , showing that the minimum and the
maximum of σθ (i.e. the minimum and the maximum volatility), correspond to the the minimum
and the maximum of rθ respectively (i.e. the length of the smallest and largest principal axis).
Notice that the radius equals the standard deviation only on the principal axes.
Hint. You will have to shift and rescale the output of the MATLAB
R
function mvtrnd. Also, to compute
rθ notice that it satisfies:
CHAPTER 2. MULTIVARIATE STATISTICS 29
Solution of E 53
See the MATLAB
R
script S_MaxMinVariance.
g(x) = 0 , (2.77)
To find the tangency condition of the ellipsoid with the rectangle we compute the gradient of the implicit
representation of EE,Cov :
∂g
= 2 Cov−1 (x − E) . (2.79)
∂x
Since the generic n-th side of the rectangle is perpendicular to the n-th axis, when the gradient is parallel
to the n-th axis, the rectangle is tangent to the ellipsoid. Therefore, to find the tangency condition we
must impose the following condition:
where α is some scalar that we have to compute and δ (n) is the n-th element of the canonical basis of
RN , see (A.15, AM 2005). To compute α we substitute (2.80) in (2.77):
1 = (x − E)0 Cov−1 (x − E)
= (α Cov δ (n) )0 Cov−1 (α Cov δ (n) ) (2.81)
2
= α Var {Xn } ,
so that:
1
α=± . (2.82)
Sd {Xn }
Substituting (2.82) back in (2.80) and then again in (2.77) yields:
1 = (x − E)0 Cov−1 (x − E)
(2.83)
0 1 (n) xn − E {Xn }
= (x − E) ± δ =± .
Sd {Xn } Sd {Xn }
n o Z
q
q2 P X ∈
/ Ev,U = q 2 fX (x)dx
q
RN /Ev,U
Z
≤ (X − v)0 U−1 (x − v)fX (x)dx
q
RN /Ev,U
Z (2.84)
≤ (x − v)0 U−1 (x − v)fX (x)dx
Rn
= E (x − v)0 U−1 (x − v)
≡ a(v, U) .
Now we prove that the minimum of (2.85) is (2.86). In other words, among all possible vectors v and
symmetric, positive matrices U such that:
the minimum value of (2.85) is achieved by the choice v ≡ E {X} and U ≡ Cov {X}. Consider an
arbitrary vector u and a perturbation:
v 7→ v + ηu . (2.88)
− E (X − v)0 U−1 (X − v)
(2.89)
≈ − 2η E u0 U−1 (X − v) = −2ηu0 U−1 (E {X} − v) ,
v ≡ E {X} . (2.90)
where I is the identity matrix and B is a matrix that preserves the volumes. From (A.77, AM 2005) this
means:
In the limit of small perturbations → 0, from (A.122, AM 2005) this condition becomes:
tr(B) = 0 . (2.93)
n o
−1
0 = E (X − E {X})0 [U(I + B)] (X − E {X})
− E (X − E {X})0 U−1 (X − E {X})
−1
= tr(Cov {X} [U(I + B)] ) − tr(Cov {X} U−1 ) (2.94)
= tr(Cov {X} (I − B)U−1 ) − tr(Cov {X} U−1 )
= − tr(Cov {X} BU−1 )
= − tr(BU−1 Cov {X}) .
for some scalar α. Given the normalization (2.87) we obtain the desired result.
E 56 – Relation between the characteristic function and the moments (www.2.10)
Assume that the characteristic function of a random variable X is analytical, i.e. it can be recovered
entirely from its Taylor expansion. Show that any raw moment of X can be easily computed by differen-
tiating the characteristic function of X.
Solution of E 56
Consider the expansion of the characteristic function of X around zero:
N
X
φX (ω) = 1 + i ωn RMX
n +···
n=1
N
(2.97)
k
i X
+ (ωn1 · · · ωnk ) RMX
n1 ···nk + · · · .
k! n ,...,n =1
1 k
where RMX
n1 ···nk is defined as follows:
∂ k φX (ω)
−k
RMX
n1 ···nk ≡i . (2.98)
∂ωn1 · · · ∂ωnk ω=0
By performing the derivatives on the definition (2.13, AM 2005) of the characteristic function we obtain:
∂k ∂k
Z
0
{φX (ω)} ≡ eiω x fX (x)dx
∂ωn1 · · · ∂ωnk ∂ωn1 · · · ∂ωnk RN
Z (2.99)
0
= ik xn1 · · · xnk eiω X fX (x)dx .
RN
Therefore:
∂ k φX (ω)
Z
k
=i xn1 · · · xnk fX (x)dx = ik E {Xn1 · · · Xnk } . (2.100)
∂ωn1 · · · ∂ωnk ω=0 RN
RMX
n1 ···nk ≡ E {Xn1 · · · Xnk } . (2.101)
Therefore any raw moment can be easily computed by differentiating the characteristic function.
1 ∂φX (ω)
E {Xn } = RMX
n = . (2.102)
i ∂ωn ω=0
CMX
n1 ···nk ≡ E {(Xn1 − E {Xn1 }) · · · (Xnk − E {Xnk })} , (2.103)
is a function of the raw moments of order up to k, a generalization of (1.47). Similarly k-th raw moment
is a function of the central moments of order up to k. These statements follow by expanding the products
in (2.103) and inverting the ensuing triangular transformation. In particular for the covariance matrix,
which is the central moment of order two, we obtain:
∂ 2 φX (ω)
RMX
mn =− . (2.105)
∂ωm ∂ωn ω=0
1
IE (X) , (2.107)
VN 0,I
N
π2
VN ≡ N
, (2.108)
Γ( 2 + 1)
where Γ is the gamma function (B.80, AM 2005). With the transformation X 7→ Y ≡ µ + BX, where
BB0 ≡ Σ, we obtain a variable Y that is uniformly distributed on the ellipsoid Eµ,Σ , Y ∼ U(Eµ,Σ ), and
the pdf of Y is obtained by applying (2.8) to (2.107).
n 0 o n √ 0 o
φ(ω) ≡ E eiω X = E ei ω ωXN
Z +∞ √
0
= ei ω ωxN f (xN )dxN
−∞
Γ( N2+2 )
Z +1 √ N −1 (2.109)
= N +1 1 cos( ω 0 ωx)(1 − x2 ) 2 dx
Γ( 2 )π 2 −1
Γ( N2+2 )
Z +∞ √ N −1
+ i N +1 1 sin( ω 0 ωx)(1 − x2 ) 2 dx .
Γ( 2 )π 2 −∞
The last term vanishes due to the symmetry of (1 − x2 ) around the origin. From (B.89, AM 2005) and
(B.82, AM 2005) we have:
√
Γ( 21 )Γ( N2+1 ) πΓ( N2+1 )
1 N +1
B , = = . (2.110)
2 2 Γ( N2+2 ) Γ( N2+2 )
2
Z +1 √ N −1
φ(ω) = cos( ω 0 ωx)(1 − x2 ) 2 dx . (2.111)
B( 12 , N2+1 ) 0
With the transformation X 7→ Y ≡ µ + BX, where BB0 ≡ Σ, we obtain a variable Y that is uniformly
distributed on the ellipsoid Eµ,Σ , Y ∼ U(Eµ,Σ ), and the characteristic function of Y is obtained by
applying (2.36) to (2.111).
X = RU , (2.112)
where from (2.259, AM 2005), R ≡ kXk and U ≡ X/ kXk are independent and U is uniformly
distributed on the surface of the unit ball E0N ,IN . From (2.228) in E 80 we obtain:
Similarly:
Z 1 Z 1
N −1 N
E Rk = k
rN +k−1 dr =
r Nr dr = N . (2.116)
0 0 N +k
Using (2.229) in E 80 we obtain:
N IN IN
Cov {X} = = . (2.117)
N +2 N N +2
More in general, we can obtain any moment by applying (2.233):
CMX RU RU
m1 ···mk = CMm1 ···mk = RMm1 ···mk
= E {RUn1 · · · RUnk }
= E Rk E {Un1 · · · Unk }
(2.118)
N
= E {Un1 · · · Unk } ,
N +k
and then using (2.227). With the transformation X 7→ Y ≡ µ + BX, where BB0 ≡ Σ, we obtain a
variable Y that is uniformly distributed on the ellipsoid Eµ,Σ , Y ∼ U(Eµ,Σ ), and the expected value of
Y is obtained by applying (2.56, AM 2005) to (2.113) and the covariance is obtained by applying (2.71,
AM 2005) to (2.117).
E 61 – Marginal distribution of a uniform random variable on the unit sphere
(www.2.11)
Show that its marginal distribution of a uniform random variable on the unit sphere is not uniform.
Solution of E 61
In Fang et al. (1990, p.75), we find the expression of the marginal pdf of the last (N − K) entries of
(B.80, AM 2005) which reads:
N
! K2
Γ( N2+2 ) X
f (xK+1 , . . . , xN ) = N −K 1− x2n , (2.119)
Γ( K+2
2 )π
2
n=K+1
where:
N
X
x2n ≤ 1 . (2.120)
n=K+1
0 1 0
φY (ω) = eiµ ω− 2 ω Σω . (2.121)
Solution of E 62
Consider first a univariate standard normal variable X ∼ N(0, 1). Its characteristic function reads:
φ(ω) ≡ E{eiωX }
Z +∞
1 x2
=√ eiωx e− 2 dx
2π −∞
Z +∞
1 1 2
=√ e− 2 (x −2iωx) dx
2π −∞
Z +∞ (2.122)
1 2 2
e− 2 [(x−iω) +ω ] dx
1
=√
2π −∞
Z +∞
− 12 ω 2 1 1 2
=e √ e− 2 (x−iω) d(x − iω)
2π −∞
1 2
= e− 2 ω
Consider now a set of N independent standard normal variables X ≡ (X1 , . . . , Xn )0 . By definition, their
juxtaposition is a standard N -dimensional normal random vector:
X ∼ N(0, I) . (2.123)
Therefore:
n 0 o Y N N
Y 1 2 1 0
φ(ω) ≡ E eiω X = E eiωn Xn = e− 2 ωn = e− 2 ω ω .
(2.124)
n=1 n=1
Z
iµ0 ω 2
φN
µ,Σ (ω) = e exp − |ω 0 s| mΣ (s)ds . (2.125)
RN
Solution of E 63
First note that we have:
Z Z N
0 1 X
ss mΣ (s)ds ≡ ss0 δ (vn ) + δ (−vn ) (s)ds
RN 4 RN n=1
N
1 X 1 1 1 1 (2.126)
= vn vn0 = VV0 = EΛ 2 Λ 2 E0
2 n=1 2 2
1
= Σ.
2
Therefore:
Z Z
2
|ω 0 s| mΣ (s)ds = (ω 0 s)(s0 ω)mΣ (s)ds
RN RN
Z
0 0 (2.127)
=ω ss mΣ (s)ds ω
RN
1 0
= ω Σω .
2
With this result, we have:
Z
0 2 0 1 0
eiµ ω exp − |ω 0 s| mΣ (s)ds = eiµ ω− 2 ω Σω ≡ φN
µ,Σ (ω) . (2.128)
RN
E 64 – Simulation of a multivariate normal random variable with matching mo-
ments **
Consider a multivariate normal market:
X ∼ N(µ, Σ) , (2.129)
J J
1X b ≡ 1
X
b≡
µ Xj , Σ (Xj − µ)(Xj − µ)0 , (2.130)
J j=1 J j=1
satisfy:
b ≡ µ,
µ b ≡ Σ.
Σ (2.131)
Hint. At a certain point, you will need to solve a Riccati align, which can be solved as follows. First
define the Hamiltonian matrix
0 −Σb
H≡ . (2.132)
−Σ 0
Next perform its Schur decomposition:
H ≡ UTU0 , (2.133)
where UU0 ≡ I and T is upper triangular with the eigenvalues of H on the diagonal sorted in such a
way that the first N have negative real part and the remaining N have positive real part; the terms in this
decomposition are similar in nature to principal components and are computed by MATLAB
R
. Then the
solution of the Riccati align (2.138) reads:
B ≡ ULL U−1
UL , (2.134)
where UU L is the upper left N × N block of U and ULL is the lower left N × N block of U.
Solution of E 64
First produce an auxiliary set of scenarios:
{Y
e j}
j=1,..., J (2.135)
2
from the distribution N(0, Σ). Then complement these scenarios with their opposite
(
ej ≡ Y
ej if 1 ≤ j ≤ J/2
Y (2.136)
−Ye J
j− if J/2 + 1 ≤ j ≤ J .
2
These antithetic variables still represent the distribution N(0, Σ), but they are more efficient as they satisfy
the zero-mean condition. Next apply a linear transformation to the scenarios Y e j , which again preserves
normality:
Yj ≡ BY
e j, j = 1, . . . , J . (2.137)
For any choice of the invertible matrix B, the sample mean is null. To determine B we impose that the
sample covariance matches the desired covariance. Using the affine equivariance of the sample covariance
which follows from (4.42, AM 2005), (4.36, AM 2005), (2.67, AM 2005) and (2.64, AM 2005), we obtain
the matrix Riccati align:
Σ ≡ BΣB,
b B ≡ B0 . (2.138)
With the solution (2.134) we can perform the affine transformation (2.137) and finally generate the desired
scenarios:
Xj ≡ µ + Yj , j = 1, . . . , J , (2.139)
which satisfy (2.131). See the MATLAB
R
function MvnRnd and the script S_ExactMeanAndCovariance for an
implementation of this methodology.
CHAPTER 2. MULTIVARIATE STATISTICS 39
1
f N (u1 , u2 ) = p exp(gρ (u1 , u2 )) , (2.140)
1 − ρ2
where:
0 −1 !
erf −1 (2u1 − 1)
1 ρ 1 0
gρ (u1 , u2 ) ≡ − −
erf −1 (2u2 − 1) ρ 1 0 1
(2.141)
erf −1 (2u1 − 1)
.
erf −1 (2u2 − 1)
Solution of E 65
From (2.30, AM 2005), the pdf of the normal copula reads:
N
fµ,Σ (QN
µ1 ,σ 2
(u1 ), QN
µ2 ,σ 2
(u2 ))
f N (u1 , u2 ) = 1 2
, (2.142)
fµN1 ,σ2 (QN
µ1 ,σ 2
(u1 ))fµN2 ,σ2 (QN
µ2 ,σ 2
(u2 ))
1 1 2 2
where Q is the quantile (1.70, AM 2005) of the marginal one-dimensional normal distribution:
√
QN
µ,σ 2 (u) = µ + 2σ 2 erf −1 (2u − 1) . (2.143)
N
From the expression (2.170, AM 2005) of the two dimensional joint normal pdf fµ,Σ we obtain:
1
(σ12 σ22 (1 − ρ2 ))− 2 − 21 z1 −2ρz
2 2
1 z2 +z2
N
fµ,Σ (QN N
µ1 ,σ 2 (u1 ), Qµ2 ,σ 2 (u2 )) = e (1−ρ2 ) , (2.144)
1 2 2π
where:
√
zi ≡ 2 erf −1 (2ui − 1) (i = 1, 2) . (2.145)
On the other hand, from the expression (1.67, AM 2005) of the marginal pdf we obtain:
1 zi2
2 −2 −
fµNi ,σ2 (QN
µi ,σ 2 (ui )) = (2πσi ) e 2 . (2.146)
i i
Therefore:
1
f N (u1 , u2 ) = p exp(gρ (u1 , u2 )) , (2.147)
1 − ρ2
where:
0 −1 !
erf −1 (2u1 − 1)
1 ρ 1 0
gρ (u1 , u2 ) ≡ − −
erf −1 (2u2 − 1) ρ 1 0 1
(2.148)
erf −1 (2u1 − 1)
.
erf −1 (2u2 − 1)
X ∼ LogN(µ, Σ) . (2.149)
Write a MATLAB
R
function that computes m ≡ E {X}, S ≡ Cov {X} and C ≡ Corr {X} as functions
of the generic inputs µ, Σ.
Solution of E 66
See the MATLAB
R
function LognormalParam2Statistics.
−1
−K −N (X−M)0 Σ−1
e− 2 tr{SK N (X−M)}
NK 1
f (X) ≡ (2π)− 2 |ΣN | 2
|SK | 2
. (2.150)
Solution of E 67
From the definition (2.180, AM 2005) and the definition of the normal pdf (2.156, AM 2005) we have:
f (X) ≡ f (vec(X))
NK − 12
≡ (2π)− 2 |SK ⊗ ΣN | (2.151)
− 12 (vec(X)−vec(M))0 (SK ⊗ΣN )−1 (vec(X)−vec(M))
×e .
From the property (A.102, AM 2005) of the Kronecker product we can write:
− 12 −N −K
|SK ⊗ ΣN | = |SK | 2
|ΣN | 2
. (2.152)
Furthermore, from the property (A.101, AM 2005) of the Kronecker product, we can write:
−1
(SK ⊗ ΣN )−1 = S−1
K ⊗ ΣN . (2.153)
NK −N −K
f (X) = (2π)− 2 |SK | 2
|ΣN | 2
−1
(2.154)
0
⊗Σ−1
× e− 2 {(vec(X)−vec(M)) (SK N )(vec(X)−vec(M))}
1
.
CHAPTER 2. MULTIVARIATE STATISTICS 41
Y ≡ X − M, ΩN ≡ Σ−1
N , ΦK ≡ S−1
K , (2.155)
and recalling the definition (A.96, AM 2005) of the Kronecker product, and the definition (A.104, AM
2005) of the "vec" operator, the term in curly brackets in (2.154) can be written as follows:
h n oi
Cov X(j) , X(k)
= Cov X(j−1)N +m , X(k−1)N +n
m,n
= (SK ⊗ ΣN )(j−1)N +m,(k−1)N +n
S11 Σ · · · S1K Σ (2.157)
=
.. .. ..
. . .
SK1 Σ · · · SKK Σ (j−1)N +m,(k−1)N +n
= Sj,k Σm,n .
n o
Cov X(j) , X(k) = Sj,k Σ . (2.158)
−1
(2.159)
−N −K (X−M)S−1 0
e− 2 tr{ΣN K (X−M) }
NK 1
= (2π)− 2 |SK | 2
|ΣN | 2
,
we see that if X ∼ N(M, Σ, S), then X0 ∼ N(M0 , S, Σ). Using (2.158) and the fact that the columns of
X0 are the rows of X we thus obtain:
Cov X(m) , X(n) = Σmn S . (2.160)
where the term on the left hand side is the matrix-variate Student t distribution (2.198, AM 2005) and the
term on the right hand side is the matrix-variate normal distribution (2.181, AM 2005).
Note. The above result immediately proves the specific vector-variate case. Indeed, from (2.183, AM
2005) and (2.201, AM 2005) we obtain:
In turn, since the vector-variate pdf (2.188, AM 2005) generalizes the one-dimensional pdf (1.86, AM
2005) we also obtain St(∞, m, σ 2 ) = N(m, σ 2 ).
Note. The generalization of the Student t distribution to matrix-variate random variables was studied by
Dickey (1967). Our definition of the pdf corresponds in the notation of Dickey (1967) to the following
special case:
If X ∼ St(ν, M, Σ, S) then:
E {X} = M
n o ν
Cov X(j) , X(k) = Sjk Σ (2.164)
ν−2
ν
Cov X(m) , X(n) = Σmn S .
ν−2
Solution of E 69
To prove (2.161) we start using (A.122, AM 2005) in the definition (2.199, AM 2005) of the pdf of a
matrix-valued Student distribution St(ν, M, Σ, S). In the limit ν → ∞ we obtain:
CHAPTER 2. MULTIVARIATE STATISTICS 43
−1 − ν+N
2
−K −N IK + S−1 (X − M)0 Σ (X − M)
f (X) ≡ γ |Σ| 2
|S|2
ν
− ν+N (2.165)
−K −N 1 −1 0 −1
2
≈ γ |Σ| 2
|S|2
1 + tr(S (X − M) Σ (X − M)) ,
ν
where γ is the normalization constant (2.200, AM 2005), which we report here:
NK Γ( ν+N
2 ) Γ(
ν−1+N
) Γ( ν−K+1+N )
γ(ν) ≡ (νπ)− 2
ν
2
ν−1 · · · 2
ν−K+1
. (2.166)
Γ( 2 ) Γ( 2 ) Γ( 2 )
x n
ex = lim 1+ , (2.167)
n→∞ n
we can then write:
St −K −N
fν→∞,µ,Σ,S (X) ≈ γ |Σ| 2 |S| 2
ν − 21
1 −1 0 −1 (2.168)
× 1 + tr(S (X − M) Σ (X − M))
ν
−K −N 1 −1
(X−M)0 Σ−1 (X−M))
≈ γ |Σ| 2
|S| 2
e− 2 tr(S .
Turning now to the normalization constant (2.166), the following approximation holds in the limit n →
∞, see e.g. www.mathworld.com:
√
1
Γ n+ ≈ nΓ(n) . (2.169)
2
Applying this result recursively we obtain in the limit n → ∞ the following approximation:
n+N
n N2 n
Γ ≈ Γ . (2.170)
2 2 2
Applying this to the normalization constant (2.166) we obtain in the limit ν → ∞ the following approxi-
mation:
ν N2 N2
− N2K ν−K +1
γ(ν → ∞) ≈ (νπ) ···
2 2
NK
ν N2K (2.171)
≈ (νπ)− 2
2
NK
= (2π)− 2 .
Thus in the limit ν → ∞ the pdf of the matrix-variate Student t distribution St(ν, M, Σ, S) reads:
h i
NK −K −N 1 −1
(X−M)0 Σ−1 (X−M))
St
fν→∞,µ,Σ,S (X) → (2π)− 2 |Σ| 2
|S| 2
e− 2 tr(S , (2.172)
Solution of E 70
The logarithm of the Cauchy pdf (2.209, AM 2005) reads:
N +1
Ca
ln fµ,Σ (x) = γ − ln(1 + (x − µ)0 Σ−1 (x − µ)) , (2.174)
2
where γ is a constant which does not depend on x. The first order derivative of the log pdf function reads:
Ca
∂ ln fµ,Σ (x) Σ−1 (x − µ)
= −(N + 1) . (2.175)
∂x 1 + (x − µ)0 Σ−1 (x − µ)
Setting this expression to zero we obtain the mode.
1
MDis {X} = Σ. (2.176)
N +1
Solution of E 71
The logarithm of the Cauchy pdf (2.209, AM 2005) reads:
N +1
Ca
ln fµ,Σ (x) = γ − ln(1 + (x − µ)0 Σ−1 (x − µ)) , (2.177)
2
where γ is a constant which does not depend on x. The Hessian of the log-Cauchy pdf reads:
∂ 2 ln fµ,Σ
Ca
(x) ∂ (x − µ)0 Σ−1
= − (N + 1)
∂x∂x0 ∂x 1 + (x − µ)0 Σ−1 (x − µ)
1 ∂
(x − µ)0 Σ−1
= − (N + 1) 0 −1
1 + (x − µ) Σ (x − µ) ∂x
∂ 1
− (N + 1) (x − µ)0 Σ−1 (2.178)
∂x 1 + (x − µ)0 Σ−1 (x − µ)
Σ−1
= − (N + 1)
1 + (x − µ)0 Σ−1 (x − µ)
2Σ−1 (x − µ)(x − µ)0 Σ−1
− (N + 1) − .
(1 + (x − µ)0 Σ−1 (x − µ))2
CHAPTER 2. MULTIVARIATE STATISTICS 45
∂ 2 fµ,Σ
Ca
(x)
= −(N + 1)Σ−1 . (2.179)
∂x∂x0
x=Mod{X}
−1
∂ 2 fµ,Σ
Ca
(x) 1
MDis {X} ≡ − = Σ. (2.180)
∂x∂x0 N +1
x=Mod{X}
Y ≡ eX , (2.181)
where the exponential is defined component-wise. Show that the pdf of the log distribution reads:
fX (ln(Y))
fY (Y) = QN , (2.182)
n=1 yn
and find the expression for the special case of a lognormal pdf, i.e. when X ∼ N(µ, Σ).
Solution of E 72
This is a transformation g of the form (2.7), which reads component-wise as follows:
N
Y
g
|J | = exn . (2.186)
n=1
and the expression (2.182) follows. In particular, for a lognormal distribution, from (2.156, AM 2005)
and (2.182) we have:
N − 12
LogN (2π)− 2 |Σ| 1 0 −1
fµ,Σ (y) = QN e− 2 (ln(y)−µ) Σ (ln(y)−µ)
. (2.188)
n=1 yn
RMY
n1 ···nk ≡ E {Yn1 · · · Ynk }
= E eXn1 · · · eXnk
(2.189)
= E eXn1 +···+Xnk
where the vector ω is defined in terms of the canonical basis (A.15, AM 2005) as follows:
1 (n1 )
ω n1 ···nk ≡ δ + · · · + δ (nk ) . (2.190)
i
Comparing with (2.13, AM 2005), we realize that the last term in (2.189) is the characteristic function of
X. Therefore we obtain:
RMY
n1 ···nk = φX (ω n1 ···nk ) . (2.191)
From (2.157, AM 2005) and (2.191) we obtain the expression of the raw moments of the lognormal
distribution:
0 (n1 )
+···+δ (nk ) )
RMY
n1 ···nk = e
µ (δ
(2.192)
1 (n1 )
+···+δ (nk ) )0 Σ(δ (n1 ) +···+δ (nk ) )
× e 2 (δ .
In particular the expected value, which is the first raw moment, reads:
Σnn
E {Yn } = RMY
n =e
µn + 2 . (2.193)
Σmm
+ Σnn
E {Ym Yn } = RMY
mn = e
µm +µn + 2 2 +Σmn . (2.194)
CHAPTER 2. MULTIVARIATE STATISTICS 47
Solution of E 74
If W is Wishart distributed then from (2.222, AM 2005) for any conformable matrix A we have:
since:
In particular, we can reconcile the multivariate Wishart with the one-dimensional gamma distribution by
choosing A ≡ a0 , a row vector. In that case each term in the sum is normally distributed as follows:
σ12
ρσ1 σ2
Σ≡ . (2.201)
ρσ1 σ2 σ22
• Compute and show on the command window the sample means, sample covariances, sample stan-
dard deviations and sample correlations;
• Compute and show on the command window the respective analytical results (2.227, AM 2005)
and (2.228, AM 2005), making sure that they coincide.
Solution of E 75
See the MATLAB
R
script S_Wishart.
1 ν
− ν+N +1 1 −1
IW
fν,Ψ (Z) = |Ψ| 2 |Z| 2
e− 2 tr(ΨZ ) . (2.203)
κ
Solution of E 76
If Z has an inverse-Wishart distribution:
Z ∼ IW(ν, Ψ) , (2.204)
then by definition Z ≡ g(W) ≡ W−1 where W ∼ W(ν, Ψ−1 ). Then, from (2.13):
W −1
IW
fν,Ψ−1 (g (Z))
fν,Ψ (Z) = q . (2.205)
2
|Jg (g−1 (Z))|
Using the following result in Magnus and Neudecker (1999) that applies to any invertible N × N matrix
Q:
∂Q−1
N (N +1)
−(N +1)
∂Q = (−1)
2 |Q| , (2.206)
we derive:
CHAPTER 2. MULTIVARIATE STATISTICS 49
IW −(N +1)W −1
fν,Ψ (Z) = |Z| fν,Ψ−1 (Z )
−(N +1) 1 − ν ν−N −1
Ψ−1 2 Z−1 2 e− 12 tr(ΨZ−1 )
= |Z| (2.207)
κ
1 ν
− ν+N +1 1 −1
= |Ψ| |Z|
2 2
e− 2 tr(ΨZ ) .
κ
Z " T
#
iω x 1
0 X
(xt )
= e δ (x) dx (2.208)
RN T t=1
T Z
1X 0
= eiω x δ (xt ) (x)dx .
T t=1 RN
T
1 X iω0 xt
φiT (ω) = e . (2.209)
T t=1
E 78 – Order statistics
Replicate the exercise of the MATLAB
R
script S_OrderStatisticsPdfStudentT assuming that the i.i.d.
variables are lognormal instead of Student t distributed.
Solution of E 78
See the MATLAB
R
script S_OrderStatisticsPdfLognormal.
1
g Ma2 (x, µ, Σ) ,
fµ,Σ (x) = p (2.210)
|Σ|
where g is any positive function that satisfies:
Z ∞
N −2
y 2 g(y)dy < ∞ . (2.211)
0
Ma(x, µ, Σ) = u , (2.212)
where Ma is the Mahalanobis distance of the point x from µ through the metric Σ, as defined in (2.61,
AM 2005) and u ∈ (0, ∞), see (A.73, AM 2005). If the pdf fX is constant on those ellipsoids then it
must be of the form:
where h is a positive function, such that the normalization condition is satisfied, i.e.:
Z
h Ma2 (x, µ, Σ) dx = 1 .
(2.214)
RN
Suppose we have determined such a function h. From (2.32), changing µ into a generic parameter µ e
does not affect the normalization condition, and therefore the ensuing pdf is still the pdf of an elliptical
distribution centered in µ
e . On the other hand, if we change Σ into a generic dispersion parameter Σ, e in
order to preserve the normalization condition we have to rescale (2.213) accordingly:
v
u
u Σ
e
t h 2 i
fµ,
e Σ (x) = h Ma (x, µ
e , Σ)
e . (2.215)
|Σ|
e
1
g Ma2 (x, µ, Σ) ,
fµ,Σ (x) = p (2.216)
|Σ|
in such a way that the same functional form g is viable for any location and dispersion parameters (µ, Σ).
E {X} = µ
E{R2 } (2.217)
Cov {X} = Σ,
N
where R is defined in (2.260, AM 2005).
Solution of E 80
First we follow Fang et al. (1990) to compute the moments of a random variable U uniformly distributed
on the surface of the unit ball. Consider a standard multivariate normal variable:
X ∼ N(0, IN ) . (2.218)
CHAPTER 2. MULTIVARIATE STATISTICS 51
We can write X = kXk U and from (2.259, AM 2005) we have that kXk and U ≡ X/ kXk are
independent and U is uniformly distributed on the surface of the unit ball. Then:
(N ) (N )
Y Y
E Xi2si =E (kXk Ui ) 2si
i=1 i=1
( N
! N
!)
Y 2si
Y
=E kXk Ui2si (2.219)
i=1 i=1
(N )
n o Y
2s 2si
= E kXk E Ui ,
i=1
PN
where s ≡ i=1 si . Thus:
(N ) QN
E Xi2si
Y
E Ui2si = i=1
n o . (2.220)
2s
i=1 E kXk
(2si )!
E Xi2si = si ,
(2.221)
2 si !
see e.g. www.mathworld.com and references therein. For a standard multivariate normal variable X we
have:
n o
2s
= E (X12 + · · · + XN
2 s
) ≡ E {Y s } ,
E kXk (2.222)
where Y ∼ χ2N . Therefore from (1.109, AM 2005) we see that (2.222) is the s-th raw moment of a chi-
square distribution with N degrees of freedom and thus, see e.g. www.mathworld.com and references
therein, we have:
n o Γ( N + s)2s
2s 2
E kXk = . (2.223)
Γ( N2 )
√
N N + 2s (N + 2s − 2)(N + 2(s − 1)) · · · n0 π
Γ +s =Γ = N +2s−1 , (2.224)
2 2 2 2
where n0 ≡ 1 is n is odd and n0 ≡ 2 if n is even. Defining:
(N ) N
Y 1 Y (2si )!
E Ui2si = , (2.227)
i=1
( N2 )[s] i=1 4si si !
E {U} = 0 , (2.228)
and
IN
Cov {U} = , (2.229)
N
where IN is the N ×N identity matrix. Consider now a generic elliptical random variable X with location
parameter µ and scatter parameter Σ. To compute its central moments we write:
X ≡ µ + RAU , (2.230)
where:
AA0 ≡ Σ
A−1 (X − µ)
U≡ (2.231)
kA−1 (X − µ)k
−1
R ≡
A (X − µ)
.
E 81 – Radial-uniform representation
Write a MATLAB
R
script in which you:
• Generate a non-trivial 30 × 30 symmetric and positive matrix Σ and a 30-dim vector µ;
• Generate J ≡ 10,000 simulations from a 30-dimensional elliptical random variable:
X ≡ µ + RAU . (2.234)
In this expression µ, R, A, U are the terms of the radial-uniform decomposition, see (2.259, AM
2005). In particular, set:
R ∼ LogN(ν, τ 2 ) , (2.235)
d
Ψa = µa + σa Z , Z ∼ El(0, 1, g1 ) , (2.236)
h i0 h i h i0 h i
±v(m) Σ−1 ±v(n) = v(m) Σ−1 v(n)
= V0 Σ−1 V mn
h 1 1 1 1
i (2.239)
= (Λ 2 E0 )EΛ− 2 Λ− 2 E0 (EΛ 2 )
mn
= [I]mn .
Thus, in particular:
h i0 h i
±v(n) Σ−1 ±v(n) = 1 . (2.240)
Due to (2.240), mΣ satisfies (2.284, AM 2005) and thus it is defined on the surface of the ellipsoid. Also,
it trivially satisfies (2.283, AM 2005) and thus it is symmetrical.
σ12
X1 µ1 ρσ1 σ2
∼N ,S ≡ . (2.241)
X2 µ2 ρσ1 σ2 σ22
Fix µ1 ≡ 0, µ2 ≡ 0, σ1 ≡ 1, σ2 ≡ 1 and write a MATLAB
R
script in which you:
• Plot the correlation between X1 and X2 as a function of ρ ∈ (−1, 1);
• Use eig to plot as a function of ρ ∈ (−1, 1) the condition ratio of S, i.e. the ratio of the smallest
eigenvalue of S over its largest eigenvalue:
CR(S) ≡ λ2 /λ1 . (2.242)
Solution of E 84
See the MATLAB
R
script S_AnalyzeNormalCorrelation.
σ12
X1 µ1 ρσ1 σ2
∼ LogN , . (2.243)
X2 µ2 ρσ1 σ2 σ22
Fix µ1 ≡ 0, µ2 ≡ 0, σ1 ≡ 1, σ2 ≡ 1 and write a MATLAB
R
script in which you:
CHAPTER 2. MULTIVARIATE STATISTICS 55
Solution of E 85
See the MATLAB
R
script S_AnalyzeLognormalCorrelation.
X ∼ St(ν, 0T , IT ) , (2.245)
T
X
Y ≡ Xt . (2.246)
t=1
et ∼ St(ν, 0, 1),
X t = 1, . . . , T , (2.247)
T
X
Ye ≡ X
et , (2.248)
t=1
and comment on the difference between the distribution of Y versus the distribution of Ye .
Solution of E 86
From (2.194, AM 2005) the marginals read:
Therefore:
Y ∼ St(ν, 0, T ) . (2.252)
As far as X
e is concerned, from (2.136, AM 2005) the cross-correlations read:
n o
Corr Xet , X
es = 0, t 6= s . (2.253)
From the central limit theorem and (1.90, AM 2005) (fix the typo with the online "Errata" at www.
symmys.com) we obtain:
ν
Y → N 0,
e T . (2.254)
ν−2
Both Y and Ye are the sum of uncorrelated identically distributed t variables. If the variables are indepen-
dent, the CLT kicks in and the sum becomes normal.
Note. This only holds for ν > 2, otherwise the variance is not defined and the CLT does not hold. Indeed,
if ν = 1 we obtain the Cauchy distribution, which is stable: the sum of i.i.d. Cauchy variables is Cauchy.
If the variables are jointly Student t, they cannot be independent, even if they are uncorrelated, recall the
plot of the pdf of the Student t copula.
W11 − E {W11 }
X1 ≡ (2.255)
Sd {W11 }
W12 − E {W12 }
X2 ≡ . (2.256)
Sd {W12 }
Write a MATLAB
R
script in which you:
• Simulate and scatter-plot a large number of joint samples of X ≡ (X1 , X2 )0 ;
• Superimpose to the above scatter-plot the plot of the location-dispersion ellipsoid of these variables.
In order to do so, feed the MATLAB
R
function TwoDimEllipsoid with the real inputs E {X} and
Cov {X} as they follow from the analytical results (2.227, AM 2005) and (2.228, AM 2005), do
not use the sample estimates from the simulations. Make sure that the ellipsoid suitably fits the
simulation cloud;
• Fix ν ≡ 15 and σ1 ≡ σ2 ≡ 1 in (2.201) and plot the correlation Corr {X1 , X2 } as a function of
ρ ∈ (−1, +1). (Compare with the result of the previous point, which is a geometrical representation
of the correlation.)
CHAPTER 2. MULTIVARIATE STATISTICS 57
Solution of E 87
function which takes as inputs a generic value u in the N -dimensional unit hypercube as well as the
parameters ν, µ and Σ and outputs the pdf of the copula of X in u.
Hint. Use (2.30, AM 2005) and (2.188, AM 2005) and the built-in functions tpdf and tinv. Notice that
you will have to re-scale the built-in pdf and the built-in quantile of the standard t distribution.
Then, write a MATLAB
R
script where you call the above function to evaluate the copula pdf at a select
grid of bivariate values:
In a separate figure, plot the ensuing surface. Comment on the (dis)similarities with the normal copula
when ν ≡ 200 and comment on the (dis)similarities with the normal copula when ν ≡ 1 and Σ12 ≡ 0.
What is the correlation in this case?
Solution of E 88
From (2.191, AM 2005), when the off-diagonal entries are null, the marginals are uncorrelated, if the
correlation is defined, which is true only for ν > 2 (see fix in the Errata). Therefore, for ν > 2 null
correlation does not imply independence, because the pdf is clearly not flat as ν → 2. For ν ≤ 2 the
correlation simply does not exist. However the co-scatter parameter Σ12 can be set to zero, but this does
not imply independence because, again, the pdf is far from flat as ν ≤ 2. For the implementation, see the
MATLAB
R
function StudentTCopulaPdf and the script S_DisplayStudentTCopulaPdf.
E 89 – Full co-dependence
Write a MATLAB
R
script in which you generate J ≡ 10,000 joint simulations for an 10-variate random
variable X in such a way that each marginal is gamma-distributed, Xn ∼ Ga(n, 1), n = 1, . . . , 10, and
such that each two entries are fully codependent, i.e. the cdf of their copula is (2.106, AM 2005).
Hint. Use (2.34, AM 2005).
Solution of E 89
See the MATLAB
R
script S_FullCodependence.
Chapter 3
r (K ,E)
(Kt ,E) 2π Ct t
σt ≈ . (3.1)
E − t Ut
Hint. Using the following Maple command: taylor(RootOf(erf(y) = x, y), x = 0, 3); we can perform a
third-order Taylor expansion of the inverse error function:
π 1/2 π 3/2 3
erf −1 (x) = x+ x + ··· . (3.2)
2 24
(Kt ,E)
Ct
Moreover, since the term Ut is of the order of a few percentage points, you can stop at the first order.
Solution of E 90
Substituting the definition (3.48, AM 2005) of the ATMF strike in the Black-Scholes pricing formula
(3.41, AM 2005) we obtain:
!
r (Kt ,E)
(K ,E) 8 Ct
σt t = erf −1 , (3.4)
E−t Ut
58
CHAPTER 3. MODELING THE MARKET 59
and using the fact that the term in the argument of the inverse error function in (3.4) is of the order of a
few percentage points, we can use the Taylor expansion at the first order, and the approximation follows.
Note. Repeating the argument in (3.7) we obtain that the sum of any number of independent and identi-
cally distributed random variables reads:
Solution of E 91
Consider two variables XA and XB whose joint pdf is fXA ,XB . Consider now Y, the sum of these
variables. The pdf of the sum is:
Z
fY (y) = fXA +XB (y) = fXA ,XB (y − x, x)dx , (3.7)
R
If the variables X and Y are independent, the joint pdf is the product of the marginal pdf:
Z
fXA +XB (y) = fXA (y − x)fXB (x)dx . (3.10)
R
We see that this is the convolution (B.43, AM 2005) of the marginal pdf:
E 92 – Investment-horizon characteristic function (www.3.2)
Show that the investment-horizon characteristic function is simply a power of the estimated characteristic
function:
Note. This result is not surprising. Indeed, we recall from (2.14, AM 2005) that the characteristic function
of a distribution is the Fourier transform (B.45, AM 2005) of the pdf of that distribution. Therefore:
and using the the expression of the pdf of the sum (3.6) and the relation between convolution and the
Fourier transform (B.45, AM 2005) we obtain:
Note. Formula (3.12) also provides a faster way to compute the pdf. Indeed we only need to apply once
the inverse Fourier transform F −1 as defined in (B.40, AM 2005), if the distribution of X is known
through its characteristic function:
In case the distribution of X is known through its pdf we only need to apply once the inverse Fourier
transform F −1 and once the Fourier transform F:
Solution of E 92
Using the factorization (2.48, AM 2005) of the characteristic function of independent variables we obtain:
n 0 o
φX1 +···+XT (ω) ≡ E eiω (X1 +···+XT )
n 0 0
o
= E eiω X1 · · · eiω XT (3.17)
n 0 o n 0 o
= E eiω X1 · · · E eiω XT .
Therefore:
τ
E {XT,τ } = E {XT,eτ } . (3.19)
τe
Note. The statement in Meucci (2005, p.125): "More in general, a multiplicative relation such as (3.19)
or (3.25) holds for all the raw moments and all the central moments, when they are defined" is incorrect:
it only holds for the expected value and the covariance.
Solution of E 93
We recall from (3.64, AM 2005) the relation between the investment-horizon characteristic function and
the estimation interval characteristic function:
τ
φXT ,τ = (φXT ,τe ) τe . (3.20)
τ
∂φXT ,τ (ω) ∂ φXT ,τe (ω) τe
=
∂ω ∂ω (3.21)
τ τ ∂φXT ,τe (ω)
= (φXT ,τe (ω)) τe −1 .
τe ∂ω
From (2.98), evaluating this derivatives at the origin and using the fact that:
n 0 o
φX (0) ≡ E eiX 0 = 1 , (3.22)
τ
E {XT,τ } = E {XT,eτ } . (3.24)
τe
τ
Cov {XT,τ } = (Cov {XT,eτ }) . (3.25)
τe
Hint. Use the characteristic function.
Note. The statement in Meucci (2005, p.125): "More in general, a multiplicative relation such as (3.19)
or (3.25) holds for all the raw moments and all the central moments, when they are defined" is incorrect:
it only holds for the expected value and the covariance.
Solution of E 94
We recall from (3.64, AM 2005) the relation between the investment-horizon characteristic function and
the estimation interval characteristic function:
τ
φXT ,τ = (φXT ,τe ) τe . (3.26)
n 0 o
φX (0) ≡ E eiX 0 = 1 , (3.28)
∂ 2 φXT ,τ (0)
E XT,τ X0T,τ = −
∂ω∂ω 0 (3.29)
∂φ
τ τ XT ,τe (0) ∂φXT ,τe (0) τ ∂φXT ,τe (0)
=− −1 0
− .
τe τe ∂ω ∂ω τe ∂ω∂ω 0
Therefore for the covariance we obtain:
0
Cov {XT,τ } = E XT,τ X0T,τ − E {XT,τ } E {XT,τ }
∂φ
τ τ XT ,τe (0) ∂φXT ,τe (0)
= − −1
τe τe ∂ω ∂ω 0
τ ∂φXT ,τe (0) τ 2 ∂φXT ,τe (0) ∂φXT ,τe (0)
− 0
+ 0 (3.30)
τe ∂ω∂ω τe ∂ω ∂ω
τ ∂φXT ,τe (0) ∂φXT ,τe (0) ∂φXT ,τe (0)
= −
τe ∂ω ∂ω 0 ∂ω∂ω 0
∂φXT ,τe (0) ∂φXT ,τe (0) ∂φXT ,τe (0)
τ
= − −i −i + − .
τe ∂ω ∂ω 0 ∂ω∂ω 0
τ 0
− E {XT,eτ } E {XT,eτ } + E XT,eτ X0T,eτ
Cov {XT,τ } =
τe (3.31)
τ
= (Cov {XT,eτ }) .
τe
Solution of E 96
From (3.64, AM 2005) and (2.210, AM 2005) we obtain:
τ
φτ (ω) = (φτe (ω)) τe
0
√ τ
ω 0 Σω
= (eiω µ− ) τe (3.33)
√
iω0µ ττe − ω 0 Σ( ττe )2 ω
=e .
Therefore:
τ2
τ
Xτ ∼ Ca µ, 2 Σ . (3.34)
τe τe
In particular, from (2.212, AM 2005) we obtain:
τ2
MDisτ {X} = MDisτe {X} . (3.35)
τe2
Therefore, the propagation law for risk is linear in the horizon, instead of being proportional to the square
root of the horizon.
E 97 – Projection of skewness, kurtosis, and all standardized summary statistics *
Consider an invariant, which we denote by Xt . Assume that we have properly estimated the distribution
of such one-period invariant. Then we can compute the expectation (1.25, AM 2005):
µX ≡ E{X} , (3.36)
p
σX ≡ E{(X − µX )2 } , (3.37)
Consider the projected invariant, defined as the sum of k intermediate single-period invariants:
Y = X1 + · · · + Xk . (3.41)
Such rule applies e.g. to the compounded return (3.11, AM 2005), but not to the linear return (3.10, AM
2005). Project the single-period statistics (3.36)-(3.40) to the arbitrary horizon k, i.e. compute the first n
standardized summary statistics for the projected invariant Y :
(5) (n)
µY , σY , skY , kuY , γY , . . . , γY , (3.42)
(5) (n)
µX , σX , skX , kuX , γX , . . . , γX . (3.43)
CMX
1 ≡ µX , CMX n
n ≡ E{(X − E{X}) } , n = 2, 3, . . . , (3.44)
the non-central, or raw, moments, see (1.47, AM 2005):
RMX n
n ≡ E{X }, n = 1, 2, . . . , (3.45)
and the cumulants:
dn ln(E{ezX })
(n)
κX ≡ , n = 1, 2, . . . . (3.46)
dz n
z=0
n−1
(n) (k)
X
n−1
κX = RMX κX RMX
n − k−1 n−k , (3.47)
k=1
Solution of E 97
The steps involved are the following:
• Step 0. We collect the first n statistics (3.36)-(3.40) of the invariant Xt :
(5) (n)
µX , σX , skX , kuX , γX , . . . , γX . (3.48)
(n)
CMX n
n = γX σX , n ≥ 3. (3.49)
• Step 2. We compute from the central moments the raw moments RMX X
1 , . . . , RMn of Xt .
(1) (n)
• Step 3. We compute from the raw moments the cumulants κX , . . . , κX of Xt . To do so, we
(1)
start from κX = RMX 1 : this follows from the Taylor approximations E{e
zX
} ≈ E{1 + zX} =
X
1 + z RM1 for any small z and ln(1 + x) ≈ x for any small x, and from the definition of the first
cumulant in (3.46). Then we apply recursively the identity (3.47).
(1) (n) (1) (n)
• Step 4. We compute from the cumulants κX , . . . , κX of Xt the cumulants κY , . . . , κY of the
projection Y ≡ X1 + · · · + Xτ . To do so, we notice that for any independent variables X1 , . . . , Xτ
we have E{ez(X1 +···+Xτ ) } = E{ezX1 } · · · E{ezXτ }. Substituting this in the definition of the
cumulants (3.46) we obtain:
(n) (n)
κY = τ κX . (3.51)
(1) (n)
• Step 5. We compute from the cumulants κY , . . . , κY the raw moments RMY1 , . . . , RMYn of Y .
To do so, we use recursively the identity:
n−1
(n) (k)
X
n−1
RMYn = κY + κY RMYn−k ,
k−1 (3.52)
k=1
(5) (n)
µY , σY , skY , kuY , γY , . . . , γY , (3.53)
of the projected multi-period invariant Y , by applying to Y the definitions (3.36)-(3.40). See the
MATLAB
R
script S_ProjectSummaryStatistics for the implementation
−1
Br ≡ E {XF0 } E {FF0 } . (3.54)
Solution of E 98
From the definition (3.116, AM 2005) of the generalized r-square and (3.120, AM 2005), the regression
factor loadings minimizes the following quantity:
∂M
0sl =
∂Bsl
∂ X
= −2 E {Xs Fl } + Bnj Bnk E {Fk Fj } (3.56)
∂Bsl
n,k,j
X
= −2 E {Xs Fl } + 2 Bsk E {Fk Fl } .
k
CHAPTER 3. MODELING THE MARKET 67
−1
Br = E {XF0 } E {FF0 } . (3.58)
U ≡ X − Br F
−1 (3.59)
= X − E {XF0 } E {FF0 } F,
where Br is given by (3.121, AM 2005). In general, the residuals do not have zero expected value:
n o
−1
E {U} = E X − E {XF0 } E {FF0 } F
(3.60)
−1
= E {X} − E {XF0 } E {FF0 } E {F} .
E 101 – Explicit factors (with a constant among the factors): recovered invariants
(www.3.4) *
Show that in the case of a regression with a constant among the factors, the regression coefficients (3.121,
AM 2005) yield the recovered invariants (3.127, AM 2005):
Solution of E 101
Assume one of the factors is a constant as in (3.126, AM 2005). Then the linear model (3.119, AM 2005)
becomes:
X ≡ a + GF + U . (3.65)
In order to maximize the generalized r-square (3.116, AM 2005) we have to minimize the following
expression:
0
M ≡ E [X − (a + GF)] [X − (a + GF)]
= E {X0 X} + a0 a + E {F0 G0 GF} (3.66)
0 0 0
+ 2a G E {F} − 2a E {X} − 2 E {X GF} .
X X X
M = ··· + (aj )2 + 2 aj Gjk E {Fk } − 2 aj E {Xj } . (3.67)
j j,k j
X
aj = E {Xj } − Gjk E {Fk } , (3.68)
k
CHAPTER 3. MODELING THE MARKET 69
X X X
M = ··· + E {Fj Gkj Gkl Fl } + 2 aj Gjk E {Fk } − 2 E {Xj Gjk Fk }
jkl jk jk
X X X (3.70)
= E {Fk Gjk Gjl Fl } + 2 aj Gjk E {Fk } − 2 E {Xj Gjk Fk } .
jkl jk jk
Setting to zero the first order derivative with respect to Gjk and using (3.68) we obtain:
X
0= E {Fk Gjl Fl } + aj E {Fk } − E {Xj Fk }
l
!
X X
= E {Fk Gjl Fl } + E {Xj } − Gjl E {Fl } E {Fk } − E {Xj Fk }
l l
!
X X
= E {Fk Gjl Fl } − E {Gjl Fl } E {Fk } (3.71)
l l
− (E {Xj Fk } − E {Xj } E {Fk })
X
= Cov {Gjl Fl , Fk } − Cov {Xj , Fk }
l
n o
= Cov [GF]j , Fk − Cov {Xj , Fk } .
−1
Gr = Cov {X, F} Cov {F} . (3.73)
Substituting (3.68) and (3.72) in (3.65) we find the expression of the recovered invariants:
e r = X − Gr F ,
Ur ≡ X − X (3.76)
where:
Therefore the residuals have zero expected value. The covariance of the residuals with the factors reads:
n 0o
Cov {Ur , F} = E X − Gr F F
0
n o n 0o
= E XF − Gr E FF (3.78)
−1
Cov {Ur , F} = Cov {X, F} − Cov {X, F} Cov {F} Cov {F} = 0K×N . (3.79)
E 103 – Explicit factors (with a constant among the factors): covariance of residu-
als (www.3.4) *
Show that the covariance of the residuals (3.129, AM 2005) reads:
−1
Cov {Ur } = Cov {X} − Cov {X, F} Cov {F} Cov {F, X} . (3.80)
Solution of E 103
The covariance of the residual reads:
n 0 o
Cov {Ur } = E X − Gr F X − Gr F
0 0
n o n o n 0o
= E XX − 2 E XF G0r + Gr E FF G0r (3.81)
−1
Cov {Ur } = Cov {X} − Cov {X, F} Cov {F} Cov {F, X} . (3.82)
ZX ≡ D−1
X (X − E {X}) , (3.84)
where:
e X ≡ D−1 (X
Z e r − E {X})
X
−1
= D−1
X Cov {X, F} Cov {F} (F − E {F}) (3.86)
−1 −1
= Cov DX X, F Cov {F} (F − E {F}) .
Consider the spectral decomposition (2.76, AM 2005) of the covariance of the factors:
and satisfies EE0 = IK , the identity matrix; and Λ is the diagonal matrix of the eigenvalues sorted in
decreasing order:
Λ ≡ diag(λ1 , . . . , λK ) . (3.89)
With the spectral decomposition we can always rotate the factors in such a way that they are uncorrelated.
Indeed the rotated factors E0 F satisfy:
1
ZF ≡ Λ− 2 E0 (F − E {F}) , (3.91)
On the other hand, the generalized r-square defined in (3.116, AM 2005) reads in this context:
n o n o
R2 X, X e r ≡ R2 ZX , Z eX
n o
E (ZX − Z e X )0 (ZX − Z
eX )
≡1− (3.94)
tr {Cov {ZX }}
a
=1− .
N
The term in the numerator can be written as follows:
n o
a ≡ E (ZX − Z e X )0 (ZX − Z
eX )
h i0
−1 −1
= E DX (X − X) DX (X − X)
e e
n o (3.95)
= E (X − X)e 0 D−1 D−1 (X − X)e
X X
n o
−1 −1 e 0
= tr DX DX E (X − X)(X e − X) ,
−1
a ≡ tr(D−1 −1
X DX [Cov {X} − Cov {X, F} Cov {F} Cov {F, X}])
−1
= tr(D−1 −1
X DX Cov {X}) − tr(D−1 −1
X DX Cov {X, F} Cov {F} Cov {F, X})
−1 −1 −1
= tr(Corr {X}) − tr(DX DX Cov {X, F} Cov {F} Cov {F, X})
n 1
o n 1
o (3.96)
−1 0
= N − tr(Cov D−1
X X, EΛ ZF EΛ
2 E Cov EΛ 2 ZF , D−1
X X )
= N − tr(Cov D−1 −1
X X, ZF Cov ZF , DX X )
= N − tr(Corr {X, E0 F} Corr {E0 F, X}) .
Therefore the r-square (3.94) reads:
0 0
e X = 1 − N − tr(Corr {X, E F} Corr {E F, X})
n o
R2 ZX , Z
N (3.97)
1
= tr(Corr {X, E F} Corr {E0 F, X}) .
0
N
CHAPTER 3. MODELING THE MARKET 73
Σ ≡ EΛE0 , (3.98)
where Λ is diagonal and E is invertible. Prove that Σ is symmetric, see definition (A.51, AM 2005).
Solution of E 105
Σ0 ≡ (EΛE0 )0 = EΛ0 E0 = EΛE0 = Σ . (3.99)
Σ ≡ EΛE0 , (3.100)
where Λ is diagonal and E is invertible. Prove that Σ is positive if and only if all the diagonal elements
of Λ are positive, see definition (A.52, AM 2005).
Solution of E 106
For any v there exists one and only one w ≡ E0 v and w ≡ 0 ⇐⇒ v ≡ 0. Assume that all the diagonal
elements of Λ are positive and v 6= 0. Then:
N
X
v0 Σv ≡ v0 EΛE0 v = w0 Λw = wn2 λn > 0 . (3.101)
n=1
Similarly, from the above identities, if 0 < v0 Σv for any v 6= 0, then each λn has to be positive.
e p ≡ a + GX ,
X (3.102)
where:
Consider a generic point x in RN . Since the eigenvectors of the covariance matrix are a basis of RN we
can express x as follows:
N
X
x ≡ E {X} + αn e(n) , (3.105)
n=1
for suitable coefficients {α1 , . . . , αN }, where e(n) denotes the n-th eigenvector.
To prove that (3.102) represents the projection on the hyperplane of maximal variation generated by the
first K principal axes we need to prove the following relation:
K
X
a + Gx = E {X} + αn e(n) . (3.106)
n=1
By substituting (3.103), (3.104) and (3.105) in the left hand side of the above relation we obtain:
N
!
X
a + Gx ≡ (IN − EK E0K ) E {X} + EK E0K E {X} + αn e(n)
n=1
(3.107)
N
X
= E {X} + αn EK E0K e(n) .
n=1
Therefore in order prove our statement it suffices to prove that if n ≤ K then the following holds:
Both statements follow from the definition (3.157, AM 2005) of EK , which implies:
0
e(1) e(n)
..
EK E0K e(n) ≡ e(1 · · · e(K) , (3.110)
.
(K) 0 (n)
e e
EE0 = IN , (3.111)
o PK
e p = Pn=1 λn .
n
R2 X, X N
(3.112)
n=1 λn
CHAPTER 3. MODELING THE MARKET 75
Solution of E 108
The residual of the PCA dimension reduction reads:
(K+1) 0 (n)
e e
RK R0K e(n) ≡ (e (K+1) (N )
···e ) .
.. . (3.116)
(N ) 0 (n)
e e
and if n ≤ K then:
Since the set of eigenvectors is a basis in RN , (3.117) and (3.118) prove (3.115). Therefore the term in
the numerator of the generalized r-square (3.116, AM 2005) of the PCA dimension reduction reads:
n o
e p )0 (X − X
M ≡ E (X − X e p)
E0 RK = (δ (K+1) · · · δ (N ) ) , (3.120)
where δ (n) is the n-th element of the canonical basis (A.15, AM 2005). Therefore:
Cov {R0K X} = R0K Cov {X} RK
= R0K EΛE0 RK (3.121)
= diag(λK+1 , . . . , λN ) .
N
X
M= λn . (3.122)
n=K+1
The term in the denominator of the generalized r-square (3.116, AM 2005) is the sum of all the eigen-
values. This follows from (3.149, AM 2005) and (A.67, AM 2005). Therefore, the generalize r-square
reads:
PN PK
λ
e p = 1 − Pn=K+1 n = P n=1 λn .
n o
R2 X, X N N
(3.123)
n=1 λn . n=1 λn .
The residual (3.113) clearly has zero expected value. Similarly, the factors:
Similarly:
X ≡ Y + U, (3.128)
where U is the residual that the model fails to approximate. To evaluate the goodness of a model, we
introduce the generalized r-square as in Meucci (2010e):
Y ≡ BF , (3.130)
where the factors are extracted by linear combinations from the market:
F ≡ GX . (3.131)
Then each choice of B and G gives rise to a different model Y. Determine analytically the expressions for
the optimal B and G that maximize the r-square (3.129) and verify that they are the principal components
of the matrix Cov {WX}. What is the r-square provided by the optimal optimal B and G? Then compute
the residuals U. Are the residuals correlated with the factors F? Are the residuals idiosyncratic?
Hint. See Meucci (2010e).
Solution of E 109
First, we perform the spectral decomposition of the covariance matrix:
In this expression Λ is the diagonal matrix of the decreasing, positive eigenvalues of the covariance:
and E is the juxtaposition of the respective eigenvectors, which are orthogonal and of length 1 and thus
EE0 = IN :
PK 2
2 k=1 λk
Rw = PN . (3.137)
2
n=1 λn
The residuals are not correlated with the factors F but they are correlated with each other and therefore
they are not idiosyncratic. See all the solutions in Meucci (2010e).
X ∼ N(µ, Σ) . (3.138)
Write a MATLAB
R
script in which you:
• Choose an arbitrary dimension N and generate µ arbitrarily;
• Generate Σ as follows:
Σ ≡ BB0 + ∆2 , (3.139)
b ≡B
Σ bB b2;
b0 + ∆ (3.140)
Solution of E 111
See the MATLAB
R
script S_FactorAnalysisNotOK.
Xt ≡ Bt Ft + Ut . (3.141)
Write a MATLAB
R
script in which you:
• Upload the database DB_BondAttribution with time series over the year 2009 of the above variables;
• Model the joint distribution of the yet-to-be realized factors and residuals by means of the empirical
distribution:
T
1 X (ft ,ut )
fFT +! ,UT +! ≡ δ , (3.142)
T t=1
Solution of E 112
See the MATLAB
R
script S_PureResidualBonds.
E 113 – Time series factors: unconstrained time series correlations and r-square
Consider the approximation Y provided to the market X by a given model:
X ≡ Y + U, (3.143)
where U is the residual that the model fails to approximate. To evaluate the goodness of a model, we
introduce the generalized r-square as in Meucci (2010e):
2 tr(Cov {w(Y − X)})
Rw {Y, X} ≡ 1 − . (3.144)
tr(Cov {WX})
Consider now a linear factor model:
Y ≡ BF , (3.145)
where the factors F are imposed exogenously. Then each choice of B gives rise to a different model
Determine analytically the expressions for the optimal B that maximize the r-square (3.144). Then com-
pute the residuals U. Are the residuals correlated with the factors F? Are the residuals idiosyncratic?
What is the r-square provided by the optimal optimal B?
Hint. See Meucci (2010e).
Solution of E 113
The solution reads:
−1
B∗ ≡ Cov {X, F} Cov {F} , (3.146)
The residuals and the factors are uncorrelated but the residuals are not idiosyncratic because their corre-
lations with each other are not null. The r-square provided by the model with loadings (3.146) is:
−1
2 tr(Cov {WX, F} Cov {F} Cov {F, WX})
Rw = . (3.147)
tr(Cov {WX})
See all the solutions in Meucci (2010e).
X = a + BF + U , (3.148)
where X ≡ (X1 , . . . , XN )0 are the yet to be realized returns of the stocks over next week; a ≡
(a1 , . . . , aN )0 are N constants; F ≡ (F1 , . . . , FK )0 are the factors, i.e. the yet to be realized returns
of the industry indices over next week; B is a N × K matrix of coefficients that transfers the random-
ness of the factors into the randomness of the risk drivers; and U ≡ (U1 , . . . , UN )0 are defined as the N
residuals that make (3.148) an identity. Write a MATLAB
R
script in which you:
• Upload the database of the weekly stock returns {Xt }t=1,...,T in DB_Securities_TS, and the database
of the simultaneous weekly indices returns {ft }t=1,...,T in DB_Sectors_TS;
• Model the joint distribution of X and F by means of the empirical distribution:
T
1 X (Xt ,ft )
fX,F ≡ δ , (3.149)
T t=1
where δ (Y) denotes the Dirac-delta, which concentrates a unit probability mass on the generic point
Y;
CHAPTER 3. MODELING THE MARKET 81
• Compute the optimal loadings B∗ in (3.148) that give the factor model the highest generalized
multivariate distributional r-square as in Meucci (2010e) (you will notice that the weights are arbi-
trary):
B∗ ≡ argmax Rw
2
{BF, X} ; (3.150)
B
• Compute the correlations of the residuals with the factors and verify that it is null;
• Compute the correlations of the residuals with each other and verify that it is not null, i.e. the
residuals are not idiosyncratic.
Hint. The optimal loadings turn out to be the standard multivariate OLS.
Solution of E 114
See the MATLAB
R
script S_TimeSeriesIndustries.
E 115 – Time series factors: generalized time-series industry factors (see E 114)
Consider the same setup than in E 114. Write a MATLAB
R
script in which you:
∗
• Compute the optimal loadings B in (3.148) that give the factor model the highest constrained
generalized multivariate distributional r-square defined in Meucci (2010e):
B∗ ≡ argmax Rw
2
{BF, X} . (3.151)
B∈C
In this expression, assume that the constraints C are the following: all the loadings are bound from
below by B ≡ 0.8 and from above by B ≡ 1.2 and the market-capitalization weighted sum of the
loadings be one:
0.8 ≤ Bn,k ≤ B , n = 1, . . . , N , k = 1, . . . , K
N
X (3.152)
Mn Bn,k ≡ 1 .
n=1
X µX ΣX ΣXF
∼N τ ,τ , (3.153)
F µF Σ0XF ΣF
where:
PT +τ,n
Xn ≡ ln
PT,n
(3.154)
ST +τ,k
Fk ≡ ln .
ST,k
We want to represent the linear returns on the securities:
R = eX − 1 , (3.155)
Z = eF − 1 , (3.156)
R ≡ BZ + U . (3.157)
Compute the expression of B that minimizes the generalized r-square, the expression of the covariance
ΣZ of the explanatory factors and the expression of the covariance ΣU of the residuals.
Solution of E 116
From (3.121, AM 2005) the optimal loadings read:
Y ∼ LogN(µ, Σ) . (3.159)
then:
1
E {Y} = eµ+ 2 diag(Σ) (3.160)
0 µ+ 12 diag(Σ) µ+ 12 diag(Σ) 0 Σ
E {YY } = (e (e ))◦e , (3.161)
R µX ΣX ΣXF
1+ ∼ LogN τ ,τ , (3.162)
Z µF Σ0XF ΣF
we can easily compute all the terms E {R}, E {RR0 }, E {Z}, E {ZZ0 } and E {RZ0 }. Therefore we
obtain the loadings (3.158). The covariance of the explanatory factors then follows from:
b R 6= B
Σ bΣ b0 + Σ
b ZB bU . (3.166)
Solution of E 117
See the MATLAB
R
script S_ResidualAnalysisTheory.
bR ≡ B
Σ bΣ b0 + Σ
b ZB bU . (3.167)
Solution of E 118
In this case the most explanatory interpretation reads:
R ≡ a + BZ + U , (3.168)
B ≡ ΣRZ Σ−1
ZZ (3.169)
and:
E 119 – Time series factors: analysis of residuals IV (see E 116)
Consider the same setup than in E 116. Repeat the experiment assuming that all the factors are random,
but enforcing E {Z} ≡ 0 by suitably setting the drift µF in (3.154) as a function of the diagonal of ΣF
and verify again that:
bR ≡ B
Σ bΣ b0 + Σ
b ZB bU . (3.171)
Solution of E 119
See the MATLAB
R
script S_ResidualAnalysisTheory.
E 120 – Cross-section factors: unconstrained cross-section correlations and r-square
I
Consider the approximation Y provided to the market X by a given model:
X ≡ Y + U, (3.172)
where U is the residual that the model fails to approximate. To evaluate the goodness of a model, we
introduce the generalized r-square as in Meucci (2010e):
Y ≡ BF , (3.174)
where the loadings B are exogenously chosen, but the factors F are left unspecified. Then each choice of
F gives rise to a different model. Assume that the factors are a linear function of the market:
F ≡ GX . (3.175)
Determine analytically the expressions for the optimal G that maximize the r-square (3.173).
Solution of E 120
The solution reads:
2 tr(Cov {WBF})
Rw = , (3.177)
tr(Cov {WX})
see the solution in Meucci (2010e).
CHAPTER 3. MODELING THE MARKET 85
Y ≡ PX , (3.179)
where:
is a projection operator. Indeed, it is easy to check that P2 = P. The linear assumption (3.175) gives rise
to the residuals:
U ≡ P⊥ X , (3.181)
where:
is the projection in the space orthogonal to the span of the model-recovered market. Therefore, the
recovered market and the residuals live in orthogonal spaces. However, the residuals and the factors are
not uncorrelated and the residuals are not idiosyncratic, see also the discussion in Meucci (2010e).
X = a + BF + U , (3.183)
where X ≡ (X1 , . . . , XN )0 are the yet to be realized returns of the stocks over next week; a ≡
(a1 , . . . , aN )0 are N constants, F ≡ (F1 , . . . , FK )0 are the factors, i.e. the yet to be realized random
variables, B is a N × K matrix of coefficients that transfers the randomness of the factors into the ran-
domness of the risk drivers and that is imposed exogenously, and U ≡ (U1 , . . . , UN )0 are defined as the
N residuals that make (3.148) an identity. Write a MATLAB
R
script in which you:
• Upload the database DB_Securities_TS of the matrix B of dummy exposures of each stock to its
industry;
• Upload the database DB_Securities_IndustryClassification of weekly stock returns {Xt }t=1,...,T ;
• Model the distribution of X by means of the empirical distribution:
T
1 X (Xt )
fX ≡ δ , (3.184)
T t=1
where δ (Y) denotes the Dirac-delta, which concentrates a unit probability mass on the generic point
Y;
• Define the cross-sectional factors as linear transformation of the market F ≡ GX;
• Compute the optimal coefficients G∗ that give the factor model the highest generalized multivariate
distributional r-square defined in Meucci (2010e):
G∗ ≡ argmax Rw
2
{BGX, X} , (3.185)
G
In this expression assume that the r-square weights matrix w to be diagonal and equal to the inverse
of the standard deviation of each stock return;
• Compute the correlations of the residuals among each other and with the factors and verify that
neither is null. In other words, the model is not of systematic-plus-idiosyncratic type.
Hint. The optimal loadings turn out to be the standard multivariate weighted-OLS.
Solution of E 122
See the MATLAB
R
script S_CrossSectionIndustries.
G∗ ≡ argmax Rw
2
{BGX, X} . (3.186)
B∈C
In this expression, assume that the constraints C are that the factors F ≡ GX be uncorrelated with
the overall market:
where you can assume the market weights m to be equal weights for this exercise;
• Compute the correlations of the residuals among each other and with the factors and verify that
neither is null. In other words, the model is not of systematic-plus-idiosyncratic type.
Note. See Meucci (2010e).
Solution of E 123
See the MATLAB
R
script S_CrossSectionConstrainedIndustries.
CHAPTER 3. MODELING THE MARKET 87
Solution of E 124
See the MATLAB
R
script S_TimeSeriesVsCrossSectionIndustries.
X ∼ N(µ, Σ) , (3.188)
and assume that we want to explain it through a linear model:
X ≡ BF + U , (3.189)
where B is a given vector of loadings, F is a yet-to-be defined explanatory factor, and U are residuals
that make (3.189) hold. Write a MATLAB
R
script in which you:
• Choose N and generate arbitrarily the parameters in (3.188) and the vector of loadings in (3.189);
• Generate a large number of simulations from (3.188);
• Define the factor F through cross-sectional regression and compute the residuals U;
• Show that factor and residual are correlated:
Corr {F, U} =
6 0. (3.190)
Solution of E 125
See the MATLAB
R
script S_FactorResidualCorrelation.
X µX ΣX ΣXF
∼N τ ,τ , (3.191)
F µF Σ0XF ΣF
where:
PT +τ,n
Xn ≡ ln (3.192)
PT,n
ST +τ,k
Fk ≡ ln . (3.193)
ST,k
In particular, assume that the compounded returns are generated by the linear model:
X ≡ τ µX + DF + , (3.194)
F 0 τ ΣF 0
∼N , , (3.195)
0 0 τ Σ
and Σ is diagonal. Notice that (3.194)-(3.195) is a specific case of, and fully consistent with, the more
general formulation (3.191). The specification (3.194) is the "estimation" side of the model, i.e. the
model that would be fitted to the empirical observations. We want to represent the linear returns on the
securities:
R = eX − 1 , (3.196)
Z = eF − 1 , (3.197)
R ≡ a + BZ + U . (3.198)
The specification (3.198) is the interpretation side of the model, i.e. the model that would be used for
portfolio management applications, such as hedging or style analysis. Write a MATLAB
R
script in which
you:
• Upload µX , D, ΣF and Σ from DB_LinearModel;
• Study the relationship between the constant τ µX in (3.194) and the intercept a in (3.198);
• Study the relationship between the loadings D in (3.194) and the loadings B in (3.198);
• Determine if U idiosyncratic?
Note. See Meucci (2010c) and Meucci (2010b).
Solution of E 126
In the simple bi-variate and rescaled case such that Pt = St = 1 the returns are shifted multivariate
lognormal:
!
(t) 2
RP µX σX ρX,F σX σF
∼ LogN t ,t − 1. (3.199)
(t)
RS µF ρX,F σX σF σF2
Y ∼ LogN(µ, Σ) . (3.200)
then:
CHAPTER 3. MODELING THE MARKET 89
1
E {Y} = eµ+ 2 diag(Σ) .
1 1
(3.201)
E {YY0 } = (eµ+ 2 diag(Σ) (eµ+ 2 diag(Σ) )0 ) ◦ eΣ .
Also:
n o
(t) (t)
Cov RP , RS
β≡ n o . (3.203)
(t)
Var RS
Therefore:
2 2
(eµeX t+eσX t/2+µeF t+eσF t/2 )(eρeX,F σeX σeF t − 1)
β= 2 2 . (3.204)
e2µeF t+eσF t (eσeF t − 1)
Finally, U is not idiosyncratic, and the longer the horizon, the more pronounced this effect. See MATLAB R
ln St+τ − ln St
∼ N(τ µ, τ Σ) ; (3.205)
ln Σt+τ − ln Σt
Assume that the investment horizon is eight weeks. We want to represent the linear returns on the
options RC in terms of the linear returns R of the underlying S&P 500 by means of a linear model:
RC ≡ a + BR + U . (3.206)
Notice that the specification (3.206) is the interpretation side of a "factors on demand" model.
• Generate joint simulations for RC and R and scatter-plot the results;
• Compute a and B by OLS;
• Compute the cash and underlying amounts necessary to hedge RC based on the delta of the Black-
Scholes formula. Compare with a and B;
• Repeat the above exercise when the investment horizon shifts further or closer in the future.
Hint. See Meucci (2010c) and Meucci (2010b).
Solution of E 127
To compute the hedge, consider the risk-neutral pricing align for a generic option (not necessarily a call
option):
where O is the option price; S is the underlying value; r is the risk-free rate; δ is the "delta":
∂O
δ≡ , (3.208)
∂S
and C is the cash amount:
C ≡ O − δS . (3.209)
Then:
∆O C δ ∆S
≈ r∆t + S , (3.210)
O O O S
or:
RO ≈ a + bR , (3.211)
where:
C δ
a≡ r∆t, b≡ S. (3.212)
O O
See the MATLAB
R
script S_HedgeOptions for the implementation.
X
R= dk Zk + η , (3.213)
k∈CK
• The recursive rejection routine in Meucci (2005, section 3.4.5) to solve heuristically the above
problem by eliminating the factors one at a time starting from the full set;
• The recursive acceptance routine, which is the same as the above recursive rejection, but it starts
from the empty set, instead of from the full set.
Suppose that the operator admits a one-dimensional eigenvalue/eigenfunction pair, i.e. there exist a num-
ber λω and a function:
h i
S e(ω) = λω e(ω) , (3.215)
where the function is unique up to a constant. Using Table (B.4, AM 2005), the spectral equation (3.215)
reads explicitly as follows:
Z
S(x, y)e(ω) (y)dy = λω e(ω) (x) . (3.216)
R
First of all we determine the generic form of such an eigenfunction, if it exists. Expanding in Taylor
series the spectral basis and using the spectral equation we obtain
Z
λω e(ω) (x + dx) = S(x + dx, y)e(ω) (y)dy
R
Z
= S(x, y − dx)e(ω) (y)dy (3.217)
R
Z
= [S(x, y) − ∂y S(x, y)dx] e(ω) (y)dy .
R
de(ω)
λω e(ω) (x + dx) = λω e(ω) (x) + dx . (3.218)
dx
Therefore, integrating by parts and using the assumption that the matrix S vanishes at infinity, we obtain
the following identity:
de(ω)
Z
λω =− (∂y S(x, y))e(ω) (y)dy
dx R
Z h i Z
=− (ω)
∂y S(x, y)e (y) dy + S(x, y)∂y e(ω) (y)dy (3.219)
Z R R
h i h i
S De(ω) = λω De(ω) , (3.220)
Similarly to (A.52, AM 2005) the operator is positive if for any function v in its domain the following is
true:
Z Z
hv, S [v]i ≡ v(x) S(x, y)v(y)dydx ≥ 0 . (3.222)
R R
In this case we can restate the spectral theorem in the continuum making use of the formal substitutions
in Tables B.4, B.11 and B.20 of Meucci (2005): if the kernel representation S of a linear operator satisfies
(3.221) and (3.222), then the operator
admits an orthogonal basis of eigenfunctions. In other words, then
there exists a set of functions e(ω) (·) ω∈R and a set of positive values {λω }ω∈R such that (3.215) holds,
which is the equivalent of (A.53, AM 2005) in the continuous setting of functional analysis.
Furthermore, the set of eigenfunctions satisfies the equivalent of (A.54, AM 2005) and (A.56, AM 2005),
i.e.:
D E Z
e(ω) , e(ψ) ≡ e(ω) (x)e(ψ) (x)dx = 2πδ (ω) (ψ) , (3.223)
R
where we chose a slightly more convenient normalization constant. Consider the operator E represented
by the following kernel:
This is the equivalent of (A.62, AM 2005), i.e. it is a (rescaled) unitary operator, the same way as (A.62,
AM 2005) is a rotation. Indeed:
CHAPTER 3. MODELING THE MARKET 93
Z Z Z
2 (ω)
kEgk = ( e (x)g(ω)dω)( e(ψ) (x)g(ψ)dψ)dx
ZR Z R Z R
(ω)
= ( e (x)e(ψ) (x)dx)g(ω)g(ψ)dψdω
R R R
Z Z (3.225)
= 2π δ (ω) (ψ)g(ω)g(ψ)dψdω
R R
Z
2
= 2π g(ω)g(ω)dω = 2π kgk .
R
By means of the spectral theorem we can explicitly compute the eigenfunctions and the eigenvalues of a
positive and symmetric Toeplitz operator. First of all from (3.215), (3.220) and the fact that in the spectral
theorem to each eigenvalue corresponds only one eigenvector, we obtain that the following relation must
hold:
de(ω) (x)
= gω e(ω) (x) , (3.226)
dx
for some constant gω that might depend on ω. The general solution to this equation is:
To determine this constant, we compare the normalization condition (3.223) with (B.41, AM 2005) ob-
taining:
To compute the eigenvalues of S we substitute (3.228) in (3.216) and we re-write the spectral equation:
Z Z
iωx iω(x+z) iωx
λω e = S(x, x + z)e dz = e S(x, x + z)eiωz dz . (3.229)
R R
Now recall that S is Toeplitz and thus it is fully determined by its cross-diagonal section:
where h is symmetric around the origin. Therefore we only need to evaluate (3.229) at x = 0, which
yields:
Z
λω = h(z)eiωz dz . (3.231)
R
In other words, the eigenvalues as a function of the frequency ω are the Fourier transform of the cross-
diagonal section of the kernel representation (3.230) of the operator:
λω = F[h](ω) . (3.232)
In particular, if:
then:
Z Z
−γ|z|
λω = σ 2
e cos(ωz)dz + iσ 2
e−γ|z| sin(ωz)dz
R R
Z +∞
= 2σ 2
e−γz cos(ωz)dz + 0 (3.234)
0
2σ 2 γ
= .
γ 2 + ω2
where 0 < r < 1. Show in a figure that the eigenvectors have a Fourier basis structure as in (3.217, AM
2005).
Solution of E 130
See the MATLAB
R
script S_Toeplitz.
Solution of E 131
• Approximating the pdf.
Consider a random variable X with pdf fX . We approximate the pdf with a histogram of N bins:
N
X
fX (x) ≈ fn 1∆n (x) , (3.236)
n=1
where bins ∆1 , . . . , ∆N are defined as follows. First of all, we define the bins’ width:
2a
h≡ , (3.237)
N
CHAPTER 3. MODELING THE MARKET 95
where a is a large enough real number and N is an even larger integer number. Now, consider a
grid of equally spaced points:
ξ1 ≡ −a + h
..
.
ξn ≡ −a + nh (3.238)
..
.
ξN −1 ≡ a − h .
Then for n = 1, . . . , N − 1 we define ∆n as the interval of length h that surrounds symmetrically
the point ξn :
h h
∆n ≡ ξn − , ξn + . (3.239)
2 2
For n = N we define the interval as follows:
h h
∆N ≡ −a, −a + ∪ a − ,a . (3.240)
2 2
This wraps the real line around a circle where the point −a coincides with the point a.
As far as the coefficients fn in (3.236) are concerned, for all n = 1, . . . , N they are defined as
follows:
Z
1
fn ≡ f (x)dx . (3.241)
h ∆n
Z
φX (ω) ≡ eiωx fX (x)dx . (3.242)
R
Z
1
g(x)1∆n (x)dx ≈ g(−a + nh) , (3.243)
h R
N
X Z
φX (ω) ≈ fn eiωx 1∆n (x)dx
n=1 R
(3.244)
N N
− 2πi ωa N
X X
iω(−a+nh) π ( 2 −n)
≈ fn he = fn he N .
n=1 n=1
In particular, we can evaluate the approximate characteristic function at the points:
π
ωr ≡ −(r − 1) , (3.245)
a
obtaining:
N
2πi N
X
φX (ωr ) ≈ fn he− N (r−1)(n− 2 )
n=1
N
2πi
X
= fn he− N (r−1)n eπi(r−1)
n=1
(3.246)
N
− 2πi − 2πi 2πi
X
πi(r−1) N (r−1) N (r−1)n N (r−1)
=e he fn e e
n=1
N
2 2πi
X
= eπi(r−1)(1− N ) h fn e− N (r−1)(n−1) .
n=1
N
2πi
X
φX (ωr ) ≈ eπi(r−1) h fn e− N (r−1)(n−1) . (3.247)
n=1
N
2πi
X
pr (f ) ≡ fn e − N (r−1)(n−1) . (3.248)
n=1
Its inverse, the inverse discrete Fourier transform (IDFT), is the matrix operation p 7→ f which is
defined component-wise as follows:
N
1 X 2πi
fn (p) ≡ pr e N (r−1)(n−1) . (3.249)
N r=1
Comparing (3.247) with (3.248) we see that the approximate cf is a simple multiplicative function
of the DFT of the discretized pdf f :
Y ≡ X1 + · · · + XT , (3.251)
CHAPTER 3. MODELING THE MARKET 97
where X1 , . . . , XT are i.i.d. copies of X. The cf of Y satisfies the identity φY ≡ φTX , see (3.64,
AM 2005). Therefore:
On the other hand, from (3.250), the relation between the cf φY and the discrete pdf fY is:
Therefore:
The values pr (fY ) can now be fed into the IDFT (3.249) to yield the discretized pdf fY of Y as
defined in (3.251).
Solution of E 132
The invariants are the non-overlapping changes in the process ∆Xt over arbitrary intervals. Notice that
these are not the only invariants, as any i.i.d. shock used to generate the process is also an invariant. How-
ever, these invariants are directly observable and their distribution can be estimated with the techniques
discussed in the course. See the MATLAB
R
script S_JumpDiffusionMerton.
where:
σ2
T,τ ∼ N 0, (1 − e−2θτ ) . (3.256)
2θ
If θτ ≈ 0 we can write:
Pt
Xt ≡ (3.259)
Pt−1
Yt ≡ Pt − Pt−1 (3.260)
2
Pt
Zt ≡ (3.261)
Pt−1
Wt ≡ Pt+1 − 2Pt + Pt−1 ; (3.262)
• Determine which among Xt , Yt , Zt , Wt , can potentially be an invariant and which certainly cannot
be an invariant, by computing the histogram from two sub-samples and by plotting the location-
dispersion ellipsoid of a variable with its lagged value.
Solution of E 135
The Wt ’s are clearly not invariants. See the MATLAB
R
script S_EquitiesInvariants.
(k)
Xt ≡ ln(Pt+k − Pt ) , (3.263)
where Pt are the prices at time t of the securities, see (3.11, AM 2005);
• Assume a diagonal-vech GARCH(1,1) process for the one-period compounded returns:
(1)
p
U
Xt =µ+ Ht t . (3.264)
√
U
In this expression S denotes the upper triangular Cholesky decomposition of the generic sym-
metric and positive matrix S, t are normal invariants:
CHAPTER 3. MODELING THE MARKET 99
t ∼ N(0, I) , (3.265)
(1) (1)
Σt ≡ (Xt − µ)(Xt − µ)0 ; (3.267)
• Estimate the parameters (µ, C, a, B) with the methodology in Ledoit et al. (2003);
• Use the estimated parameters to simulate the distribution of the T -day linear return.
Solution of E 136
Assume it is now time t = 0. We are interested in the T -horizon compounded return:
T T p
(T ) (1)
X X U
X0 = Xt = Tµ + Ht t . (3.268)
t=1 t=1
(1)
p
U
X1 = µ + H1 1 . (3.269)
where the matrix H1 is an outcome of the above estimation step. Then for each scenario we update
the next-step scatter matrix H2 according to (3.266). Next, we generate J independent scenarios for 2
from the multivariate distribution (3.265) and we generate return scenarios for the second-period returns
(1)
X2 according to (3.264). We proceed iteratively until the scenarios for all the entries in (3.268) have
been generated. Then the linear return distribution follows from the pricing align R = eX − 1. See the
MATLAB
R
script S_ProjectNPriceMvGarch for the implementation.
PT +τ ∼ LogN(ln(PT ), σ 2 τ ) . (3.272)
The pdf follows from (1.95, AM 2005). See the MATLAB
R
script S_LinVsLogReturn for the implementa-
tion.
2 !
(υ) (υ) 20 + 1.25υ
Yt − Yt−τ ∼ N 0, , (3.275)
10, 000
where υ denotes the generic time to maturity (measuring time in years) and τ is one week. Restrict your
attention to bonds with times to maturity 1, 5, 10, 52 and 520 weeks, and assume that the current yield
curve, as defined in (3.30, AM 2005) is flat at 4%. Write a MATLAB
R
script in which you:
CHAPTER 3. MODELING THE MARKET 101
• Produce joint simulations of the five bond prices at the investment horizon τ of one week;
• Determine what are the analytical marginal distributions of the five bond prices at the investment
horizon τ of one week?
• Produce joint simulations of the five bond linear returns from today to the investment horizon τ of
one week;
• Determine what are the analytical marginal distributions of the five bond linear returns at the in-
vestment horizon τ of one week?
• Comment on why the return on the price of a bond cannot be an invariant.
Hint.
• Since the market is fully codependent you will only need one uniformly generated sample;
• You will need the quantile function to generate simulations. Compute the quantile function using
interp1, the linear interpolation/extrapolation of the cdf.
• For a generic bond with time to maturity υ from the decision date T the expiry date is E ≡ T + υ.
As in (3.81, AM 2005) the price at the investment horizon of that bond reads:
(T +υ) (T +υ−τ )
ZT +τ = ZT exp(−(υ − τ )∆τ Y (υ−τ ) ) . (3.276)
In other words, the price is determined by the market invariant, a random variable, and the known
price of a different bond with shorter time to maturity.
• The distribution of the 4-week-to-maturity bond at the 4-week-horizon is degenerate, i.e. its pdf is
the Dirac delta, because the outcome is deterministic. Make sure that your outcome is consistent
with this statement.
Solution of E 140
From (3.276) the bond price reads:
(T +υ)
ZT +τ = eX , (3.277)
where:
(T +υ−τ )
X ≡ ln(ZT ) − (υ − τ )∆τ Y (υ−τ ) . (3.278)
From (3.275):
where:
2
20 + 1.25υ
συ2 ≡ . (3.280)
10, 000
Therefore:
(T +υ−τ )
X ∼ N(ln(ZT ), (υ − τ )2 συ−τ
2
), (3.281)
From (3.10, AM 2005) the linear return from the current time T to the investment horizon T + τ of a
bond that matures at E ≡ T + υ is defined as:
(T +υ)
(T +υ) ZT +τ
LT +τ,τ ≡ (T +υ)
− 1. (3.283)
ZT
Proceeding as above:
LT +τ,τ = eY − 1 , (3.284)
where:
(T +υ−τ ) (T +υ)
Y ≡ ln(ZT ) − ln(ZT ) − (υ − τ )∆τ Y (υ−τ ) , (3.285)
and thus:
(T +υ)
or LT +τ,τ is a shifted lognormal random variable. Notice that for υ ≡ τ the above distribution is
degenerate, i.e. deterministic, whereas any estimation would have yielded a non-degenerate distribution.
See the MATLAB
R
script S_BondProjectionPricingNormal for the implementation.
p 5
ν ≡ 8, µ ≡ 0, συ2 ≡ 20 + υ × 10−4 . (3.288)
4
Consider bonds with current times to maturity 4, 5, 10, 52 and 520 weeks, and assume that the current
yield curve, as defined in (3.30, AM 2005) in is flat at 4% (measuring time in years). Write a MATLAB
R
• Use the cdf obtained above to generate a joint simulation of the bond prices at the investment
horizon τ of four weeks.
• Plot the histogram of the linear returns LT +τ,τ of each bond over the investment horizon, where
the linear return is defined consistently with (3.10, AM 2005) as follows:
(E)
Zt
Lt,τ · (E)
− 1. (3.289)
Zt−τ
Notice that the long-maturity (long duration) bonds are much more volatile than the short maturity
(short duration) bonds.
Hint. Suppose today is November 1st, 2006, and we hold a zero-coupon bond that matures in 10 weeks,
i.e., it matures on Jan.15. 2007. We are interested in the value of the bond after 4 weeks, i.e., Dec.1 2006.
Recall from (3.30, AM 2005) that the value of a zero-coupon bond is fully determined by its yield to
maturity. At the 4-week investment horizon (Dec.1 2006) our originally 10-week bond will be a 6-week
bond. Therefore its price will be fully determined by the value of the 6-week yield to maturity on Dec.1
2006. For instance, if the 6-week yield to maturity on Dec.1 2006 is 4.1%, then in (3.30, AM 2005) we
(6/52)
have υ ≡ 6/52 and Y12/1/2006 ≡ 0.041. Therefore the bond price on Dec.1 2006 will be:
1/15/2007 6 (6/52)
Z12/1/2006 = exp(− Y )
52 12/1/2006 (3.290)
6
= e− 52 ×0.041 ≈ 0.99528 .
To summarize, in order to price the 10-week bond at the 4-week investment horizon we need the distribu-
tion of the 6-week yield to maturity on Dec.1 2006. In order to proceed, we recall that in the zero-coupon
bond world, the invariants are the non-overlapping changes in yield to maturity, for any yield to maturity,
see the textbook from pp.109 to pp.113. In particular, from (3.31, AM 2005), the following four random
variables are i.i.d.:
(6/52) (6/52)
X1 ≡ Y11/08/2006 − Y11/1/2006 (3.291)
(6/52) (6/52)
X2 ≡ Y11/15/2006 − Y11/08/2006 (3.292)
(6/52) (6/52)
X3 ≡ Y11/22/2006 − Y11/15/2006 (3.293)
(6/52) (6/52)
X4 ≡ Y12/1/2006 − Y11/22/2006 (3.294)
(6/52)
Notice that we can express the random variable Y12/1/2006 in (3.290) as follows:
(6/52) (6/52)
Y12/1/2006 = Y11/1/2006 + X1 + X2 + X3 + X4 . (3.295)
6 (6/52)
1/15/2007
Z12/1/2006 = e− 52 (Y11/1/2006 +X1 +X2 +X3 +X4 )
(3.296)
12/15/2006
= Z11/1/2006 e−6/52(X1 +X2 +X3 +X4 ) ,
12/15/2006
where in the last row we used (a, AM 2005)gain. The term Z11/1/2006 is the current value of a 6-week
zero-coupon bond, which is known. Indeed, using the information that the curve is currently flat at 4%
we obtain:
6 (6/52) 6
12/15/2006
Z11/1/2006 = e− 52 Y11/1/2006 = e− 52 ×0.04 ≈ 0.99540 . (3.297)
We are left with the problem of projecting the invariant, i.e. computing the distribution of X1 + X2 +
X3 + X4 , and pricing it, i.e. computing the distribution of e−6/52(X1 +X2 +X3 +X4 ) in (3.296). To project
the invariant we need to compute the distribution of the sum four independent t variables:
d d d 2
X1 = X2 = X3 = X4 ∼ St(ν, µ, σ6/52 ), (3.298)
where the parameters follow from (3.287). This is the FFT algorithm provided in ProjectionStudentT. The
pricing is then performed by Monte Carlo simulations. As for the linear returns, these are the return on
our bond over the investment horizon. Therefore (3.289) reads:
(1/15/2007)
Z12/1/2006
4 ≡
L12/1/2006, 52 − 1. (3.299)
(1/15/2007)
Z11/1/2006
Solution of E 141
See the MATLAB
R
script S_BondProjectionPricingStudentT.
Zt+1 ≡ a
b + BZ
b t +b
t+1 , (3.300)
where time is measured in weeks;
t are invariants using the MATLAB
• Check whether the weekly residuals b R
function PerformIidAnalysis.
Solution of E 142
The weekly changes in (the logarithm of) the implied volatility are not invariants, because they display
significant negative autocorrelation. On the other hand, the weekly residuals et are invariants. See the
MATLAB
R
script S_DerivativesInvariants.
• Upload the time series of the underlying and the implied volatility surface provided in DB_ImplVol;
• Fit a joint normal distribution to the weekly invariants, namely the log-changes in the underly-
ing and the residuals from a vector autoregression of order one in the log-changes in the implied
volatilities surface Σt :
ln St+τ − ln St
∼ N(τ µ, τ Σ) ; (3.301)
ln Σt+τ − ln Σt
• Generate simulations for the invariants and jointly project underlying and implied volatility surface
to the investment horizon;
• Price the above simulations through the full Black-Scholes formula at the investment horizon, as-
suming a constant risk-free rate at 4%;
• Compute the joint distribution of the linear returns of the call options, as represented by the sim-
ulations: the current prices of the options can be obtained similarly to the prices at the horizon by
assuming that the current values of underlying and implied volatilities are the last observations in
the database;
• For each call option, plot the histogram of its distribution at the horizon and the scatter-plot of its
distribution against the underlying;
• Verify what happens as the investment horizon shifts further in the future.
Hint. You need to interpolate the surface at the proper strike and time to maturity, which at the horizon
has shortened.
Solution of E 143
See the MATLAB
R
script S_CallsProjectionPricing.
Solution of E 144
See the MATLAB
R
script S_StatArbSwaps.
Chapter 4
(E, d = argmin[Vol{Eµ,Σ }] ,
b N Cov) (4.1)
(µ,Σ)∈C
where the set of constraints C imposes that Σ is symmetric and positive definite and that the average
Mahalanobis distance is one, see (4.49, AM 2005).
Solution of E 145 p
From (A.77, AM 2005) the volume of the ellipsoid Eµ,Σ is proportional to |Σ|. Therefore, defining
Ω ≡ Σ−1 , the optimization problem (4.48, AM 2005) (in log) becomes:
(b b ≡ argmin ln |Ω| ,
µ, Ω) (4.2)
(µ,Ω)∈C
T
1X
C1 : (xt − µ)0 Ω(xt − µ) = 1
T t=1 (4.3)
C2 : Ω symmetric, positive .
We solve neglecting C2 and we check later that C2 is satisfied. The Lagrangian reads:
"
T
#
1X 0
L ≡ ln |Ω| − λ (xt − µ) Ω(xt − µ) − 1 . (4.4)
T t=1
106
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 107
T
∂L 2X
0N ×1 = = Ω(xt − µ) , (4.5)
∂µ T t=1
T
1X
b≡
µ xt ≡ E
b. (4.6)
T t=1
As for the first order condition with respect to Ω, we see from (A.125, AM 2005) that if A is symmetric,
then the following identity holds:
∂ ln |A|
= A−1 . (4.7)
∂A
Therefore:
T
∂L λX
0N ×N = = Ω−1 − (xt − µ)(xt − µ)0 , (4.8)
∂Ω T t=1
T
!−1
λX 1 d −1
Ω
b = (xt − µ)(xt − µ)0 ≡ Cov . (4.9)
T t=1 λ
1 N
1 = tr[ΩCov] = tr
b d IN = , (4.10)
λ λ
from which λ = N .
E 146 – Ordinary least squares estimator of the regression factor loadings (www.4.1)
Show that the ordinary least squares (OLS) estimator B b in (4.52, AM 2005) provides the best fit to
the observations, in the sense that it minimizes the sum of the square distances between the original
observations ft and the recovered values Bf
b t:
X 2
Bb = argmin kxt − Bft k , (4.11)
B t
where k·k is the standard norm (A.6, AM 2005).
Solution of E 146
We simply write the first order conditions, which read:
T
X
0N ×K = b t )f 0 .
−(xt − Bf (4.12)
t
t=1
The solution to this set of equations are the OLS factor loadings (4.52, AM 2005).
E 147 – Maximum likelihood estimation for elliptical distributions (www.4.2)
Show that the maximum likelihood (ML) estimators of location and dispersion under the assumption that
the N -dimensional invariants X ∼ El(µ, Σ, g), are given by:
PT
wt xt
b = Pt=1
µ T
s=1 ws
T
(4.13)
b = 1 b )0 ,
X
Σ wt (xt − µ
b ) (xt − µ
T t=1
g 0 Mt2
wt ≡ −2 , (4.14)
g (Mt2 )
and:
0
Mt2 ≡ (xt − µ) Ω (xt − µ) , (4.15)
with Ω ≡ Σ−1 .
Hint.
∂Mt2
= −2Ω (xt − µ) (4.16)
∂µ
∂Mt2 0
= (xt − µ) (xt − µ) . (4.17)
∂Ω
Solution of E 147
To compute the ML estimators µ b and Σ
b we have to maximize the likelihood function (4.66, AM 2005)
over the following parameters set:
First of all it is equivalent, though easier, to maximize the logarithm of the likelihood function. Secondly
we neglect the constraint that µ and Σ lie in Θ and verify ex-post that the unconstrained solution belongs
to Θ. Third, it is easier to compute the ML estimators of µ and Ω. The ML estimator of Σ is simply the
inverse of the estimator of Ω by the invariance property (4.70, AM 2005) of the ML estimators.
From (4.74, AM 2005) the log-likelihood reads:
T T
X T X
ln g Mt2 .
ln (fθ (iT )) = ln fθ (xt ) = ln |Ω| + (4.19)
t=1
2 t=1
" T # T T
g 0 Mt2 ∂Mt2
∂ X 2
X X
0N ×1 = ln g Mt = = wt Ω (xt − µ) , (4.20)
∂µ t=1 t=1
g (Mt2 ) ∂µ t=1
PT
wt xt
b = Pt=1
µ T
. (4.21)
s=1 ws
T
T ∂ ln |Ω| X g 0 Mt2 ∂Mt2
0N ×N = +
2 ∂Ω t=1
g (Mt2 ) ∂Ω
(4.22)
T
T 1X 0
= Ω−1 − wt (xt − µ) (xt − µ) ,
2 2 t=1
where in the last row we used (4.17) and the fact that from (A.125, AM 2005) for a symmetric matrix Ω
we have:
∂ ln |Ω|
= Ω−1 . (4.23)
∂Ω
Thus the solution to (4.22) reads:
T
b −1 = 1 b )0 .
X
b ≡Ω
Σ wt (xt − µ
b ) (xt − µ (4.24)
T t=1
This matrix is symmetric and positive definite, and thus the unconstrained optimization is correct.
E 148 – Maximum likelihood estimation for univariate elliptical distributions (see E 147)
Consider the same setup than in E 147 but assume now that X ∼ El(µ, σ 2 , g), where we know the func-
tional form of g. Compute the maximum likelihood (ML) estimators µ
b and σ b2 of µ and σ 2 respectively.
Hint. Define:
and use:
∂Mt2
= −2ω 2 (xt − µ) (4.26)
∂µ
∂Mt2
= (xt − µ)2 . (4.27)
∂ω 2
Solution of E 148
To compute the ML estimators µ b2 we have to maximize the likelihood function as in (4.66, AM
b and σ
2005), which after (4.74, AM 2005) reads:
T
(xt − µ)2
2
X 1
(b b ) ≡ argmax
µ, σ ln √ g , (4.28)
µ,σ 2 ∈Θ t=1 σ2 σ2
where the parameter set is Θ ≡ R × R+ . We neglect the constraint that σ 2 be positive and verify ex-post
that the unconstrained solution satisfies this condition. It is easier to compute the ML estimators of µ
and ω 2 ≡ 1/σ 2 . The ML estimator of σ 2 is simply the inverse of the estimator of ω 2 by the invariance
property (1.70, AM 2005) of the ML estimators. The log-likelihood reads:
T
T 2 X
ln g(Mt2 ) .
ln(fθ (iT )) = ln ω + (4.29)
2 t=1
" T # " T #
∂ ∂ X ∂ X 2
0= [ln(fθ (iT ))] = ln fθ (xt ) = ln g(Mt )
∂µ ∂µ t=1 ∂µ t=1
(4.30)
T T
X g 0 (M 2 ) ∂M 2
t t
X
= = wt ω 2 (xt − µ) ,
t=1
g(Mt2 ) ∂µ t=1
g 0 (Mt2 )
wt ≡ −2 . (4.31)
g(Mt2 )
PT
wt xt
b = Pt=1
µ T
. (4.32)
s=1 ws
PT
∂ ln(fθ (iT )) ∂ t=1 ln fθ (xt )
0= =
∂ω 2 ∂ω 2
T 0
T ∂ ln(ω ) X g (Mt2 ) ∂Mt2
2
= + (4.33)
2 ∂ω 2 t=1
g(Mt2 ) ∂ω 2
T
T 1 1X
= − wt (xt − µ)2 ,
2 ω2 2 t=1
where in the last row we used (4.27). Thus the solution to (4.33) reads:
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 111
T
1 1X
b2 ≡
σ = b)2 .
wt (xt − µ (4.34)
c2 )
(ω T t=1
Solution of E 149
From the property (2.270, AM 2005) of elliptical distribution this implies that the conditional distribution
of the invariants is elliptical with the same density generator:
To compute the maximum likelihood (ML) estimators B b we define Ω ≡ Σ−1 and we maximize
b and Σ,
the log-likelihood function:
T
T X
ln g Mt2 ,
ln (fθ (iT )) ≡ ln |Ω| + (4.39)
2 t=1
where:
0
Mt2 ≡ (xt − Bft ) Ω (xt − Bft ) . (4.40)
The first order conditions with respect to B read:
∂
0N ×K = [ln (fθ (iT ))]
∂B
T
g 0 Mt2 ∂M 2
X
t
= (4.41)
t=1
g (Mt2 ) ∂B
T
X
= wt Ω (xt − Bft ) ft0 ,
t=1
where:
g 0 Mt2
wt ≡ −2 . (4.42)
g (Mt2 )
The solution to (4.41) reads:
T
T ∂ ln |Ω| X g 0 Mt2 ∂Mt2
0N ×N = +
2 ∂Ω t=1
g (Mt2 ) ∂Ω
(4.44)
T
T 1X 0
= Ω−1 − wt (xt − µ) (xt − µ) ,
2 2 t=1
where in the last row we used (4.17) and the fact that from (A.125, AM 2005) for a symmetric matrix Ω
we have:
∂ ln |Ω|
= Ω−1 . (4.45)
∂Ω
The solution to (4.22) reads:
T
b −1 = 1 b )0 .
X
b ≡Ω
Σ wt (xt − µ
b ) (xt − µ (4.46)
T t=1
This matrix is symmetric and positive definite, and thus the unconstrained optimization is correct.
2
Xt µX σX ρσX σF
∼N , . (4.47)
Ft µF ρσX σF σF2
Xt = α + βft + Ut , (4.48)
where:
What is the conditional model (4.48)-(4.49) ensuing from (4.47)? Consider the conditional model (4.48)-
(4.49) for the invariants. Compute the ML estimators of the factor loadings (b
α, β)
b given the observations
iT ≡ {x1 , f1 , . . . , xT , fT }.
Hint. Consider ft0 ≡ (1, ft ) and:
T T
b XF ≡ 1 bF ≡ 1
X X
Σ xt ft0 , Σ ft f 0 . (4.50)
T t=1 T t=1 t
Solution of E 150
See (2.173, AM 2005) and/or (3.130, AM 2005)-(3.131, AM 2005) to derive:
σX
α ≡ µX − ρ µF (4.51)
σF
σX
β≡ρ (4.52)
σF
σ ≡ σX (1 − ρ2 ) .
2 2
(4.53)
(b
α, β)
b =Σ b −1 .
b XF Σ (4.54)
F
E 151 – Explicit factors: maximum likelihood estimator of the factor loadings (see E 150)
Consider the same setup than in E 150. Compute the joint distribution of the ML estimators of the factor
loadings (b
α, β)
b under the conditional model (4.48)-(4.49).
Solution of E 151
Follow the proof of (4.129, AM 2005) to derive in terms of a (degenerate) matrix-valued normal distribu-
tion:
2
(b b ∼ N (α, β), σ , Σ
α, β) b −1 . (4.55)
F
T
σ 2 b −1
α α
∼N
b
, Σ . (4.56)
βb β T F
E 152 – Explicit factors: maximum likelihood estimator of the dispersion parame-
ter (see E 150)
b2 of the dispersion
Consider the same setup than in E 150. Compute the distribution of the ML estimator σ
parameter that appears in (4.49).
Solution of E 152
Follow the proof of (4.130, AM 2005) and use (2.230, AM 2005) to derive:
b2 ∼ Ga(T − 2, σ 2 ) .
Tσ (4.57)
√ α − α)
(b
tα ≡
b T − 2p , (4.58)
b2 σ
σ bα2
√ (βb − β)
tβ ≡
b T − 2q , (4.59)
bβ2
b2 σ
σ
where σ b −1 and σ
bα2 is the north-west entry of Σ bβ2 is its south-east entry.
F
Solution of E 153
From (4.57), (1.106, AM 2005) and (1.109, AM 2005) it follows:
b2
T σ
(T − 2) ∼ χ2T −2 . (4.60)
T − 2 σ2
s
T
α − α) ∼ N(0, 1) ,
(b (4.61)
bα2 σ 2
σ
q
T
√ α − α)
(b σ
bα2 σ 2 (b
α − α)
tα ≡
b T − 2p = q (4.62)
b2 σ
σ bα2 T σ b2
T −2 σ 2
d Y1
tα = q
b ∼ St(T − 2, 0, 1) . (4.63)
ZT2 −2
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 115
α = α0 , (4.64)
for an arbitrary value α0 in (4.48), typically α0 ≡ 0. How can you asses if the hypothesis (4.64) is
acceptable?
Solution of E 154
tα0 of (4.58). In the
First, compute the distribution of (4.58) under (4.64). Then compute the realization e
notation (1.87, AM 2005) we obtain:
St
P btα0 ≤ e
tα0 = Fν,0,1 (e
tα0 ) (4.65)
St
P btα0 ≥ e
tα0 = 1 − Fν,0,1 (e tα0 ) . (4.66)
Therefore, if tα is so small or so large that either probabilities are too small, then (4.64) is very unlikely.
E 155 – Independence of the sample mean and the sample covariance (www.4.3) *
Assume that Xt ∼ N(µ, Σ). Prove that the sample mean (4.100, AM 2005) and sample covariance
(4.101, AM 2005) are independent of each other.
Solution of E 155
Consider the following variables:
T
1X
b≡
µ Xt
T t=1
U1 ≡ X 1 − µ
b (4.67)
..
.
UT ≡ X T − µ
b.
n PT PT 0 o
= E ei( t=1 (ωt + T − T s=1 ωs ) Xt ) .
τ 1
From the independence of the invariants we can factor the characteristic function as follows:
T T T
!
n PT 0 o 1X τ
E ei(ωt + T − T s=1 ω s ) Xt
Y τ 1 Y
φ= = φ Xt ωt − ωs + . (4.69)
t=1 t=1
T s=1 T
Since Xt is normal, from (2.157, AM 2005) we have
0 1 0
φXt (ω) = eiµ ω− 2 ω Σω . (4.70)
Therefore:
µ0 (ω t − T1
PT PT
φ = ei t=1 s=1
τ
ωs + T )
PT PT 0 PT (4.71)
− 12 (ω t − T1 τ
ωs + T ) Σ(ωt − T1 τ
ωs + T )
×e t=1 s=1 s=1 .
T T
!
X
0 1X τ
µ ωt − ωs + = µ0 τ (4.72)
t=1
T s=1
T
T T
!0
X 1X τ
ωt − ωs Σ = 0 . (4.73)
t=1
T s=1
T
Therefore the joint characteristic function factors into the following product:
where
PT 0 PT
− 21 (ω t − T1 ω s ) Σ(ω t − T1 ωs )
P
ψ (ω 1 , . . . , ω T ) ≡ e s=1 s=1 (4.75)
0 1 0
τ − 2T
χ (τ ) ≡ eiµ τ Στ
. (4.76)
T
1X
Σ≡
b Ut U0t , (4.77)
T t=1
is independent of µ
b.
Σ
b ∼ N µ,
µ . (4.78)
T
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 117
Solution of E 156
Recall that the characteristic function of the multivariate random normal variable Xt is given by:
0 1 0
φXt (ω) ≡ E{eiωXt } = eiω µ− 2 ω Σω . (4.79)
PT
b≡
Now, using the definition of the sample mean µ t=1 Xt , we have:
1 PT PT Xt 0µ 1 0 Σ 0 1 0 Σ
E{eiω T t=1 Xt
} = E{eiω t=1 T } = eiT ω T − 2 Tω T2 ω
= eiω µ− 2 ω Tω (4.80)
where the second equality follows from independence. This expression is the characteristic function of a
random normal variable with mean µ and covariance Σ/T .
Xt ∼ N(µ, σ 2 ), t = 1, . . . , T . (4.81)
T
1X
b≡
µ Xt . (4.82)
T t=1
σ2
b ∼ N µ,
µ . (4.85)
T
Regarding P {b e} we have:
µ>µ
( )
b−µ
µ e−µ
µ
P {b e} = 1 − P {b
µ>µ µ≤µ
e} = 1 − P p ≤p . (4.86)
σ 2 /T σ 2 /T
From (4.84) and (4.85) it follows:
b−µ
µ
p ∼ N(0, 1) , (4.87)
σ 2 /T
therefore:
!
e−µ
µ
P {b e} = 1 − Φ
µ>µ p , (4.88)
σ 2 /T
Xt ∼ N(µ, σ 2 ) , (4.89)
µ ≡ µ0 , σ 2 ≡ σ02 . (4.90)
The p-value of µ
b for µ
e under the hypothesis (4.90) is the probability of observing a value as extreme as
the observed value:
p ≡ P {b e} .
µ≶µ (4.91)
Compute the expression of the p-value in terms of the cdf of the estimator.
Solution of E 158
From (4.102, AM 2005):
σ2
b ∼ N µ,
µ . (4.92)
T
p ≡ P {b e} = FµN0 ,σ2 /T (e
µ≤µ µ) (4.93)
0
or
p ≡ P {b
µ≥µ
e} = 1 − P {b e} = 1 − FµN0 ,σ2 /T (e
µ≤µ µ) . (4.94)
0
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 119
Xt ∼ N(µ, σ 2 ) , (4.95)
in a time series of length T . Consider the ML estimators µ b2 of the location and scatter parameters
b and σ
2
µ and σ respectively. The t-statistic for µb is defined as:
b − µ0
µ
tµ0 ≡ p
b . (4.96)
σb2 /(T − 1)
µ = µ0 , (4.97)
for an arbitrary value µ0 in (4.95). How can you asses if the hypothesis (4.97) is acceptable?
Hint. Recall that if Yσ2 and Zν are independent and such that
then:
Y 2
Xν,σ2 ≡ pσ ∼ St(ν, 0, σ 2 ) . (4.100)
Zν2
Solution of E 159
From (4.103, AM 2005), (1.106, AM 2005) and (1.109, AM 2005) it follows:
b2
T σ
(T − 1) ∼ χ2T −1 . (4.101)
T − 1 σ2
From (4.92) we obtain:
r
T
µ − µ) ∼ N(0, 1) .
(b (4.102)
σ2
Furthermore, from E 155 we derive that µ b2 are independent. From (4.100), we obtain:
b and σ
r
b−µ
µ T 1 d Y1
tµ ≡ p
b = 2
µ − µ) q
(b =q . (4.103)
σ 2
b /(T − 1) σ Tσb2
ZT2 −1
(T −1)σ 2
Therefore:
tµ ∼ St(T − 1, 0, 1) .
b (4.104)
Finally, to test µ = µ0 , first, compute the distribution of (4.96) under (4.97). Then compute the realization
tµ0 of (4.96). In the notation (1.87, AM 2005) we obtain:
e
tµ0 = FTSt−1,0,1 (e
P btµ0 ≤ e tµ0 ) (4.105)
St
P btµ0 ≥ e
tµ0 = 1 − FT −1,0,1 (e tµ0 ) . (4.106)
Therefore, if tα is so small or so large that either probabilities are too small, then (4.97) is very unlikely.
b ∼ W(T − 1, Σ) .
TΣ (4.107)
Solution of E 160
First of all we notice that the estimator of the covariance of Xt is the same as the estimator of the
covariance of Yt ≡ Xt + b for any b. Indeed defining:
T
1X
b≡
ν Yt , (4.108)
T t=1
µ b − b,
b=ν (4.109)
1
PT
b≡
where µ T t=1 Xt and thus:
T
bY ≡ 1
X
Σ (Yt − ν b )0
b )(Yt − ν
T t=1
T
1X
= (Xt + b − (b µ + b))0
µ + b))(Xt + b − (b
T t=1 (4.110)
T
1 X
= (Xt − µ b )0
b )(Xt − µ
T t=1
≡Σ
bX .
T
b0 =
X
W ≡ TΣ
b + Tµ
bµ Xt X0t , (4.111)
t=1
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 121
where the last equality follows from substitution of the definitions (4.67) and (4.77). From the indepen-
dence of Σb and µb (see E 155) the characteristic function of W must be the product of the characteristic
function of T Σ
b and the characteristic function of T µ
bµb 0 . Therefore:
φW (Ω)
φT Σ
b (Ω) = . (4.112)
φT µb µb 0 (Ω)
On the one hand from the normal hypothesis N(0, Σ) and (2.223, AM 2005) we obtain that W is Wishart
distributed:
W ∼ W(T, Σ) , (4.113)
1
φW (Ω) = T /2
. (4.114)
|I − 2iΣΩ|
n 0
o
φT µb µb 0 (Ω) ≡ E ei tr([T µb µb ]Ω)
n 0
o
= E ei tr(µb µb [T Ω]) (4.115)
1
= φµb µb 0 (T Ω) = 1/2
.
|I − 2iΣΩ|
1
φT Σ
b (Ω) = (T −1)/2
, (4.116)
|I − 2iΣΩ|
b ∼ W(T − 1, Σ) .
TΣ (4.117)
Σ
b − µ ∼ N 0,
µ , (4.118)
T
and thus from (2.222, AM 2005) and (2.223, AM 2005):
Σ
(b µ − µ)0 ∼ W 1,
µ − µ)(b . (4.119)
T
Therefore from (2.227, AM 2005) the estimation error reads:
Err {b µ − µ)0 (b
µ, µ} ≡ E {(b µ − µ)}
= tr(E {(b µ − µ)0 })
µ − µ)(b (4.120)
1
= tr(Σ) .
T
1 2 1 2
Err2µ,Σ (Σ,
b Σ) = tr(Σ ) + 1 − [tr(Σ)] . (4.121)
T T
Solution of E 162
From (4.103, AM 2005) we have:
b − Σ = T − 1Σ − Σ = − 1 Σ .
b − Σ = 1 E TΣ
n o n o
E Σ (4.122)
T T T
Therefore the bias reads:
b − Σ)2 = 1 tr Σ2 .
n n o o
Bias2 (Σ,
b Σ) ≡ tr (E Σ (4.123)
T 2
n h io
Err2µ,Σ (Σ, b − Σ)2
b Σ) ≡ E tr (Σ
( )
Xh i h i
=E Σb −Σ b −Σ
Σ
mn nm
m,n
X h i2
= E Σ b −Σ
mn
m,n
X n o (4.124)
= b mn − Σmn )2
E (Σ
m,n
X
= Err2µ,Σ (Σ
b mn , Σmn )
m,n
Xh i
= Bias2µ,Σ (Σ
b mn , Σmn ) + Inef2 (Σ
µ,Σ
b mn ) ,
m,n
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 123
X 1 T −1 T −1 2
Err2µ,Σ (Σ,
b Σ) = Σ 2
+ Σ Σ
mm nn + Σ
m,n
T 2 mn T2 T2 mn
1X 2 T −1X
= Σmn + Σmm Σnn (4.125)
T m,n T 2 m,n
1 1 2
= tr(Σ2 ) + 1 − [tr(Σ)] .
T T
E 163 – Maximum likelihood estimator of the conditional factor loadings (www.4.4) *
Consider the conditional linear factor model (4.88, AM 2005) where the perturbations are normally dis-
tributed:
b ∼ N B, Σ , Σ
B b −1 (4.127)
F
T
b ∼ W(T − K, Σ) ,
TΣ (4.128)
and that B
b and Σ
b are independent to each other.
Note. In the spirit of explicit factors models, the dependent variables Xt are random variables, whereas
the factors ft are considered observed numbers. In other words, we derive all the distributions conditioned
on knowledge of the factors.
Solution of E 163
First of all, a comment on the notation to follow: we will denote here γ1 , γ2 , γ3 , γ4 simple normalization
constants. We derive here the joint distribution of the sample factor loadings:
b ≡Σ
B b −1 ,
b XF Σ (4.129)
F
where:
T T
1X 1X 0
ΣXF ≡
b xt ft0 , ΣF ≡
b ft f , (4.130)
T t=1 T t=1 t
T
b ≡ 1
X
Σ (xt − Bf b t )0 .
b t )(xt − Bf (4.131)
T t=1
Notice that the invariants Xt are random variables, whereas the factors ft are not. From the normal
hypothesis (4.126) the joint pdf of the time series IT ≡ {x1 , . . . , xT |f1 , . . . , fT } in terms of the factor
loadings B and the dispersion parameter Ω ≡ Σ−1 reads:
T 1
PT 0
f (iT ) = γ1 |Ω| 2 e− 2 t=1 (xt −Bft ) Ω(xt −Bft )
T 0
(4.132)
= γ1 |Ω| 2 e− 2 tr{Ω }.
1
PT
t=1 (xt −Bft )(xt −Bft )
{· · · } = ΩA , (4.133)
where:
T
X
A≡ (xt − Bft )(xt − Bft )0
t=1
T h
X ih i0
= (xt − Bf b t − Bft ) (xt − Bf
b t ) + (Bf b t − Bft )
b t ) + (Bf
t=1
T T
!
X
0
X (4.134)
= (xt − Bft )(xt − Bft ) + (B − B)
b b b ft ft b − B)0
(B
t=1 t=1
T
X T
X
+ (xt − Bf b t − Bft )0 +
b t )(Bf b t )0
b t − Bft )(xt − Bf
(Bf
t=1 t=1
= TΣ b − B)T Σ
b + (B b − B)0 + 0 + 0 .
b F (B
T
X T
X T
X
(xt − Bf b t − Bft )0 =
b t )(Bf xt ft0 B
b0 + b t f 0 B0
Bf t
t=1 t=1 t=1
T
X T
X
− xt ft0 B0 − b tf 0B
Bf t
b0
t=1 t=1
(4.135)
= TΣ b 0 + BT
b XF B b Σb F B0 − T Σ
b XF B0 − T B
bΣ b0
bFB
= TΣ b −1 Σ
b XF Σ b0 + TΣ
b XF B0
F XF
b XF B0 − T Σ
− TΣ b −1 Σ
b XF Σ b0
F XF
= 0.
T 0
f (iT ) = γ1 |Ω| 2 e− 2 tr{T Ω[Σ+(B−B)ΣF (B−B) ]} .
1
(4.136)
b b b b
where:
− T −K−N
2
−1
f (iT |B, b ≡ γ2 Σ
b T Σ) b , (4.138)
and f (B,
b T Σ)
b factors as follows:
f (B,
b T Σ)
b = f (B)f
b (T Σ)
b , (4.139)
where:
K
N2 0
b F e− 12 tr{(T Ω)(B−B)
b ≡ γ3 |T Ω| 2 Σ
f (B)
b Σb F (B−B)
b } (4.140)
and:
T −K
T −K−N
2
−1
1
b ≡ γ4 |Ω|
f (T Σ) T Σ e− 2 tr(ΩT Σ) . (4.141)
2
b b
Expression (4.140) is of the form (2.182, AM 2005). Therefore the OLS factor loadings have a matrix-
valued normal distribution:
b −1 .
b ∼ N B, (T Ω)−1 , Σ
B (4.142)
F
Σ b −1
B ∼ N B, , ΣF
b . (4.143)
T
Also, expression (4.141) is the pdf (2.224, AM 2005) of a Wishart distribution, and thus:
b ∼ W(T − K, Σ) .
TΣ (4.144)
X ∼ N(µ, IN ) , (4.145)
where IN is the N -dimensional identity matrix. Consider a smooth function g of N variables. Prove
Stein’s lemma in this context, that is:
∂g(X)
E {g(X)(Xn − µn )} = E . (4.146)
∂xn
Hint. Use:
Z
G(x) ≡ g(x1 , . . . , x, . . . , xN )
RN −1 (4.147)
N −1 1
P 2
× (2π)− 2 e− 2 k6=n (xk −µk ) dx1 · · · dxn−1 dxn+1 · · · dxN .
Solution of E 164
From the definition of expected value for a normal distribution we have:
Z
E {g(X)(Xn − µn )} = g(x1 , . . . , xn , . . . , xN )(xn − µn )
RN
N 1
P 2
× (2π)− 2 e− 2 k (xk −µk ) dx (4.148)
Z +∞ (xn −µn )2
e− 2
= (xn − µn )G(xn ) √ dxn ,
−∞ 2π
where we defined G as follows:
Z
G(x) ≡ g(x1 , . . . , x, . . . , xN )
RN −1 (4.149)
N −1 1
P 2
× (2π)− 2 e− 2 k6=n (xk −µk ) dx1 · · · dxn−1 dxn+1 · · · dxN .
Notice that:
Z
∂g(x) N −1 1
P 2
dG(x) ≡ (2π)− 2 e− 2 k6=n (xk −µk ) dx1 · · · dxn−1 dxn+1 · · · dxN . (4.150)
RN −1 ∂xn
u ≡ G(xn ) (4.151)
2
− (xn −µ n)
v ≡ −e 2 , (4.152)
we get:
Z +∞ Z +∞
1 1 +∞
E {g(X)(Xn − µn )} = √ udv = √ uv|−∞ − vdu . (4.153)
2π −∞ 2π −∞
The first term vanishes. Replacing (4.151) and (4.152) in the second term and using (4.150) we obtain:
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 127
Z +∞
1 (xn −µn )2
E {g(X)(Xn − µn )} = − √ −e− 2
2π −∞
Z
∂g(x) N −1 1
P 2
× (2π)− 2 e− 2 k6=n (xk −µk ) dx1 · · · dxn−1 dxn+1 · · · dxN
N −1 ∂xn
Z R
∂g(x) N 1
P 2
= (2π)− 2 e− 2 k (xk −µk ) dx
R N ∂x n
∂g(X)
= E .
∂xn
(4.154)
b≡ a a
δ 1− µ
b+ b, (4.155)
µ − b)0 (b
(b µ − b) µ − b)0 (b
(b µ − b)
where µ
b is the sample mean:
1X Σ
b≡
µ Xt ∼ N µ, , (4.156)
T t T
where b is any constant vector and where a is any scalar such that:
2
0<a< (tr(Σ) − 2λ1 ) , (4.157)
T
where λ1 is the largest eigenvalue of the matrix Σ. From the definition (4.134, AM 2005) of error, we
have:
2 0
[Err(δ, µ)] = E [δ − µ] [δ − µ]
( 0 )
a(bµ − b) µ − b)
a(b
=E µ b −µ− µb −µ−
µ − b)0 (b
(b µ − b) (bµ − b)0 (b
µ − b) (4.158)
µ − b)0 (b
2 1 (b µ − µ)
µ, µ)] + a2 E
= [Err(b − 2a E .
µ − b)0 (b
(b µ − b) µ − b)0 (b
(b µ − b)
We proceed now to simplify the expression of the last expectation in (4.158). Consider the principal
component decomposition (A.70, AM 2005) of the matrix Σ in (4.156):
Σ ≡ EΛE0 , (4.159)
and define the following vector of independent normal variables:
√ 1
Y≡ T Λ− 2 E0 µ
b ∼ N(ν, I) , (4.160)
together with:
√ 1 √ 1
ν≡ T Λ− 2 E0 µ, c≡ T Λ− 2 E0 b . (4.161)
Then the term in curly brackets in the last expectation in (4.158) reads:
h√ i0 h√ i
− 12 0 − 12 0
0
µ − b) (b
(b µ − µ) T Λ E (b
µ − b) Λ T Λ E (b
µ − µ)
= h√ i0 h√
µ − b)0 (b
(b µ − b) 1 1
i
T Λ− 2 E0 (b
µ − b) Λ T Λ− 2 E0 (b µ − b)
(Y − c)0 Λ(Y − ν) (4.162)
=
(Y − c)0 Λ(Y − c)
N
X
= gj (Y)(Yj − νj ) ,
j=1
where:
(yj − cj )λj
gj (y) ≡ . (4.163)
(y − c)0 Λ(y − c)
Applying the rules of calculus we compute:
∂gj (y) λj d 1
= 0
+ (yj − cj )λj 0
∂yj (y − c) Λ(y − c) dyj (y − c) Λ(y − c)
λj 2λ2j (yj − cj )2
= − 2 (4.164)
(y − c)0 Λ(y − c)
[(y − c)0 Λ(y − c)]
0
λj (y − c) Λ(y − c) − 2λ2j (yj − cj )2
= 2 .
[(y − c)0 Λ(y − c)]
Therefore, using Stein’s lemma (see E 164), we obtain for the last expectation in (4.158):
N
µ − b)0 (b
(b µ − µ) X
E = E {gj (Y)(Yj − νj )}
µ − b)0 (b
(b µ − b) j=1
N
X ∂gj (Y)
= E
j=1
∂yj
( ) (4.165)
N
X λj (Y − c)0 Λ(Y − c) − 2λ2j (Yj − cj )2
= E 2
j=1 [(Y − c)0 Λ(Y − c)]
( )
tr(Λ) (Y − c)0 ΛΛ(Y − c)
=E 0
−2 2 .
(Y − c) Λ(Y − c) [(Y − c)0 Λ(Y − c)]
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 129
√ 1
Y−c= T Λ− 2 E0 (b
µ − b) , (4.166)
( 1 1
)
µ − b)0 (b µ − b)EΛ 2 Λ 2 E0 (b
(b µ − µ) tr(Λ) 1 1 (b µ − b)
E =E − 2
µ − b)0 (b
(b µ − b) T (b 0
µ − b) (b µ − b) T µ − b)0 (b
[(b µ − b)]
(4.167)
2 Nλ µ − b)Σ(b
2 (b µ − b)
=E − ,
µ − b)0 (b
(b µ − b) T µ − b)0 (b
T (b µ − b)
where:
tr(Λ)
λ≡ (4.168)
N
is the average of the eigenvalues. From the relation (A.68, AM 2005) on the largest eigenvalue λ1 of Σ
we obtain:
µ − b)Σ(b
(b µ − b)
0
≤ λ1 . (4.169)
µ − b) (b
(b µ − b)
Therefore, substituting (4.167) in (4.158), using (4.169) and recalling (4.157) we obtain the following
relation for the error:
2 2 a N µ − b)Σ(b
4 (b µ − b)
[Err(δ, µ)] = [Err(b
µ, µ)] + E a−2 λ+
µ − b)0 (b
(b µ − b) T µ − b)0 (b
T (b µ − b)
( )
2 a(a − T2 (N λ − 2λ1 )) (4.170)
≤ [Err(b
µ, µ)] + E
µ − b)0 (b
(b µ − b)
2
≤ [Err(b
µ, µ)] .
In particular, the lowest upper bound is reached at:
2
a≡ (N λ − 2λ1 ) . (4.171)
T
X ∼ N(µ, Σ) . (4.172)
Write a MATLAB
R
script in which you generate a time series of T ≡ 30 observations from (4.172) and
compute the shrinkage estimator of location (4.138, AM 2005).
Solution of E 166
See the MATLAB
R
script S_ShrinkageEstimators.
rank(Σ)
b <T. (4.173)
b = 1 X0
Σ
1
IT − 1T 10T XT ×N , (4.174)
T T ×N T
where XT ×N is the matrix of past observations, I is the identity matrix and 1 is a vector of ones. From
this expression and the property (A.22, AM 2005) of the rank operator we obtain:
1 0 1 0
rank(Σ) ≤ min rank IT − 1T 1T , rank(XT ×N ) ≤ rank IT − 1T 1T = T − 1 < T .
b
T T
(4.175)
Hint. Determine a grid of values for the number of observations T in the time series. For each value of T :
a) Generate an i.i.d. time series iT ≡ {x1 , . . . , xT } from X ∼ N(µ, Σ);
b) Compute the sample covariance Σ; b
c) Perform the PC decomposition of Σ b and store the sample eigenvalues (i.e. the sample spectrum);
d) Perform a)-c) a large enough number of times (≈ 100 times);
e) Compute the average sample spectrum.
Solution of E 168
See the MATLAB
R
script S_EigenvalueDispersion.
S
λN Σ
b
λN (Σ)
b
S > . (4.176)
λ1 Σ
b λ1 (Σ)
b
First we notice that the highest eigenvalue of the shrinkage estimator satisfies:
S
λ1 Σ
b < λ1 (Σ)
b . (4.177)
To show this, we first prove that for arbitrary positive symmetric matrices A and B and positive number
α and β we have:
This is true because from (A.68, AM 2005) the largest eigenvalue of a matrix A satisfies:
S
λ1 Σ
b ≡ λ1 (1 − α)Σ
b + αC
b
≤ (1 − α)λ1 (Σ)
b + αλ1 (C)
b (4.180)
h i
b − α λ1 (Σ)
= λ1 (Σ) b − λ1 (C)
b < λ1 (Σ)
b ,
N
b ≡ 1
X
λ1 (Σ)
b > λ1 (C) λn (Σ)
b . (4.181)
N n=1
S
λN Σ
b > λN (Σ)
b , (4.182)
which follows from the above argument and the reverse identities (A.69, AM 2005) and
N
b ≡ 1
X
λN (Σ)
b < λN (C) λn (Σ)
b . (4.183)
N n=1
E 170 – Shrinkage estimator of scatter
Write a MATLAB
R
function which computes the shrinkage estimator of the scatter (4.160, AM 2005).
Solution of E 170
See the MATLAB
R
script S_ShrinkageEstimators.
Z
0= ψ(x, θ
e [h])h(x)dx , (4.184)
RN
where h is a generic function. We consider the function h ≡ (1 − )fX + δ (y) . Deriving in zero (4.184)
with respect to we obtain:
Z
d h
e [h ]) (1 − )fX (x) + δ (y) (x) dx
i
0= ψ(x, θ
d =0 RN
Z Z
∂ψ(x, θ) dθe [h ] h i
e [fX ]) −fX (x) + δ (y) (x) dx
= fX (x)dx + ψ(x, θ (4.185)
∂θ θ[f d
RN e X] RN
=0
Z
∂ψ(x, θ) dθ
e [h ]
= f (x)dx + ψ(y, θe [fX ]) .
∂θ θ[f d
RN e X]
=0
On the other hand, from the definition (4.185, AM 2005) of the influence function we have:
1 e dθ
e [h ]
IF(y, fX , θ) ≡ lim
b θ [h ] − θ [h0 ] =
e . (4.186)
→0 d
=0
Therefore:
"Z #−1
b =− ∂ψ(x, θ)
IF(y, fX , θ) f (x)dx ψ(y, θ
e [fX ]) . (4.187)
RN ∂θ θ[f e X]
e [fi ] ≡ G [fi ] .
G (4.188)
T T
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 133
Therefore from its definition (4.185, AM 2005) the influence function reads:
1 h i
b ≡ lim
IF(y, fX , G) G (1 − )fX + δ (y) − G [fX ] , (4.189)
→0
where y is an arbitrary point. Now consider the function h ≡ (1 − )fX + δ (y) . The influence function
can be written:
b ≡ lim 1 dG [h ]
IF(y, fX , G) (G [h ] − G [h0 ]) = . (4.190)
→0 d =0
Z
e [h] ≡
µ xh(x)dx . (4.191)
RN
de
µ [h ]
b) ≡
IF(y, f, µ . (4.192)
d =0
First we compute:
Z
e [h ] ≡
µ xh (x)dx
N
ZR
= x (1 − )fX (x) + δ (y) (x) dx
RN
Z (4.193)
= (1 − ) xfX (x)dx + y
RN
= E {X} + (− E {X} + y) .
b ) = −E {X} + y .
IF(y, fX , µ (4.194)
e [fi ] ≡ G [fi ] .
G (4.195)
T T
Therefore from its definition (4.185, AM 2005) the influence function reads:
1 h i
b ≡ lim
IF(y, fX , G) G (1 − )fX + δ (y) − G [fX ] , (4.196)
→0
1 dG [h ]
IF(y, fX , G) ≡ lim (G [h ] − G [h0 ]) =
b . (4.198)
→0 d =0
Z
e [h] ≡
µ xh(x)dx . (4.199)
R
de
µ [h ]
b) ≡
IF(y, f, µ . (4.200)
d =0
First we compute:
Z
e [h ] ≡
µ xh (x)dx
ZR
= x (1 − )f (x) + δ (y) (x) dx
R
Z (4.201)
= (1 − ) xf (x)dx + y
R
= E {X} + (− E {X} + y) .
b) = − E {X} + y .
IF(y, f, µ (4.202)
e [fi ] ≡ G [fi ] .
G (4.203)
T T
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 135
Therefore from its definition (4.185, AM 2005) the influence function reads:
where y is an arbitrary point. Now consider the function h ≡ (1 − )fX + δ (y) . The influence function
can be written:
1 dG [h ]
IF(y, fX , G) ≡ lim (G [h ] − G [h0 ]) =
b . (4.205)
→0 d =0
Z
e [h] ≡
Σ (x − µ e [h])0 h(x)dx .
e [h])(x − µ (4.206)
RN
1
b ≡ lim (Σe [h ] − Σ dΣe [h ]
IF(y, fX , Σ) e [h0 ]) = . (4.207)
→0 d
=0
First we compute:
Z
e [h ] ≡
Σ (x − µ e [h ])0 h (x)dx
e [h ])(x − µ
RN
Z
= (x − µe [h ])(x − µe [h ])0 (1 − )fX (x) + δ (y) (x) dx (4.208)
RN
Z
= (1 − ) (x − µ e [h ])(x − µe [h ])0 fX (x)dx + (y − µ e [h ])0 .
e [h ])(y − µ
RN
dΣe [h ]
IF(y, f, Σ) =
b
d
=0
Z
= − (x − µ e [h0 ])0 fX (x)dx
e [h0 ])(x − µ
RN
(4.209)
Z
d
+ (1 − 0) (x − µ e [h ])0 fX (x)dx
e [h ])(x − µ
RN d =0
+ (y − µ e [h0 ])0
e [h0 ])(y − µ
d
+0× (y − µ e [h ])0 .
e [h ])(y − µ
d =0
Z
b = − Cov {X} − 2
IF(y, fX , Σ) (y − E {X})(x − E {X})0 fX (x)dx
RN (4.211)
0
+ (y − E {X})(y − E {X})
The term in the middle is null:
Z Z
(y − E {X})(x − E {X})0 fX (x)dx = y (x − E {X})0 fX (x)dx
RN RN
Z
(4.212)
− E {X} (x − E {X})0 fX (x)dx
RN
=0
Therefore:
Z
2
e [h] ≡
σ e [h])2 h(x)dx .
(x − µ (4.214)
R
σ 2 [h ]
2 1 2 2 de
b ) ≡ lim (e
IF(y, fX , σ σ [h ] − σ
e [h0 ]) = . (4.215)
→0 d =0
First we compute:
Z
2
e [h ] ≡
σ e [h ])2 h (x)dx
(x − µ
R
Z
= e [h ])2 ((1 − )fX (x) + δ (y) (x))dx
(x − µ (4.216)
R
Z
= (1 − ) (x − µ e [h ])2 fX (x)dx + (y − µ
e [h ])2 .
R
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 137
σ 2 [h ]
2 de
IF(y, fX , σ
b )=
d =0
Z
= − (x − µ e [h0 ])2 fX (x)dx
R
Z (4.217)
d
+ (1 − 0) (x − µ e [h ])2 fX (x)dx
R d =0
2 d
+ (y − µ e [h0 ]) + 0 × (y − µ e [h ])2 .
d =0
Z
de
µ [h ]
b2 ) = − Var {X} −
IF(y, fX , σ 2 (x − E {X})fX (x)dx (4.218)
R d =0
2
+ (y − E {X}) . (4.219)
Z
2
b ) = − Var {X} − 2
IF(y, fX , σ (y − E {X})(x − E {X})fX (x)dx
R (4.220)
+ (y − E {X})2 .
Z Z −1
G [fZ ] = xf 0 fZ (z)dz ff 0 fZ (z)dz . (4.222)
Consider a point w ≡ (e
x, e
f ). We have:
h i
G fZ + (δ (w) − fZ ) = (A + B)(C + D)−1 , (4.223)
where:
Z
A≡ xf 0 fZ dz = E {XF0 } (4.224)
Z
B≡ xf 0 (δ (w) − fZ )dz = x
eef 0 − E {XF0 } (4.225)
Z
C≡ ff 0 fZ dz = E {FF0 } (4.226)
Z
D≡ ff 0 (δ (w) − fZ )dz = ef 0 − E {FF0 } .
fe (4.227)
Since:
we have:
h i
G fZ + (δ (w) − fZ ) ≈ (A + B)(C−1 − C−1 DC−1 )
(4.229)
≈ AC−1 + (BC−1 − AC−1 DC−1 ) .
Therefore:
E 177 – Expectation-Maximization algorithm for missing data: formulas (www.4.8) *
Explain and detail the steps of the EM algorithm for missing data in Meucci (2005, section 4.6.2). In
particular prove (4.262, AM 2005), (4.263, AM 2005) and (4.264, AM 2005).
Solution of E 177
Suppose we are at iteration step u (cycle of the EM algorithm). The invariants are normally distributed
with the following parameters:
n o
(u)
µt,n ≡ E Xt,n |xt,obs(t) , µ(u) , Σ(u) . (4.232)
(u)
µt,obs(t) = xt,obs(t) (4.233)
n o
(u)
St ≡ E Xt X0t |xt,obs(t) , µ(u) , Σ(u) (4.235)
n o
(u)
St,obs(t),obs(t) ≡ E Xt,obs(t) X0t,obs(t) |xt,obs(t) , µ(u) , Σ(u)
h ih i0 (4.236)
(u) (u)
= xt,obs(t) x0t,obs(t) = µt,obs(t) µt,obs(t) ,
n o
(u)
St,mis(t),obs(t) ≡ E Xt,mis(t) X0t,obs(t) |xt,obs(t) , µ(u) , Σ(u)
n o
= E Xt,mis(t) |xt,obs(t) , µ(u) , Σ(u) x0t,obs(t) (4.237)
h ih i0
(u) (u) (u)
= µt,mis(t) x0t,obs(t) = µt,mis(t) µt,obs(t) ,
and:
n o
(u)
St,mis(t),mis(t) ≡ E Xt,mis(t) X0t,mis(t) |xt,obs(t) , µ(u) , Σ(u)
n o n o0
= E Xt,mis(t) |xt,obs(t) , µ(u) , Σ(u) E Xt,mis(t) |xt,obs(t) , µ(u) , Σ(u)
n o
+ Cov Xt,mis(t) |xt,obs(t) , µ(u) , Σ(u)
h ih i0
(u) (u) (u) (u) (u) (u)
= µt,mis(t) µt,mis(t) + Σmis(t),mis(t) − Σmis(t),obs(t) (Σobs(t),obs(t) )−1 Σobs(t),mis(t) .
(4.238)
(u) (u)
Ct,obs(t),mis(t) ≡ 0 , Ct,obs(t),obs(t) ≡ 0 , (4.239)
and otherwise:
(u) (u) (u) (u) (u)
Ct,mis(t),mis(t) ≡ Σmis(t),mis(t) − Σmis(t),obs(t) (Σobs(t),obs(t) )−1 Σobs(t),mis(t) , (4.240)
we can write:
h ih i0
(u) (u) (u) (u)
St = µt µt + Ct . (4.241)
Now we can update the estimate of the unconditional first moment as the sample mean of the conditional
first moments:
T
(u+1) 1 X (u)
µ ≡ x . (4.242)
T t=1 t
Similarly we can update the estimate of the unconditional second moment as the sample mean of the
conditional second moments:
T
1 X (u)
S(u+1) ≡ S . (4.243)
T t=1 t
h ih i0 h ih i0
Σ(u+1) ≡ S(u+1) − µ(u+1) µ(u+1) ≈ S(u+1) − µ(u) µ(u) . (4.244)
T
1 X h (u) (u) (u)
i
Σ(u+1) ≡ Ct + (xt − µ(u) )(xt − µ(u) )0 . (4.245)
T t=1
Xt ∼ N(µ, Σ) , (4.246)
and estimate the parameters (µ, Σ) by means of the EM algorithm.
Note. There is a typo in (4.266, AM 2005), which should read:
T
1 X h (u) (u) (u)
i
Σ(u+1) ≡ Ct + (xt − µ(u) )(xt − µ(u) )0 . (4.247)
T t=1
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 141
Solution of E 178
See the MATLAB
R
script S_ExpectationMaximizationHighYield.
V ≡ αY + (1 − α)Z , (4.251)
Determine if (4.248) is the pdf of (4.251)? If not, how do you compute the pdf of (4.251)?
Solution of E 179
Formula (4.248) is not the pdf of (4.251). You can see this in simulation. Alternatively, you can prove it
by showing that the moments of X and the moments of V are different. For instance, denote:
s2Y ≡ E Y 2 , s2Z ≡ E Z 2 .
(4.254)
Then:
Z
E X2 ≡ u2 fX (u)du
Z Z
= α u fY (u)du + (1 − α) u2 fZ (u)du
2 (4.255)
= αs2Y + (1 − α)s2Z .
E V 2 ≡ E (αY + (1 − α)Z)2
d
X ≡ BY + (1 − B)Z , (4.257)
B ∼ Ber(α) , (4.258)
1 with probability α
B≡ (4.259)
0 with probability 1 − α .
where δ (s) is the Dirac delta centered in s. When B = 1 in (4.257) the variable X will be normal as in
(4.252), when B = 0 the variable X will be lognormal as in (4.253). Therefore, the pdf of X conditioned
on B reads:
This two-step method gives rise to the pdf (4.248). To see this, as in (2.22, AM 2005) the pdf of X can
be written as the marginalization of the joint pdf of X and B:
Z
fX (x) = fX,B (x, b)db . (4.262)
As in (2.43, AM 2005) the joint pdf of X and B can be written as the product of the conditional and the
marginal:
Therefore:
Z
fX (x) = fX|B (x|b)fB (b)db
Z h i
= fX|B (x|b) αδ (1) (b) + (1 − α)δ (0) (b) db
Z Z (4.264)
(1)
= α fX|B (x|b)δ (b)db + (1 − α) fX|B (x|b)δ (0) (b)db
As for the pdf of (4.251), it can be obtained as follows. First we use (1.13) with (1.67, AM 2005) and
(1.95, AM 2005) to compute the pdf of αY and (1 − α)Z:
(x/α − µY )2
1
fαY (x) = exp − (4.265)
2σY2
p
α 2πσY2
(ln(x/(1 − α)) − µZ )2
1
f(1−α)Z (x) = p exp − 2 . (4.266)
2
x 2πσZ 2σZ
Then we compute the characteristic functions of αY and (1 − α)Z as in (1.14, AM 2005) as the Fourier
transform of the respective pdf’s:
φαY = F [fαY ] , φ(1−α)Z = F f(1−α)Z . (4.267)
Then we compute the characteristic function of V :
φV (ω) ≡ E eiωV
n o
= E eiω[αY +(1−α)Z]
n o
(4.268)
= E eiωαY E eiω(1−α)Z
φV (ω) = F fαY ∗ f(1−α)Z (ω) . (4.269)
Then we compute the pdf of V as in (1.15, AM 2005) as the inverse Fourier transform of the characteristic
function:
fV = F −1 [φV ] . (4.270)
Substituting (4.269) in (4.270) we finally obtain:
Z
G[fX ] ≡ (x2 − x)fX (x)dx . (4.272)
R
2
2 σZ
G[fX ] = α(µ2Y + σY2 − µY ) + (1 − α) e2µZ +2σZ − eµZ + 2 . (4.274)
b a ≡ (x1 − xT )x22
G (4.275)
T
bb ≡ 1
X
G xt (4.276)
T t=1
bc ≡ 5 .
G (4.277)
Write a MATLAB
R
script in which you evaluate the performance of the three estimators above with
respect to (4.272) as in the MATLAB
R
script S_Estimator by assuming:
Z
G[fX ] ≡ (x2 − x)fX (x)dx (4.280)
R
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 145
Z Z Z
bd ≡
G (x2 − x)fiT (x)dx = x2 fiT (x)dx − xfiT (x)dx . (4.281)
R R R
Z T
1X
b ≡
m xfiT (x)dx = xt . (4.282)
R T t=1
Z T
2 1X 2
cs ≡
n x fiT (x)dx = x . (4.283)
R T t=1 t
cs = sb2 + m
n b2 , (4.284)
T
1X
sb2 ≡ b 2.
(xt − m) (4.285)
T t=1
Therefore:
G
bd = n b = sb2 + m
cs − m b2 − m
b. (4.286)
Solution of E 183
See the MATLAB
R
script S_EstimateQuantileEvaluation.
Set µY ≡ 0.1 and generate a sample of T ≡ 52 i.i.d. observations from the distribution (4.248).
Hint. Feed a uniform sample into the MATLAB
R
function QuantileMixture.
Solution of E 184
See the MATLAB
R
function QuantileMixture and the script S_GenerateMixtureSample.
where I [·] is the integration operator and p ≡ 0.5. Notice that the above is simply the quantile with
confidence p, see (1.8, AM 2005) and (1.17, AM 2005):
Compute the non-parametric estimator qbp of (4.288) defined by (4.36, AM 2005) in Meucci (2005). Write
a MATLAB
R
script in which you assume:
and evaluate the performance of qbp with respect to (4.288) as in the script S_Estimator by stress-testing
the parameter µY in the range [0, 0.2].
Hint. Use the MATLAB
R
function QuantileMixture.
Solution of E 185
From (4.39, AM 2005) in Meucci (2005), the non-parametric estimator of the median is the sample
median (1.130, AM 2005):
b e ≡ x[T /2]:T .
G (4.291)
function PerformIidAnalysis;
• Compute numerically the maximum likelihood estimator θbM L of θ, where you assume that X is an
invariant, fX denotes the unknown pdf that represents the unknown distribution of each realization
in the time series, and make the following assumption on the generating process for X, where we
use the notation of (1.79, AM 2005) and (1.95, AM 2005):
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 147
(
Ca
fθ,θ 2 for θ ∈ [−0.04, −0.01]
fX ≈ fθ ≡ LogN (4.292)
fθ,(θ−0.01)2 for θ ∈ {0.02} ∪ {0.03} .
Hint. Approximate the continuum [−0.04, −0.01] with a fine set of equally spaced points; evaluate the
(log-)likelihood for every value of θ.
Solution of E 186
See the MATLAB
R
script S_MaximumLikelihood.
Therefore, the ML estimator of the quantile is the functional applied to the ML-estimated distribution:
h i
qbpM L ≡ qp fθbM L . (4.294)
On the other hand, as in (4.36, AM 2005) the non-parametric quantile is the functional applied to the
empirical pdf:
Solution of E 187
See the MATLAB
R
script S_MaximumLikelihood.
E 188 – Maximum likelihood estimation of a multivariate Student t distribution *
Consider Student t invariants X ∼ St(ν, µ, Σ). Assume ν known and use (4.80, AM 2005)-(4.82, AM
2005). Write a MATLAB
R
script in which you:
• Upload the database DB_UsSwapRates of the daily time series of par 2yr, 5yr and 10yr swap rates;
• Compute the invariants relative to a daily estimation interval;
• Estimate the expectation and the covariance relative to the 2yr and the 5yr rates under the assump-
tion that ν ≡ 3 and ν ≡ 100 respectively;
• Represent the two sets of expectations and the covariances in one figure in terms of the ellipsoid;
• Scatter-plot the observations.
Hint. First compute the generator g that appears in the weighting function (4.79, AM 2005). Under the
Student t assumption the pdf is (2.188, AM 2005) and the generator follows accordingly.
Solution of E 188
First we have to compute the generator g that appears in the weighting function (4.79, AM 2005). Under
the Student t assumption the pdf is (2.188, AM 2005). Thus, as in (2.188, AM 2005) the generator reads:
Γ( ν+N
2 )
z −
ν+N
2
g(z) ≡ N 1+ . (4.296)
Γ( ν2 )(νπ) 2 ν
Hence the weighting function (4.79, AM 2005) reads:
g 0 (z) ν+N
w(z) ≡ −2 = . (4.297)
g(z) ν+z
Therefore the weights (4.80, AM 2005) read:
ν+N
wt ≡ . (4.298)
ν + (xt − µ b −1 (x − µ
b )0 Σ b)
For the implementation, see the MATLAB
R
function MleRecursionForStudentT and the script S_FitSwapToStudentT.
1
Y≡√ (X + X0 ) . (4.299)
8N
Consider the eigenvalues λ1 , . . . , λN of Y and the density that they define:
N
1 X (λn )
h≡ δ , (4.300)
N n=1
where δ is the Dirac delta (B.18, AM 2005). Notice that, since (4.299) is random, so is the function
(4.300). According to random matrix theory, in some topology the following limit for the random function
h holds
lim h = g , (4.301)
N →∞
2p
g(λ) ≡ 1 − λ2 . (4.302)
π
Write a MATLAB
R
script that shows (4.301) when the distribution fX is standard normal, shifted/rescaled
normal, and shifted/rescaled exponential.
Hint. Choose a large N and simulate (4.299) once. This is a realization of (4.299). Compute the realized
eigenvalues and the respective realization of h defined in (4.300). Approximate h with a histogram. Show
that the histogram looks similar to g defined in (4.302).
CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 149
Solution of E 189
See the MATLAB
R
script S_SemiCircular.
1 0
Y≡ X X. (4.303)
T
Consider the eigenvalues λ1 , . . . , λN of Y and the density that they define:
N
1 X (λn )
h≡ δ , (4.304)
N n=1
where δ is the Dirac delta (B.18, AM 2005). Notice that, since (4.303) is random, so is the function
(4.304). According to random matrix theory, in some topology the following limit for the random function
h holds:
lim h = gq , (4.305)
N ≡qT →∞
1
q
gq (λ) ≡ (λq − λ)(λ − λq ) , (4.306)
2qπλ
for λmin ≤ λ ≤ λmax where:
√ √
λq ≡ (1 − q)2 , λq ≡ (1 + q)2 . (4.307)
Write a MATLAB
R
script that shows (4.306) when the distribution fX is standard normal, shifted/rescaled
normal, and shifted/rescaled exponential.
Solution of E 190
See the MATLAB
R
script S_PasturMarchenko.
2
Xt ∼ LogN(µX , σX )
(4.308)
Ft ∼ Ga(νF , σF2 ) ,
and the copula is the copula of the diagonal entries of Wishart distribution:
Wt ∼ W(νW , ΣW ) . (4.309)
Consider the coefficients that define the regression line (3.127, AM 2005):
et ≡ α + βFt .
X (4.310)
√ α − α)
(b
bα ≡
G T − 2p , (4.311)
b2 σ
σ bα2
√ (βb − β)
bβ ≡
G T − 2q ; (4.312)
bβ2
b2 σ
σ
• Compare the empirical distribution of (4.311) with the analytical distribution of (4.58) as well as
the empirical distribution of (4.312) with the analytical distribution of (4.59) and comment.
Solution of E 193
See the MATLAB
R
script S_TStatApprox. The distribution of (4.311) is very similar to that of (4.58) even
for relatively small values of T . The same holds for the distribution of (4.312) as compared to that of
(4.59).
Chapter 5
Evaluating allocations
(n)
1
PT +τ ≈ g (n) (0) + X0 ∂x g (n) + X0 ∂xx
2
g (n) X, (5.1)
x=0 2 x=0
where n = 1, . . . , N . From (5.11, AM 2005) the market is an invertible affine transformation of the
prices, i.e.:
N
X N
X
M (n)
≈ an + Bnm g (m)
(0) + Bnm X0 ∂x g (m)
x=0
m=1 m=1
(5.2)
N
1 X
+ Bnm X0 ∂xx
2
g (m) X.
2 m=1 x=0
In turn, from (5.10, AM 2005) the objective is a linear combination of the market:
N
X
Ψα ≡ αn M (n)
n=1
N
X N
X N
X
≈ αn an + αn Bnm g (m) (0)
n=1 n=1 m=1
(5.3)
N
X N
X h i
+ αn Bnm X0 ∂x g (m)
x=0
n=1 m=1
N N
1X X h i
+ αn Bnm X0 ∂xx
2
g (m) X ... .
2 n=1 m=1
x=0
151
In other words:
1
Ψα ≈ Ξα ≡ θ + ∆0α X + X0 Γα X , (5.4)
2
where:
N
X N
X
θ≡ αn an + αn Bnm g (m) (0) (5.5)
n=1 n,m=1
N
X
∆α ≡ αn Bnm ∂x g (m) (5.6)
x=0
n,m=1
N
X
2
Γα ≡ αn Bnm ∂xx g (m) . (5.7)
x=0
n,m=1
Assume now that the K-dimensional invariants X are normally distributed as in (5.29, AM 2005). Then
we can compute explicitly the characteristic function of the approximate objective (5.4). Defining:
Z ≡ X − µ ∼ N(0, Σ) , (5.8)
1
Ξα = θ + ∆0α (µ + Z) + (µ + Z)0 Γα (µ + Z)
2
0 0 1 1
= θ + ∆α µ + ∆α Z + µ0 Γα µ + µ0 Γα Z + Z0 Γα Z (5.9)
2 2
0 1 0
= bα + wα Z + Z Γα Z ,
2
where:
1
bα ≡ θ + ∆0α µ + µ0 Γα µ (5.10)
2
wα ≡ ∆α + Γα µ . (5.11)
Σ ≡ BB0 , (5.12)
B0 Γα B = EΛE0 , (5.13)
C ≡ BE , (5.14)
Finally we define:
∆ ≡ C0 w . (5.16)
In these terms and dropping the dependence on α from the notation, (5.9) becomes:
1
Ξα = b + w0 CC−1 Z + Z0 (C0 )−1 C0 ΓCC−1 Z
2
0 1 0 0
= b + ∆ Y + YE B ΓBEY
2
0 1 (5.17)
= b + ∆ Y + YE0 EΛE0 EY
2
K
X 1
=b+ (δk Yk + λk Yk2 ) .
2
k=1
Z h P
λk 2
i
iΞω
iω b+ K
k=1 (δk yk + 2 yk )
φΞ (ω) ≡ E e = e f (y)dy , (5.18)
RN
where f is the standard normal density (2.156, AM 2005), which factors into the product of the marginal
densities:
K
Y √ 1 2
f (y) = 2πe− 2 yk . (5.19)
k=1
K
Y
φΞ (ω) = eiωb G(δk , λk ) , (5.20)
k=1
where:
Z +∞
1 λ 2 y 2
G(δ, λ) ≡ √ eiω[δy+ 2 y ] e− 2 dy . (5.21)
2π −∞
Since:
!
1 − iωλ 2 1 − iωλ iωδ
iωδy − y = − y2 − 1−iωλ
y
2 2 2
" #2
1 − iωλ iωδ
= − y − 1−iωλ
2 2 2
!2 (5.22)
1 − iωλ iωδ
+
2 2 1−iωλ
2
2
(ωδ)2
1 − iωλ iωδ
= − y− − ,
2 1 − iωλ 2(1 − iωλ)
we obtain:
Z +∞
1 1−iωλ
[y− 1−iωλ
iωδ
]
2 (ωδ) 2
G(δ, λ) = √ e− 2 − 2(1−iωλ)
dy
2π −∞
+∞
r Z
1 (ωδ)2 1 1−iωλ
[y− 1−iωλ
iωδ 2
] dy
= e− 2(1−iωλ) q e− 2
(5.23)
1 − iωλ −∞ 2π
1−iωλ
1 δ2 ω2
=√ e− 2(1−iλω) .
1 − iλω
Substituting this back into (5.20) we finally obtain the expression of the characteristic function:
eiωb − 21
PK 2 ω2
δk
φΞ (ω) = qQ e k=1 (1−iλk ω)
K
k=1 (1 − iωλk ) (5.24)
− 12 − 12 ∆0 (I−iωΛ)−1 ω 2
= |IK − iωΛ| eiωb e .
Therefore, substituting (5.25) and (5.27) in (5.24) we obtain the characteristic function of the approximate
objective:
− 21 1 0 −1
wω 2
φΞ (ω) = |IK − iωΓΣ| eiωb e− 2 w Σ(IK −iωΓΣ) . (5.28)
− 21 0 1 0
φΞ (ω) = |IK − iωΓΣ| eiω(θ+∆ µ+ 2 µ Γµ)
0 −1
(5.29)
1
(∆+Γµ)ω 2
× e− 2 (∆+Γµ) Σ(IK −iωΓΣ) .
1
φΞα (ω) = v − 2 eu , (5.30)
where:
1
u(ω) ≡ iωb − w0 Σ(I − iωV)−1 w
2 (5.31)
v(ω) ≡ |I − iωV| ,
and:
w ≡∆+Γ
(5.32)
V ≡ ΓΣ .
To show how this works we explicitly compute the first three derivatives. It is easy to implement this
approach systematically up to any order with by programming a software package such as Mathematica
R
.
The first three derivatives of the characteristic function read:
1 3 1
φ0Ξ (ω) = − v − 2 v 0 eu + v − 2 eu u0
2
3 5 1 3 3 1 1
φ00Ξ (ω) = v − 2 (v 0 )2 eu − v − 2 v 00 eu − v − 2 v 0 eu u0 + v − 2 eu (u0 )2 + v − 2 eu u00
4 2
15 − 7 0 3 u 3 − 5 0 00 u 3 − 5 0 2 u 0
φ000
Ξ (ω) = − v 2 (v ) e + v 2 2v v e + v 2 (v ) e u
8 4 4
3 − 5 0 00 u 1 − 3 000 u 1 − 3 00 u 0
+ v 2v v e − v 2v e − v 2v e u (5.33)
4 2 2
3 −5 0 2 u 0 3 3 3
+ v 2 (v ) e u − v − 2 v 00 eu u0 − v − 2 v 0 eu (u0 )2 − v − 2 v 0 eu u00
2
1 3 1 1
− v − 2 v 0 eu (u0 )2 + v − 2 eu (u0 )3 + 2v − 2 eu u0 u00
2
1 3 1 1
− v − 2 v 0 eu u00 + v − 2 eu u0 u00 + v − 2 eu u000 .
2
These expressions depend on the first three derivatives of u and v, which we obtain by applying the
following generic rules that apply for any conformable matrices M, A, B:
1
u(ω) ≡ iωb − w0 Σ(I − iωV)−1 w
2
1
u0 (ω) = ib − w0 Σ(I − iωV)−1 [−iV] (I − iωV)−1 w
2
u (ω) = −w Σ(I − iωV)−1 [−iV] (I − iωV)−1 [−iV] (I − iωV)−1 w
00 0
u000 (ω) = −3w0 Σ(I − iωV)−1 [−iV] (I − iωV)−1 [−iV] (I − iωV)−1 [−iV] (I − iωV)−1 w ,
(5.37)
and:
CHAPTER 5. EVALUATING ALLOCATIONS 157
v(ω) ≡ |I − iωV|
v(ω)0 = |I + iωV| tr (I + iωV)−1 (iV)
1
u ≡ − w0 Σw
2
1
u = i(b + w0 ΣVw)
0
(5.39)
2
u00 = w0 ΣV2 w
u000 = −i3w0 ΣV3 w ,
and:
v≡1
v 0 = i tr(V)
2 (5.40)
v 00 = − [tr(V)] + tr(V2 )
3
v 000 = −i [tr(V)] + 3i tr(V) tr(V2 ) − 2i tr(V3 ) .
These values must be substituted in (5.33) to yield the expressions of the first three non-central moments
as in E 18. For example, the first moment is:
1 3 1
E {Ξα } = i−1 φ0Ξα (0)
=i −1
− v − 2 v 0 eu + v − 2 eu u0
2
(5.41)
1 0
− 2 w Σw 1 0 1
=e (b + w ΣVw) − tr(V) .
2 2
Finally, the explicit dependence on allocation comes from substituting in the final expression (5.10),
(5.11) and (5.32).
E 196 – Estimability and sensibility imply consistence with weak dominance (www.5.2)
Show that estimability and sensibility imply consistence with weak dominance.
Solution of E 196
Assume that Ψα weakly dominates Ψβ . From the definition (5.36, AM 2005), this means that for all
u ∈ (0, 1) the following inequality holds:
QΨα (u) ≥ QΨβ (u) . (5.42)
From the definition of estimability (5.52, AM 2005), the index must be a function of the distribution of
the objective, as represented, say, by the cdf:
From (2.27, AM 2005) the random variable X defined below has the same distribution as the objective:
d
Xα ≡ QΨα (U ) = Ψα , U ∼ U([0, 1]) . (5.45)
Thus:
S(β) = G FΨβ = G FXβ . (5.48)
On the other hand, from (5.42) in all scenarios Xα ≥ Xβ , i.e. Xα strongly dominates Xβ . Therefore,
from the sensibility of S we must have:
G [FXα ] ≥ G FXβ . (5.49)
S(α) = G [FXα ] ≥ G FXβ = S(β) . (5.50)
Solution of E 197
Assume that an index of satisfaction is translation invariant:
α b α b
S(α + λb) = S ψb +λ = ψb S +λ
ψb ψb ψb ψb
(5.53)
α α
= ψb S + λ = S ψb + λψb = S(α) + λψb .
ψb ψb
In particular:
S(b) = ψ b , (5.55)
which is the constancy property (5.62, AM 2005).
Z +∞ Z 1
E {u(Ψ)} = u(ψ)fψ (ψ)dψ = u(QΨ (s))ds . (5.56)
−∞ 0
u(ψ) ≡ ψ β . (5.64)
Z Z Z
1 y
E {u(λΨ)} = y β fλΨ (y)dy = y β fΨ dy = λβ ψ β fΨ (ψ)dψ = λβ E {u(Ψ)} . (5.65)
R R λ λ R
1
u−1 (z) = z β , (5.66)
1 1 1
u−1 (E {u(λΨ)}) = [E {u(λΨ)}] β = λβ E {u(Ψ)} β = λ [E {u(Ψ)}] β = λu−1 (E {u(Ψ)}) . (5.67)
Solution of E 200
From its definition:
Ψα+λb = Ψα + λ , (5.70)
u = −e−βψ . (5.72)
Z Z
E {u(Ψ + λ)} = −e−βy fΨ+λ (y)dy = −e−βy fΨ (y − λ)dy
Z (5.73)
= e−βλ −e−βψ fΨ (ψ)dψ = e−βλ E {u(Ψ)} .
On the other hand the inverse of the exponential utility function reads:
ln(−z)
u−1 (z) = − . (5.74)
β
Therefore:
1
u−1 (E {u(Ψ + λ)}) = − ln(− [E {u(Ψ + λ)}])
β
1
= − ln(e−βλ [− E {u(Ψ)}])
β (5.75)
1
= λ − [ln([− E {u(Ψ)}])]
β
= λ + u−1 (E {u(Ψ)}) .
E 201 – Risk aversion/propensity of the certainty-equivalent and utility functions
(www.5.3)
Show that the certainty-equivalent index of satisfaction is a risk averse index of satisfaction if and only if
the utility function is concave, i.e. show (5.120, AM 2005).
Solution of E 201
Since we only deal with increasing utility functions from (5.99, AM 2005) to prove risk aversion we can
prove equivalently the following implication:
On the other hand, Jensen’s inequality states that for any random variable Ψ the following is true if and
only if u is concave:
Note. A similar solution links convexity of the utility function with risk propensity and linearity of the
utility function with risk neutrality.
Ψb = ψ b , E {Ψf } = 0 , (5.80)
we obtain:
Var {Ψf } 00
u(CE(b + f )) ≡ E {u(Ψb+f )} = E {u(ψb + Ψf )} ≈ u(ψb ) + u (ψb ) . (5.81)
2
On the other hand from the definition of risk premium (5.85, AM 2005), which we report here:
CE(b) = ψb , (5.83)
we obtain:
e + u0 (ψ)(ψ
u(ψ) = u(ψ) e e + 1 u00 (ψ)(ψ
− ψ) e e 2 + 1 u000 (ψ)(ψ
− ψ) e e 3 + ··· .
− ψ) (5.87)
2 3!
Taking expectations and pivoting the expansion around the objective’s expected value
ψe ≡ E {Ψ} , (5.88)
we obtain:
u00 (E {Ψ})
E {u(Ψ)} ≈ u(E {Ψ}) + Var {Ψ} , (5.89)
2
where the term in the first derivative cancels out. On the other hand, another Taylor expansion yields:
1
u−1 (z + ) ≈ u−1 (z) + . (5.90)
u0 (u−1 (z))
Substituting (5.89) in (5.90) we obtain:
u00 (E {Ψ})
u−1 (E {u(Ψ)}) ≈ u−1 (u(E {Ψ})) + Var {Ψ}
2u0 (u−1 (u(E {Ψ})))
(5.91)
u00
= E {Ψ} + 0 (E {Ψ}) Var {Ψ} ,
2u
so that the first-order approximation reads:
A(E {Ψα })
CE(α) ≈ E {Ψα } − Var {Ψα } . (5.92)
2
Z
∂α E {u(Ψα )} = ∂α u(ψα )fM (m)dm
RN
Z
(5.93)
= ∂α (ψα )u0 (ψα )fM (m)dm
RN
= E {∂α (Ψα )u0 (Ψα )} .
du−1
= (E {u(Ψα )})∂α E {u(Ψα )}
dz
1 (5.94)
= 0 −1 ∂α E {u(Ψα )}
u (u (E {u(Ψα )}))
E {u0 (Ψα )∂α (Ψα )}
= .
u0 (CE(α))
For example consider the case where the objective are the net gains:
Ψα ≡ α0 (PT +τ − pT ) . (5.95)
M ≡ PT +τ − pT , (5.96)
∂α (Ψα ) = M . (5.97)
Solution of E 205
We have:
PT +τ ∼ N(µ, Σ) . (5.98)
M ∼ N(ν, Σ) , ν ≡ µ − pT . (5.99)
ψ
u(ψ) ≡ erf √ . (5.100)
2η
r
2 − 2η
1
ψ2
u0 (ψ) = e . (5.101)
πη
Thus the numerator in (5.94) reads:
r
2 n (− 2η1
(α0 M)2 )
o
E {u0 (Ψα )∂α (Ψα )} = E e M
πη
r −1 Z
2 |Σ| 2 1 0 αα0 1 0 −1
= N me− 2 m ( η )m e− 2 (m−ν) Σ (m−ν) dm (5.102)
πη (2π) 2 RN
r −1 Z
2 |Σ| 2 1
= N me− 2 D(m) dm ,
πη (2π) 2 RN
where:
αα0
D(m) ≡ m 0
m + (m − ν)0 Σ−1 (m − ν)
η (5.103)
= (m − ξ)0 Φ−1 (m − ξ) + ν 0 Σ−1 ν − ξ 0 Φ−1 ξ ,
with:
−1 −1
αα0 αα0
ξ≡ + Σ−1 Σ−1 ν , Φ≡ + Σ−1 . (5.104)
η η
− 12 N − 12
|Σ| |Φ|
Z
CE(α)2 − 12 [ν 0 Σ−1 ν−ξ0 Φ−1 ξ] (2π)
η 2 1 0 −1
= N e 2 e − 21
m N e− 2 (m−ξ) Φ (m−ξ)
dm
(2π) 2 |Φ| RN (2π) 2
= γ(α)ξ ,
(5.105)
− 12
|Σ| η 2 0
Σ−1 ν−ξ0 Φ−1 ξ]
e 2 CE(α) e− 2 [ν
1
γ(α) ≡ − 12
|Φ|
− 12 (5.106)
|Σ|
h −1
i
CE(α) η 2 − 21 ν 0 (Σ−1 −Σ−1 [ η1 αα0 +Σ−1 ] Σ−1 )ν
= 12 e 2 e .
1 0 −1
η αα + Σ
−1
1
∂α CE(α) = γ(α) αα0 + Σ−1 Σ−1 (µ − pT ) . (5.107)
η
Z
0 0
∂α {u (Ψα )∂α0 (Ψα )} = ∂α u (ψα )∂α0 (ψα )fM (m)dm
RN
Z
(5.108)
fM (m) u0 (ψα )∂αα
2 00
= 0 (ψα ) + u (ψα )∂α (ψα )∂α0 (ψα )] dm
R N
= E u0 (Ψα )∂αα
2 00
0 (Ψα ) + u (Ψα )∂α (Ψα )∂α0 (Ψα ) .
Ψα = α 0 M , (5.110)
we obtain:
u0 (α0 M)
w≡E M . (5.112)
u0 (CE(α))
The denominator in (5.111) is always positive. On the other hand, the numerator in (5.111) can take
on any sign, depending on the local curvature of the utility function. Therefore the convexity of the
certainty-equivalent is not determined.
Solution of E 207
The certainty-equivalent of an allocation is the risk-free amount of money that would make the investor
as satisfied as the given risky allocation.
P1 ∼ N µ1 , σ12
(5.113)
µ2 , σ22
P2 ∼ N . (5.114)
Consider the case where the objective is final wealth. Consider an exponential utility function:
ψ
u (ψ) ≡ a − be− ζ , (5.115)
where b > 0. Compute analytically the certainty equivalent as a function of a generic allocation vector
(α1 , α2 ). What is the effect of a and b?
Solution of E 208
Consider the utility function (5.115). As in (5.92, AM 2005) expected utility reads:
n Ψα o i
E {u (Ψα )} ≡ a − b E e− ζ = a − bφΨα , (5.116)
ζ
where φ denotes the characteristic function (1.12, AM 2005) of the objective. The inverse of (5.115) is:
a−u
ψ ≡ u−1 (e
u) = −ζ ln
e
. (5.117)
b
Therefore the certainty equivalent reads:
i
CE (α) ≡ u−1 (E {u (Ψα )}) = −ζ ln φΨα , (5.118)
ζ
as in (5.94, AM 2005). The certainty equivalent is not affected by a and b. In other words, the certainty
equivalent is not affected by positive affine transformations of the utility function.
To compute the certainty equivalent as a function of the allocation vector we recall that lognormal and
normal copulas are the same, and we notice that normal marginals with a normal copula give rise to a
normal joint distribution:
P ∼ N (µ, Σ) , (5.119)
where:
σ12
µ1 ρσ1 σ2
µ≡ , Σ≡ . (5.120)
µ2 ρσ1 σ2 σ22
Therefore as in (5.144, AM 2005) we obtain:
1 0
CE (α) = α0 µ − α Σα . (5.121)
2ζ
Solution of E 210
Assume that an allocation b gives rise to a deterministic objective ψb . Then from (B.22, AM 2005) the
pdf of the objective is the Dirac delta centered at ψb and from (B.53, AM 2005) the cdf is the Heaviside
function (B.74, AM 2005) with step at ψb , which is not invertible. Thus the quantile is not defined.
Nonetheless, we can obtain the quantile using the smoothing technique (1.20, AM 2005). Indeed from
(B.18, AM 2005) the regularized pdf of the objective reads:
1 (ψ−ψb )2
fΨb ; (ψ) ≡ (δ (ψb ) ∗ δ(0) )(ψ) = √ e− 22 . (5.122)
2π
The respective regularized cdf reads:
Z ψ (x−ψb )2
1
FΨb ; (ψ) = √ e− 22 dx
2π −∞
ψ−ψb !
Z √
1 2 2
−y 2
= √ e dy (5.123)
2 π −∞
1 ψ − ψb
= 1 + erf √ ,
2 2
√
where we used the change of variable y ≡ (x − ψb )/ 2. The regularized quantile of the objective is
the inverse of the regularized cdf:
√
QΨb ; (s) ≡ FΨ−1
b ;
(s) = ψb + 2 erf −1 (2s − 1) . (5.124)
and the approximation becomes exact in the limit → 0. Thus the quantile (5.159, AM 2005) satisfies:
P {X ≤ QX } = s . (5.127)
If h is an increasing function then (5.127) is equivalent to the following identity:
P h(X) ≤ Qh(X) = s . (5.129)
Since (5.128) and (5.129) hold for any s we obtain the general result for any increasing function h:
Expression (5.136) and the additivity of the objective (5.17, AM 2005) prove the additive co-monotonicity
of the quantile-based index of satisfaction:
E 216 – Cornish-Fisher approximation of the quantile-based index of satisfaction
(www.5.4)
Prove the expression (5.180, AM 2005)-(5.181, AM 2005) of the Cornish-Fisher approximation of the
quantile-based index of satisfaction.
Solution of E 216
The Cornish-Fisher expansion (5.179, AM 2005) states that the quantile of the objective Ψα can be
approximated in terms of the quantile z(s) of the standard normal distribution and the first three moments
as follows:
CM3 {Ψα } CM3 {Ψα } 2
QΨα (s) ≈ E {Ψα } − + Sd {Ψα } z(s) + z (s) , (5.138)
6 Var {Ψα } 6 Var {Ψα }
where CM3 is the third central moment. Using (1.48) to express the central moments in terms of the raw
moments, we obtain the approximate expression of the quantile of the objective:
where:
3
E Ψ3α − 3 E Ψ2α E {Ψα } + 2 E {Ψα }
A ≡ E {Ψα } − 2 (5.140)
6(E {Ψ2α } − E {Ψα } )
q
2
B≡ E {Ψ2α } − E {Ψα } (5.141)
3 3
E Ψα − 3 E Ψ2α E {Ψα } + 2 E {Ψα }
C≡ 2 . (5.142)
6(E {Ψ2α } − E {Ψα } )
Note. To obtain the explicit analytical expression of these coefficients as functions of the allocation α we
use the derivatives of the characteristic function of the objective as discussed in E 194.
∂ Q(α)
= E {M|α0 M = Q(α)} . (5.143)
∂α
Solution of E 217
From the definition of quantile (1.18, AM 2005), the quantile-based index of satisfaction (5.159, AM
2005) is defined implicitly as follows:
Defining:
X
Xn ≡ αj Mj , (5.145)
j6=n
we see that Q(α) is defined implicitly as follows in terms of the joint pdf f of (Xn , Mn ):
Z "Z Q −αn mn
#
1 − c = P {Xn + an Mn ≤ Q} = f (xn , mn )dxn dmn . (5.146)
−∞
Since in general:
dg
Z g(a) Z g(a)+ da δa
∂ 1 dg(a)
f (x)dx = lim f (x)dx = f (g(a)) , (5.147)
∂a −∞ δa→0 δa g(a) da
Z
∂Q
0= f (Q −αn Mn , mn ) − mn dmn , (5.148)
∂αn
CHAPTER 5. EVALUATING ALLOCATIONS 173
or:
R
∂Q m f (Q −αn Mn , mn )dmn
= R n = E {Mn |Xn = Q(α) − αn Mn } . (5.149)
∂αn f (Q −αn Mn , mn )dmn
∂ Q(α)
= E {M|α0 M = Q(α)} . (5.150)
∂α
E 218 – Second-order sensitivity analysis of the quantile-based index of satisfaction
I (www.5.4) **
Prove the expression (5.191, AM 2005) of the second-order cross-derivatives of the quantile-based index
of satisfaction.
Solution of E 218
Consider now a small perturbation of the allocation α in the direction of the j-th security:
β = α + ∆(j) . (5.151)
2 1
∂ij Q(α) ≡ lim [∂i Q(β) − ∂i Q(α)] . (5.152)
→0
From (5.143) and (5.151) we see that:
n o
∂i Q(β) = E Mi |α0 M + Mj = Q(α + ∆(j) )
≈ E {Mi |α0 M + Mj = Q(α) + ∂j Q(α)} (5.153)
= E {Mi |α0 M − Q(α) + [Mj − ∂j Q(α)] = 0}
= E {Mi |α0 M − Q(α) + [Mj − E {Mj |α0 M . = Q(α)}] = 0}
we can write:
f (x, y, −y)
f (x, y|Z + Y = 0) = f (x, y|z = −y) = R . (5.157)
f (x, y, −y)dxdy
RR
xf (x, y, −y)dxdy
∂i Q(β) ≈ R R
f (x, y, −y)dxdy
RR RR
xf (x, y, 0)dxdy − xy∂z f (x, y, 0)dxdy
≈ RR RR
f (x, y, 0)dxdy − y∂z f (x, y, 0)dxdy
Z Z Z Z
= xf (x, y, 0)dxdy − xy∂z f (x, y, 0)dxdy
Z Z RR −1
y∂z f (x, y, 0)dxdy
× f (x, y, 0)dxdy 1− R R
f (x, y, 0)dxdy
Z Z Z Z
≈ xf (x, y, 0)dxdy − xy∂z [ln f (x, y, 0)] f (x, y, 0)dxdy (5.158)
Z Z −1
× f (x, y, 0)dxdy
RR
y∂z [ln f (x, y, 0)] f (x, y, 0)dxdy
× 1+ RR
f (x, y, 0)dxdy
RR RR
xf (x, y, 0)dxdy xy∂z [ln f (x, y, 0)] f (x, y, 0)dxdy
≈ RR − RR
f (x, y, 0)dxdy f (x, y, 0)dxdy
RR RR
y∂z [ln f (x, y, 0)] f (x, y, 0)dxdy xf (x, y, 0)dxdy
+ RR RR .
f (x, y, 0)dxdy f (x, y, 0)dxdy
Thus:
− E {Y |Z = z} ∂z [E {X|Z = z}]
Z Z
− E {X|Z = z} y∂z f (x, y|z)dxdy
Z Z (5.160)
= xy∂z [ln f (x, y|z)] f (x, y|z)dxdy
− E {Y |Z = z} ∂z [E {X|Z = z}]
Z Z
− E {X|Z = z} y∂z [ln f (x, y|z)] f (x, y|z)dxdy
∂i Q(β) ≈ E {X|Z = 0}
− [∂z [Cov {X, Y |Z = 0}] + E {Y |Z = 0} ∂z [E {X|Z = 0}] (5.162)
+ ∂z [ln fZ (0)] Cov {X, Y |Z = 0}] .
Therefore:
∂ 2 Q(α)
= − ∂z [Cov {M, M − E {M|α0 M = Q(α)} |z = 0}]
∂α0 ∂α
∂ ln fZ (0)
− Cov {M, M − E {M|α0 M = Q(α)} |z = 0}
∂z
∂ ln fZ (0)
= − ∂z [Cov {M|z = 0}] − Cov {M|z = 0} (5.166)
∂z
∂ Cov {M|α0 M = z}
= −
∂z
z=Q(α)
∂ ln fα0 M (Q(α))
− Cov {M|α0 M = Q(α)} .
∂z
E 219 – Second-order sensitivity analysis of the quantile-based index of satisfaction
II (www.5.4)
Discuss the sign of the matrix of the second-order cross-derivatives in the case of normal markets (5.192,
AM 2005).
Solution of E 219
To discuss the sign of the second derivative in the normal case we need the following result:
αα0 Σ β 0 Σαα0 Σβ
Σ I− 0 ≥ 0 ⇔ β 0 Σβ ≥
α Σα α0 Σα (5.167)
2
⇔ hα, αi hβ, βi ≥ |hα, βi|
where:
hα, βi ≡ α0 Σβ . (5.168)
The last row in (5.167) is true because of the Cauchy-Schwartz inequality (A.8, AM 2005).
M ∼ U(Eµ,Σ ) . (5.169)
Write the quantile index Qc (α) of the objective (5.10, AM 2005) as defined in (5.159, AM 2005) as a
function of the allocation.
CHAPTER 5. EVALUATING ALLOCATIONS 177
Solution of E 220
We can represent (5.169) in the notation (2.268, AM 2005) as follows:
U
M ∼ El µ, Σ, gN , (5.170)
U
where gN is provided in (2.263, AM 2005). From (2.270, AM 2005) we obtain:
Ψα ≡ α0 M ∼ El α0 µ, α0 Σα, g1U .
(5.171)
Therefore:
d √
Ψα = α0 µ + α0 ΣαX , (5.172)
where:
X ≡ El 0, 1, g1U ,
(5.173)
for some generator g1U induced by the N -dimensional uniform distribution. Therefore:
√
Qc (α) = α0 µ + α0 Σαγc , (5.175)
where the scalar γc ≡ QX (1 − c) can be evaluated numerically.
Solution of E 221
Deriving (5.175) we obtain:
∂ Qc (α) γc
=µ+ √ Σα . (5.176)
∂α α0 Σα
Therefore the marginal contributions C read:
∂ Qc (α) γc
C ≡ diag (α) = diag (α) µ + √ diag (α) Σα . (5.177)
∂α α0 Σα
It is immediate to check that:
N
X
Qc (α) ≡ Cn , (5.178)
n=1
∂ Qc (α) Qc α + δ (n) − Qc (α)
≈ , (5.179)
∂αn
where Qc (X) is calculated as in the previous point, δ (n) is the Kronecker delta (A.15, AM 2005),
and is a small number, as compared with the average size of the entries of α;
• Display the result using the built-in plotting function bar;
• Use the result above to compute Qc (α) in a different way, i.e. semi-analytically;
• Use the previous results to compute the marginal contributions to Qc (α) from each security;
• Display the result using the built-in plotting function bar.
Hint. You will have to compute the quantile of the standardized univariate generator, use the simulations
generated above.
Solution of E 222
To generate J scenarios from(5.181) you can use the following approach. Consider the uniform distribu-
tion on the N -dimensional hypercube:
The entries of X are independent and therefore (5.180) can easily be simulated. Now consider the uniform
distribution on the N -dimensional unit hypersphere:
Y ∼ U (E0,I ) . (5.181)
To generate a sample of size J from (5.181) generate a sample of size Je from (5.180). Then use
d
Y = X/ kXk ≤ 1 . (5.182)
To set the number of simulations Je use (A.78, AM 2005). To generate a sample of size J from (5.169)
apply (2.270, AM 2005) to the sample from (5.181). To generate a sample of size J from (5.181) more ef-
ficiently you can proceed as follows (courtesy Xiaoyu Wang, CIMS-NYU). In this function, we represent
(5.181) as in (2.259, AM 2005)-(2.260, AM 2005):
d
Y = RU . (5.183)
In this expression U is uniform on the surface of the unit sphere and R is a suitable radial distribution
independent of U.
CHAPTER 5. EVALUATING ALLOCATIONS 179
d
U = Z/ kZk , (5.184)
where:
Z ∼ N (0N ×1 , IN ×N ) , (5.185)
this follows from the last expression in (2.260, AM 2005) and the fact that the normal distribution is
elliptical. To generate J scenarios of R, notice that, for a given radius r, the radial density must be
proportional to rN −1 . Indeed, the infinitesimal volume surrounding the surface of the sphere of radius r
is proportional to rN −1 . Therefore, pinning down the normalization constant, we obtain:
rN −1
fR (r) = . (5.186)
N −1
From (5.186), the radial cdf reads:
FR (r) = rN . (5.187)
d
R = W 1/N , (5.189)
2
Ψα ∼ LogN µα , σα , (5.190)
Z 1 Z 1 Z 1−c
1
Spc(α) ≡ ESc (α)w(c)dc = QΨα (s)ds w(c)dc , (5.191)
0 0 1−c 0
where:
Z 1
w(c) ≥ 0 , w(c)dc = 1 . (5.192)
0
Equivalently:
Z 1 Z 1 Z c
w(c)
ESc (α)w(c)dc = QΨα (s)ds dc
0 0 0 c
Z 1 Z c
w(c)
= QΨα (s) ds dc
0 0 c
Z 1 Z 1 (5.193)
w(c)
= QΨα (s) dc ds
0 s c
Z 1
= QΨα (s)φ(s)ds ,
0
where:
Z 1
w(x)
φ(s) ≡ dx . (5.194)
s x
On the one hand, from:
w(s)
φ0 (s) = − , (5.195)
s
we obtain:
Z 1 Z 1 Z 1 Z 1 Z 1
0
[sφ(s)] ds = φ(s)ds + sφ0 ds = φ(s)ds − w(s)ds . (5.196)
0 0 0 0 0
Z 1
0 1
[sφ(s)] ds = sφ(s)|0 = 0 . (5.197)
0
Therefore:
Z 1
φ(s)ds = 1 . (5.198)
0
E {Ψf } = 0 . (5.199)
Solution of E 225
Thus from the definition of expected shortfall (5.208, AM 2005) for any confidence level ESc (α) ≤ 0.
Since the expected shortfall generates the spectral indices of satisfaction, the satisfaction derived from
any fair game is negative whenever satisfaction is measured with a spectral index.
Solution of E 226
The Cornish-Fisher expansion (5.179, AM 2005) states that the quantile of the approximate objective Ξα
can be approximated in terms of the quantile z(s) of the standard normal distribution and the first three
moments as follows:
CM3 {Ξα } CM3 {Ξα } 2
QΞα (s) ≈ E {Ξα } − + Sd {Ξα } z(s) + z (s) , (5.201)
6 Var {Ξα } 6 Var {Ξα }
where CM3 is the third central moment. Using (1.48) to express the central moments in terms of the raw
moments we obtain the approximate expression of the quantile of the objective:
where (A, B, C) are defined in (5.181, AM 2005). To obtain the spectral index of satisfaction we apply
(5.202) to its definition (5.223, AM 2005), obtaining:
Z 1
Spcφ (α) ≡ φ(s)QΨα (s)ds
0
Z 1 Z 1
(5.203)
2
≈ A(α) + B(α) φ(s)z(s)ds + C(α) φ(s)z (s)ds .
0 0
Z ≡ Qc (α) − Ψα . (5.204)
This is the cdf of Z conditioned on Z ≥ 0. If the confidence level c is high, from (5.184, AM 2005) this
cdf is approximated by Gξ,v . Thus:
Z ∞
dGξ,v (z) v
E {Z|Z ≥ 0} ≈ z dz = , (5.206)
0 dz 1−ξ
where the last result can be found in Embrechts et al. (1997). On the other hand, from the definition
(5.208, AM 2005) of expected shortfall we derive:
Z ≡ ψe − Ψα |Ψα ≤ ψe . (5.208)
FZ (z) ≡ P {Z ≤ z}
n o
= P ψe − Ψα ≤ z|Ψα ≤ ψe
n o
= P Ψα ≥ ψe − z|Ψα ≤ ψe (5.209)
n o
= 1 − P Ψα ≤ ψe − z|Ψα ≤ ψe
≡ 1 − Lψe (z) ,
CHAPTER 5. EVALUATING ALLOCATIONS 183
where in the last row we used (5.182, AM 2005). From (5.183, AM 2005) we obtain:
The function xi_v = gpfit(Excess) attempts to fit (5.210), where Excess are the realizations of the random
variable (5.208).
2
Ψα ∼ St ν, µα , σα , (5.211)
where ν ≡ 7, µα ≡ 1, σα 2
≡ 4. Write a MATLAB
R
script in which you:
• Plot the true quantile-based index of satisfaction Qc (α) for c ∈ [0.950, 0.999];
• Generate Monte Carlo simulations from (5.211) and superimpose the plot of the sample counterpart
of Qc (α) for c ∈ [0.950, 0.999];
• Consider the threshold:
• Superimpose the plot of the EVT fit (5.186, AM 2005) for c ∈ [0.950, 0.999].
Hint. Estimate the parameters ξ and v using the built-in function xi_v = gpfit(Excess), where Excess are
the realizations of the random variable:
Z ≡ ψe − Ψα |Ψα ≤ ψe . (5.213)
FZ (z) ≡ P {Z ≤ z}
n o
= P ψe − Ψα ≤ z|Ψα ≤ ψe
n o
= P Ψα ≥ ψe − z|Ψα ≤ ψe (5.214)
n o
= 1 − P Ψα ≤ ψe − z|Ψα ≤ ψe
≡ 1 − Lψe (z) ,
where in the last row we used (5.182, AM 2005). From (5.184, AM 2005) we obtain:
Solution of E 229
See the MATLAB
R
script S_ExtremeValueTheory.
E 230 – First-order sensitivity analysis of the expected shortfall (www.5.5)
Prove the expression (5.235, AM 2005) of the first-order derivatives of the expected shortfall.
Note. The result for a generic spectral measure follows from (5.191) and the definition (5.195) of the
weights in terms of the spectrum.
Solution of E 230
First we define:
X
Xn ≡ αj M j . (5.216)
j6=n
Z +∞ Z +∞
∂ ESc (α) ∂ 1
= (x + αn m)Ix≤Qc −αn m (x, m)
∂αn ∂αn 1 − c −∞ −∞
fXn ,Mn (x, m)dxdm] (5.217)
Z +∞ Z Qc −αn m
1 ∂
= (x + αn m)fXn ,Mn (x, m)dxdm .
1 − c −∞ ∂αn −∞
Using (5.147) this becomes:
Z +∞
∂ ESc (α) 1 ∂ Qc (α)
= − m Qc (α)fXn ,Mn (Qc (α) − αn m, m)dm
∂αn 1−c −∞ ∂αn
Z +∞ Z Qc −αn m (5.218)
1
+ mfXn ,Mn (x, m)dxdm .
1 − c −∞ −∞
On the other hand:
Z +∞ Z Qc −αn m
∂(1 − c) ∂
0= = fXn ,Mn (x, m)dxdm
∂αn ∂αn −∞ −∞
Z +∞ (5.219)
∂ Qc (α)
× ( − m)fXn ,Mn (Qc (α) − αn m, m)dm .
−∞ ∂αn
Therefore:
Z +∞ Z Qc −αn m
∂ ESc (α) 1
= mfXn ,Mn (x, m)dxdm
∂αn 1 − c −∞ −∞
Z Z (5.220)
1
= mfXn ,Mn (x, m)dxdm .
1−c Ψα ≤Qc
Note. The result for a generic spectral measure follows from (5.191) and the definition (5.195) of the
weights in terms of the spectrum.
CHAPTER 5. EVALUATING ALLOCATIONS 185
Solution of E 231
First we define:
X
Xn ≡ αj M j . (5.221)
j6=n
∂ 2 ESc (α) ∂
= E {M0 |Xn + αn Mn ≤ Qc (α)}
∂αn ∂α0 ∂αn
Z (5.222)
∂
= m0 fM (m|Xn + αn Mn ≤ Qc (α))dm .
∂αn
R Qc −αn mn
fXn ,M (x, m)dx
fm (m|Xn + αn Mn ≤ Qc ) = R R Q−∞−αn mn
c
−∞
fXn ,M (x, m)dxdm
R Qc −αn mn
−∞
fXn ,M (x, m)dx (5.223)
=R
xn +αn mn ≤Qc
fXn ,M (x, m)dxdm
R Qc −αn mn
−∞
fXn ,M (x, m)dx
= .
1−c
Therefore using (5.147) we obtain:
"Z Z Qc −αn mn #
∂ 2 ESc (α) 1 ∂
= m0 fXn ,M (x, m)dxdm
∂αn ∂α0 1−c ∂αn −∞
Z (5.224)
1 ∂ Qc (α)
= m0 − mn fXn ,m (Qc (α) − αn mn , m)dm .
1−c ∂αn
M ∼ St(ν, µ, Σ) . (5.228)
Write the expected shortfall ESc (α) defined in (5.207, AM 2005) as a function of the allocation.
Solution of E 232
From (5.228) and (2.195, AM 2005) in we obtain:
or:
d √
Ψα = α0 µ + α0 ΣαX , (5.230)
where:
X ∼ St (ν, 0, 1) . (5.231)
1
Z 1−c
1
Z 1−c h √ i
ESc (α) = QΨα (s) ds = α0 µ + α0 ΣαQX (s) ds . (5.232)
1−c 0 1−c 0
and thus:
CHAPTER 5. EVALUATING ALLOCATIONS 187
√
ESc (α) = α0 µ + α0 Σαζc , (5.233)
where:
Z 1−c
1
ζc ≡ QX (s) ds . (5.234)
1−c 0
This scalar can be evaluated as the numerical integral of the quantile function of the standard univariate t
distribution.
Solution of E 233
Deriving (5.233) we obtain:
∂ ESc (α) ζc
=µ+ √ Σα . (5.235)
∂α α0 Σα
Therefore the marginal contributions C read:
∂ ESc (α) ζc
C ≡ diag (α) = diag (α) µ + √ diag (α) Σα . (5.236)
∂α α0 Σα
It is immediate to check that:
N
X
ESc (α) ≡ Cn , (5.237)
n=1
Solution of E 234
See the MATLAB
R
script S_ESContributionsStudentT.
M ≡ bF + U , (5.238)
where B is a N × K matrix with entries of the order of the unit, F is a K-dimensional vector, U is a
N -dimensional vector and:
ln F
∼ St (ν, µ, Σ) , (5.239)
ln (U + a)
Σf
0
Σ≡ , (5.240)
0 2 Σu
Ψ ≡ βF + u . (5.242)
Solution of E 235
See the MATLAB
R
script S_ESContributionsFactors.
Assume that the copula is lognormal, i.e. the grades (U1 , U2 ) of (P1 , P2 ) have the following joint distri-
bution (not a typo, why?):
Φ−1 (U1 )
0 1 ρ
∼N , , (5.245)
Φ−1 (U2 ) 0 ρ 1
where Φ denotes the cdf of the standard normal distribution. Assume that the current prices are p1 ≡
E {P1 } and p2 ≡ E {P2 }.
Write a MATLAB
R
script in which you:
• Fix arbitrary values for the parameters (ν1 , σ12 , µ2 , σ22 ) and compute the current prices;
• Consider the following allocation α1 ≡ 1, α2 ≡ 2 and simulate the distribution of the objective of
an investor who is interested in final wealth;
• Consider the previous allocation. Simulate the distribution of the objective of an investor who is
interested in the P&L;
• Consider the previous allocation and the following benchmark β1 ≡ 2, β2 ≡ 1 and simulate the
distribution of the objective of an investor who is interested in beating the benchmark.
Solution of E 236
See the MATLAB
R
script S_InvestorsObjective.
ψ − ψ0
u (ψ) ≡ a + b erf √ , (5.246)
2η
where b > 0. Plot the utility function for different values of η and ψ0 . Compute the Arrow-Pratt risk
aversion (5.121, AM 2005) implied by the utility (5.246).
Solution of E 237
Deriving (B.75, AM 2005), we obtain:
d 2 2
erf (x) = √ e−x . (5.247)
dx π
Hence:
r 2
2 −
ψ−ψ0
√
u0 (ψ) ≡ b e 2η
, (5.248)
πη
and:
2
2b 1 − ψ − ψ0
ψ−ψ0
√
u00 (ψ) ≡ − √ e 2η √ . (5.249)
η π 2η
Therefore:
−u00 (ψ) ψ − ψ0
A (ψ) ≡ 0
= . (5.250)
u (ψ) η
For the interpretation of this result see (5.124, AM 2005) and comments thereafter.
Chapter 6
Optimizing allocations
1 0
CE(α) ≡ ξ 0 α − α Φα , (6.1)
2ζ
and the constraint (6.24, AM 2005) we obtain the Lagrangian:
1 0
L ≡ ξ0 α − α Φα − λ(α0 pT − wT ) . (6.2)
2ζ
We neglect in the Lagrangian the second constraint (6.26, AM 2005), which from (6.22, AM 2005) and
(6.24, AM 2005) reads:
√
ξ 0 α − erf −1 (c) α0 Φα ≥ (1 − γ)wT . (6.3)
We verify ex-post that the constraint is automatically satisfied. From the first-order conditions on the
Lagrangian we obtain:
where γ is a suitable scalar. To compute γ we notice that the maximization of (6.2) is the same as (6.70,
AM 2005), where the objective is given by M ≡ PT +τ and the constraint is (6.94, AM 2005), with
191
d ≡ pT and c ≡ wT . Thus the solution must be of the form (6.97, AM 2005). Recalling the definitions
(6.99, AM 2005) of αM V and (6.100, AM 2005) of αSR respectively, and defining the scalar:
e − E {ΨαM V }
θ≡ , (6.5)
E {ΨαSR } − E {ΨαM V }
wT Φ−1 ξ wT Φ−1 pT
α=θ + (1 − θ) . (6.6)
p0T Φ−1 ξ p0T Φ−1 pT
ζ 0 −1
θ= p Φ ξ, (6.7)
wT T
and thus:
wT wT − ζp0T Φ−1 ξ
γ = (1 − θ) −1 = . (6.8)
p0T Φ pT p0T Φ−1 pT
Substituting this expression back into (6.4) we obtain the optimal allocation:
wT − ζp0T Φ−1 ξ −1
α∗ = ζΦ−1 ξ + Φ pT . (6.9)
p0T Φ−1 pT
Note. Notice that the optimal allocation (6.9), lies on the efficient frontier. When the risk propensity
ζ is zero we obtain the minimum variance portfolio αM V . As the risk propensity ζ tends to infinity,
the solution departs from the "belly" of the hyperbola along the upper branch of the hyperbola, passing
through the maximum Sharpe ratio portfolio αSR . The VaR constraint (6.3) is satisfied automatically
if two the confidence required c is not too high and the margin γ is not too small. Indeed consider the
following align:
√
ξ 0 α − erf −1 (c) α0 Φα = (1 − γ)wT . (6.10)
This is a straight line through the origin in Figure 6.1 in Meucci (2005). If erf −1 (c) is not larger than
the maximum Sharpe ratio, i.e. the slope of the line through the origin and the portfolio αSR , and if γ
is large enough, then all the portfolios above the straight line on the frontier satisfy the VaR constraint.
These portfolios correspond to the choice (6.7, AM 2005) for suitable choices of the extremes.
Solution of E 240
We replace (6.9) in (6.1):
∗ 0 ∗ 1 ∗0 ∗
CE(α ) ≡ ξ α − α Φα
2ζ
wT − ζp0T Φ−1 ξ −1
= ξ 0 ζΦ−1 ξ + Φ p T
p0T Φ−1 pT
0
wT − ζp0T Φ−1 ξ −1
1
− ζΦ−1 ξ + Φ pT Φ
2ζ p0T Φ−1 pT
wT − ζp0T Φ−1 ξ −1
−1
ζΦ ξ + Φ pT (6.11)
p0T Φ−1 pT
wT − ζp0T Φ−1 ξ
= ζξ 0 Φ−1 ξ + ξ 0 Φ−1 pT
p0T Φ−1 pT
2
1 wT − ζp0T Φ−1 ξ
ζ
− ξ 0 Φ−1 ξ − p0T Φ−1 pT
2 2ζ p0T Φ−1 pT
1 wT − ζp0T Φ−1 ξ
− p0T Φ−1 ξ .
2 p0T Φ−1 pT
Therefore:
wT − ζp0T Φ−1 ξ
ζ 1
CE(α ) = ξ 0 Φ−1 ξ +
∗
ξ 0 Φ−1 pT
2 2 p0T Φ−1 pT
(6.12)
1 (wT − ζp0T Φ−1 ξ)2
− .
2ζ p0T Φ−1 pT
E 241 – Results on constrained optimization: QCQP as special case of SOCP (www.6.2) *
Show that the QCQP problem (6.57, AM 2005) can be written as (6.59, AM 2005), a problem of the
SOCP form (6.55, AM 2005).
Solution of E 241
From the spectral decomposition, the original quadratic programming problem:
n o
z∗ ≡ argmin z0 S(0) z + 2u0(0) z + v(0)
z
(6.13)
Az = a
s.t.
z0 S(j) z + 2u0(j) z + v(j) ≤ 0 ,
2
∗
1/2 0 −1/2 0
z ≡ argmin
Λ(0) E(0) z + Λ(0) E(0) u(0)
z
(
Az = a (6.15)
s.t.
2
1/2 0 −1/2
Λ(j) E(j) z + Λ(j) E0(j) u(j)
≤ u(j) S−1
(j) u(j) − v(j) ,
E 242 – Feasible set of the mean-variance problem in the space of moments (www.6.3) *
Prove that the feasible set of the mean-variance problem (6.96, AM 2005) in the coordinates (6.101, AM
2005) is the region to the right of the parabola (6.102, AM 2005)-(6.103, AM 2005).
Solution of E 242
Consider the general case where E {M} and d are not collinear. First we prove that any level of expected
value e ∈ R is attainable. This is true if for any value e there exists an α such that:
e = E {Ψα } = α0 E {M}
(6.17)
c = α0 d .
In turn, this is true if we can solve the following system for an arbitrary value of e:
P
E {Mj } E {Mk } αj e − n6=j,k αn E {Mk }
= P . (6.18)
dj dk αk c − n6=j,k αn dn
Since E {M} and d are not collinear we can always find two indices (j, k) such that the matrix on the
left-hand side of (6.18) is invertible. Therefore, we can fix arbitrarily e and all the entries of α that appear
on the right hand side of (6.18) and solve for the remaining two entries on the left-hand side of (6.18).
CHAPTER 6. OPTIMIZING ALLOCATIONS 195
Now we prove that if a point (v, e) is feasible, so is any point (v + γ, e), where γ is any positive number.
Indeed, if we make any of the entries on the right hand side of (6.18) go to infinity and solve for the
remaining two entries on the left-hand side of (6.18) the variance of the ensuing allocations satisfies the
constraints and tends to infinity. For continuity, all the points between (v, e) and (+∞, e) are covered.
Therefore the feasible set can only be bounded on the left of the (v, e) plane. To find out if that boundary
exists, we fix a generic expected value e and compute the minimum variance achievable that satisfies the
affine constraint. Therefore, we minimize the following unconstrained Lagrangian:
∂L
0= = 2 Cov {M} α − λd − µ E {M} , (6.20)
∂α
in addition to the two constraints:
∂L
0= = α0 d − c
∂λ
(6.21)
∂L
0= = α0 E {M} − e ,
∂µ
From (6.20) the solution reads:
λ −1 µ −1
α= Cov {M} d + Cov {M} E {M} . (6.22)
2 2
The Lagrange multipliers can be obtained as follows. First, we define four scalar constants:
−1
A ≡ d0 Cov {M} d (6.23)
−1
B ≡ d0 Cov {M} E {M} (6.24)
0 −1
C ≡ E {M} Cov {M} E {M} (6.25)
2
D ≡ AC − B . (6.26)
Left-multiplying the solution (6.22) by d0 and using the first constraint in (6.21) we obtain:
λ 0 −1 µ −1 λ µ
c = d0 α = d Cov {M} d + d0 Cov {M} E {M} = A + B . (6.27)
2 2 2 2
0
Similarly, left-multiplying the solution (6.22) by E {M} and using the second constraint in (6.21) we
obtain:
0 λ 0 −1 µ 0 −1 λ µ
e = E {M} α = E {M} Cov {M} d + E {M} Cov {M} E {M} = B + C . (6.28)
2 2 2 2
Now we can invert (6.28) and (6.27) obtaining:
2cC − 2eB 2eA − 2cB
λ= , µ= . (6.29)
D D
Finally, left-multiplying (6.20) by α0 we obtain:
This shows that the boundary v(e) ≡ Var {Ψα } exists. Collecting the terms in e we obtain its align:
A 2 2cB c2 C
v= e − e+ , (6.31)
D D D
which shows that the feasible set is bounded on the left by a parabola. In the space of the coordinates
(d, e) = (Sd {Ψα } , E {Ψα }) the parabola (6.31) becomes a hyperbola:
A 2 2cB c2 C
d2 = e − e+ . (6.32)
D D D
The allocations α that give rise to the boundary parabola (6.31) are obtained from (6.22) by substituting
the Lagrange multipliers (6.29):
cC − eB −1 eA − cB −1
α= Cov {M} d + Cov {M} E {M}
D D
−1 −1 (6.33)
(cC − eB)A Cov {M} d (eA − cB)B Cov {M} E {M}
= −1 + −1 .
D d0 Cov {M} d D d0 Cov {M} E {M}
If c 6= 0 we can write (6.33) as:
(E {Ψα } A − cB)B
γ(α) ≡ , (6.35)
cD
and (αM V , αSR ) are two specific portfolios defined as follows:
−1
c Cov {M} d
αM V ≡ −1 (6.36)
d0 Cov {M} d
−1
c Cov {M} E {M}
αSR ≡ −1 . (6.37)
d0 Cov {M} E {M}
CHAPTER 6. OPTIMIZING ALLOCATIONS 197
cC cB cD
E {ΨαSR } − E {ΨαM V } = − = (6.38)
B A AB
we can simplify it as follows:
which shows that the upper (lower) branch of the boundary parabola is spanned by the positive (negative)
values of γ.
Note. To consider the case c = 0 we take the limit c → 0 in the above results. The boundary (6.31) of the
feasible set in the coordinates (v, e) = (Var {Ψα } , E {Ψα }) is still a parabola:
A 2
v= e , (6.40)
D
whereas in the space of coordinates (s, e) = (Sd {Ψα } , E {Ψα }) the boundary degenerates from the
hyperbola (6.32) into two straight lines:
r
A
d(e) = ± e. (6.41)
D
As for the allocations that generate this boundary, taking the limit c → 0 in (6.34) and recalling the
definitions (6.35), (6.36) and (6.37) we obtain:
E {Ψα }
ζ(α) ≡ . (6.43)
D
The upper (lower) branch of the boundary parabola is spanned by the positive (negative) values of ζ.
E 243 – Reformulation of the efficient frontier with affine constraints (www.6.3)
(see E 242)
Consider the same setup than in E 242. Show that the problem (6.96, AM 2005) can be more easily
parametrized as in (6.97, AM 2005)-(6.100, AM 2005).
Solution of E 243
With the geometry of the feasible set in E 242, we can move on to compute the mean-variance curve:
fixing a level of variance v and maximizing the expected value in the feasible set means hitting the upper
branch of the parabola (6.31). Therefore if c 6= 0 the mean-variance curve reads:
c2 cB
vM V ≡ Var {ΨαM V } = , eM V ≡ E {ΨαM V } = . (6.45)
A A
c2 C cC
vSR ≡ Var {ΨαSR } = , eSR ≡ E {ΨαSR } = , (6.46)
B2 B
On the other hand the highest Sharpe ratio is the steepness of the straight line tangent to the hyperbola
(6.32), which we obtain by maximizing its analytical expression as a function of the expected value:
e e
SR(e) ≡ =q . (6.47)
d(e) A 2 2cB c2 C
De − D e + D
The first-order conditions with respect to e show that the maximum of the Sharpe ratio is reached at
(6.46).
CHAPTER 6. OPTIMIZING ALLOCATIONS 199
−1
Cov {M} (E {M} − d)
α≡ζ −1 ζ sign(B) > 0 . (6.48)
d0 Cov {M} E {M}
E 248 – Effect of correlation on the mean-variance efficient frontier: total correla-
tion case (www.6.4)
Show that, in the case of a bivariate market with total correlation, the mean-variance efficient frontier
degenerates into a straight line that joins the two coordinates of the two assets in the plane (6.114, AM
2005), i.e. show (6.116, AM 2005).
Hint. In the case of N = 2 assets, the (N − 1)-dimensional affine constraint (6.94, AM 2005) determines
a line:
c b2
α1 = − α2 , (6.49)
b1 b1
which corresponds to the feasible set. Defining:
c eb ≡ b2 .
α ≡ α2 , c≡
e , (6.50)
b1 b1
The investor’s objective reads:
c − αeb)M1 + αM2 = e
Ψα = α1 M1 + α2 M2 = (e cM1 + α(M2 − ebM1 ) . (6.51)
e ≡ E {Ψα } = e
c E {M1 } + α(E {M2 } − eb E {M1 }) . (6.52)
where ρ ≡ Corr {M1 , M2 }. From (6.52) and (6.53) we derive the coordinates of a full allocation in the
first asset, which corresponds to α = 0:
e(1) = e
c E {M1 } , d(1) = e
c Sd {M1 } (6.54)
c c
e(2) = E {M2 } , d(2) = Sd {M2 } .
e e
(6.55)
eb eb
Without loss of generality, we make the assumption:
In this notation we can more conveniently re-express the expected value (6.52) of a generic allocation as
follows:
αeb (2)
e = e(1) + (e − e(1) ) . (6.57)
c
e
As for the standard deviation (6.53) we obtain:
!2 !2 !
αeb h i2 αeb h i2 αeb αeb (1) (2)
2
d = 1− d(1) + d(2) + 2 1 − ρ d d , (6.58)
c
e c
e c
e c
e
Solution of E 248
If ρ = 1, (6.58) simplifies to:
" ! #2
2 αeb (1) αeb (2)
d = 1− d + d , (6.59)
c
e c
e
d(1) c
α≥−
e
, (6.60)
d(2) − d(1) eb
in turn simplifies to:
!
αeb αeb (2)
d= 1− d(1) + d . (6.61)
c
e c
e
CHAPTER 6. OPTIMIZING ALLOCATIONS 201
e(2) − e(1)
e = e(1) + (d − d(1) ) , (6.62)
d(2) − d(1)
which is a line through the coordinates of the two securities.
Note. When the allocation α is such that (6.60) holds as an equality, we obtain a zero-variance portfolio
whose expected value from (6.57) reads:
e(2) − e(1)
e = e(1) − d(1) < e(1) . (6.63)
d(2) − d(1)
From (6.60) that this situation corresponds to a negative position in the second asset.
" ! #2
2 αeb (1) αeb (2)
d = 1− d − d , (6.64)
c
e c
e
d(1) c
α≥
e
(1) (2)
, (6.65)
d +d b e
αeb (1)
d = −d(1) + (d + d(2) ) . (6.66)
c
e
This expression coupled with (6.57) yield the allocation curve in the case ρ = −1:
e(2) − e(1)
e = e(1) + (d + d(1) ) . (6.67)
d(2) + d(1)
When the allocation α is such that (6.65) holds as an equality, we obtain a zero-variance portfolio whose
expected value from (6.57) reads:
e(2) − e(1)
e = e(1) + d(1) > e(1) . (6.68)
d(1) + d(2)
Note. From (6.65) the allocation in the second asset is positive and from (6.49) so is the allocation in the
first asset:
d(1)
c 1−
α1 = e . (6.69)
d(1) + d(2)
E 250 – Total return efficient allocations in the plane of relative coordinates (www.6.5)
Show that the benchmark-relative efficient allocation (6.190, AM 2005) give rise to the portions of the
parabola (6.193, AM 2005) above the coordinate of the benchmark. Show that the hyperbolas are the
same if the benchmark is mean-variance efficient from a total-return point of view.
Solution of E 250
From (6.193, AM 2005) the generic portfolio (6.175, AM 2005) on the efficient frontier satisfies:
A 2 2wT B w2 C
Var {Ψαe } = E {Ψαe } − E {Ψαe } + T (6.70)
D D D
which can be re-written as follows:
A
+ E {Ψβ })2
Var Ψα−β − Var {Ψβ } + 2 Cov {Ψαe , Ψβ } = (E Ψα−β
D
e e
(6.71)
2wT B wT2 C
− (E Ψα−β + E {Ψ β }) + .
D D
e
A 2
Var Ψα−β = − 2 Cov {Ψαe , Ψβ } + E Ψα−β
D
e e
2A 2wT B
+ E Ψα−β E {Ψβ } − (6.72)
D D
e
A 2 2wT B w2 C
+ E {Ψβ } − E {Ψβ } + T + Var {Ψβ } .
D D D
From (6.94, AM 2005), (6.99, AM 2005) and (6.100, AM 2005) we obtain for a generic allocation α:
Using this result, from (6.175, AM 2005) and the budget constraint β 0 pT = wT the covariance reads:
CHAPTER 6. OPTIMIZING ALLOCATIONS 203
0 E {Ψαe } − E {ΨαM V }
Cov {Ψβ , Ψαe } = β Cov {PT +τ } αM V + (αSR − αM V )
E {ΨαSR } − E {ΨαM V }
wT β 0 pT wT β 0 E {PT +τ } wT β 0 pT
E {Ψαe } − E {ΨαM V }
= + − (6.74)
A E {ΨαSR } − E {ΨαM V } B A
2
2 {Ψ })BA −
w (E Ψ α−β + E β wT B E {Ψβ } wT
= T + − .
e
A D B A
" #
wT2 + E {Ψβ })BA − wT B 2 E {Ψβ } wT
(E Ψα−β
Var Ψα−β = −2 + −
e
A D B A
e
A 2 2A 2wT B
+ E Ψα−β + E Ψα−β E {Ψβ } −
D D D
e e
2
A 2 2wT B w C
+ E {Ψβ } − E {Ψβ } + T + Var {Ψβ }
D D D
2wT2
2 E Ψα−β BA E {Ψβ } wT (6.75)
= − − −
e
A D B A
2wT B 2 E {Ψβ } wT
2 E {Ψβ } BA E {Ψβ } wT
− − + −
D B A D B A
A 2 2A 2wT B
+ E Ψα−β + E Ψα−β E {Ψβ } −
D D D
e e
2
A 2 2wT B w C
+ E {Ψβ } − E {Ψβ } + T + Var {Ψβ } .
D D D
The first-degree terms in E Ψα−βe cancel, and other terms simplify to yield the following expression:
2B 2
A 2 2 C 2
Var Ψα−β = E Ψ α−β + w T − −
D D A DA
e e
(6.76)
A 2 2wT B
− E {Ψβ } + E {Ψβ } + Var {Ψβ } .
D D
From the definition of D in (6.194, AM 2005) this simplifies further into:
A 2 wT2 C A 2
Var Ψα−β = E Ψα−β − − E {Ψβ }
D D D
e e
(6.77)
2wT B
+ E {Ψβ } + Var {Ψβ } ,
D
or:
A 2
Var Ψα−β = E Ψα−β + δβ , (6.78)
D
e e
where:
A 2 2wT B w2 C
δβ ≡ Var {Ψβ } − E {Ψβ } + E {Ψβ } − T . (6.79)
D D D
Since the benchmark is not necessarily mean-variance efficient from (6.193, AM 2005) we have that
δβ ≥ 0 and the equality holds if and only if the benchmark is mean-variance efficient.
E 251 – Benchmark-relative efficient allocation in the plane of absolute coordinates
(www.6.5)
Show that the total-return mean-variance efficient allocation (6.175, AM 2005) give rise to the portion of
the parabola above the coordinate of the global minimum-variance portfolio, as illustrated in Figure 6.21
of Meucci (2005).
Solution of E 251
From the align of the relative frontier (6.199, AM 2005) which we re-write here:
A 2
Var {Ψα−β } = E {Ψα−β } , (6.80)
D
and the linearity of the objective Ψα−β = Ψα − Ψβ we obtain:
E {Ψα } − E {Ψβ }
= wT C wT B
B − A
(E {Ψα } − E {Ψβ })BA
= .
wT D
(6.82)
Using this result, from (6.190, AM 2005) and the budget constraint β 0 pT = wT the covariance reads:
E {Ψα } − E {Ψβ }
Cov {Ψβ , Ψα } = β 0 Cov {PT +τ } β + (αSR − αM V )
E {ΨαSR } − E {ΨαM V }
= Var {Ψβ }
wT β 0 E {pT +τ } wT β 0 pT (6.83)
E {Ψα } − E {Ψβ }
+ −
E {ΨαSR } − E {ΨαM V } B A
(E {Ψα } − E {Ψβ })BA E {Ψβ } wT
= Var {Ψβ } + − .
D B A
A 2 2BwT w2 C
Var {Ψα } = E {Ψα } − E {Ψα } + T + δβ , (6.84)
D D D
where δβ is defined in (6.79).
PN (n)
WT +τ αn PT +τ
1 + LΨα ≡ = n=1
wT wT
N (n) (n) N
X αn P
T
PT +τ X
(n)
(6.85)
= (n)
= wn 1 + L
n=1
wT pT n=1
= 1 + w0 L ,
where we have used the budget constraint α0 pT = wT and the following identity:
N N (n)
X X αn pT
wn = = 1. (6.86)
n=1 n=1
α0 pT
The original mean-variance curve is simply α(v) ≡ α(w(v)) obtained from (6.86, AM 2005).
Write a MATLAB
R
script in which you estimate the matrix Σ and the vector µ from the time series of
weekly prices in the attached database DB_StockSeries. To do this, shrink the sample mean as in (4.138,
AM 2005), where the target is the null vector and the shrinkage factor is set as α ≡ 0.1. Similarly, shrink
as in (4.160, AM 2005) the sample covariance to a suitable multiple of the identity by a factor α ≡ 0.1.
Solution of E 254
See the MATLAB
R
script S_MeanVarianceOptimization.
2 !
(υ) 20 + 1.25υ
∆τe Y ∼ N 0, , (6.92)
10, 000
where υ denotes the generic time to maturity (measuring time in years). Assume that the bonds and the
stock market are independent. Assume that the current stock prices are the last set of prices in the time
series. Restrict your attention to bonds with times to maturity 4, 5, 10, 52 and 520 weeks, and assume that
the current yield curve, as defined in (3.30, AM 2005) in Meucci (2005) is flat at 4%. Write a MATLAB
R
whose expected values are equally spaced between the expected value of the minimum variance
portfolio and the largest expected value among the portfolios composed of only one security;
• Assume that the investor’s satisfaction is the certainty equivalent associated with an exponential
function:
1
u(ψ) ≡ −e− ζ ψ , (6.93)
where ζ ≡ 10 and compute the optimal allocation according to the two-step mean-variance frame-
work.
Hint. Do not use portfolio weights and returns. Instead, use number of securities and prices. Given the
no-short-sale constraint, the minimum variance portfolio cannot be computed analytically, as in (6.99,
AM 2005): use the MATLAB
R
function quadprog to compute it numerically. Given the no-short-sale
constraint, the frontier cannot be computed analytically, as in (6.97, AM 2005)-(6.100, AM 2005): use
quadprog to compute it numerically.
Solution of E 255
See the MATLAB
R
script S_MeanVarianceOptimization.
1
u(ψ) ≡ −e− ζ ψ , (6.94)
where ζ ≡ 10. Compute the optimal allocation according to the two-step mean-variance frame-
work;
• Repeat the above steps an the investment horizon τ of four years.
Solution of E 256
See the MATLAB
R
script S_MeanVarianceHorizon.
Φα ≡ α0 KPT +τ , (6.95)
where:
pT β 0
K≡I− , (6.96)
β 0 pT
and β is the benchmark. In particular, notice that K is singular: the columns of K span a vector space of
dimension N − 1. Any vector orthogonal to all the column of K is spanned by the benchmark. Therefore
Φβ = β 0 KPT +τ ≡ 0, which implies that the benchmark has zero expected outperformance and zero
tracking error, see Figure (6.21, AM 2005). For a budget b, the return-based objective is defined as:
Φα α0 KPT +τ α0 PT +τ α0 pT β 0 PT +τ
= = −
b α0 pT α0 pT (α0 pT )(β 0 pT )
0 0
α PT +τ β PT +τ (6.97)
= −1 − −1
α0 pT β 0 pT
= Lα − Lβ ,
where Lα and Lβ are the linear returns of the portfolio and the benchmark, respectively. Given that the
constraints are linear, we resort to the dual formulation of the return-based mean-variance problem, which
reads:
Using 6.85 we obtain in terms of the portfolio weights w, the benchmark weights wb , and the securities
returns L:
1 0
w(e) ≡ argmin w Cov{L}w − wb0 Cov{L}w . (6.99)
w0 1≡1 2
w≥0
0
w E{L}=e
and a risky asset whose value Pt follows a geometric Brownian motion with drift µ and volatility σ:
σ2 √
ln Pt+δt = ln Pt + µ − δt + σ δtZt , (6.101)
2
where Zt ∼ N(0, 1) are independent across non-overlapping time steps. Assume the current time is t ≡ 0
and the investment horizon is t ≡ τ . Assume there is an initial budget:
S0 given . (6.102)
Consider a strategy that rebalances between the two assets throughout the investment period [0, τ ]:
where αt denotes the number of units of the risky asset and βt denotes the number of units of the risk-free
asset. The value of the strategy is:
St = αt Pt + βt Dt , (6.104)
αt Pt βt Dt
wt ≡ , ut ≡ , (6.107)
St St
Prove that the self-financing constraint (6.106) is equivalent to the weight of the risk-free asset being
equal to:
ut ≡ 1 − wt , (6.108)
and that therefore the whole strategy if fully determined by the free evolution of the weight wt .
Note. See Meucci (2010d).
Solution of E 260
We denote by (wt , ut ) the pre-trade weights and by (w
et , u
et ) the post-trade weights. Dividing both sides
of (6.106) by the value of the strategy we obtain:
and:
αt ≡ α , βt ≡ β . (6.111)
Write a MATLAB
R
script in which you:
• Generate the deterministic exponential growth dynamics (6.100) at equally spaced time intervals τ ;
• Generate a large number of Monte Carlo paths from the geometric Brownian motion (6.101) at
equally spaced time intervals [0, δt, 2δt, . . . , τ ];
• Plot one path for the value of the risky asset {Pt }t=0,δt,...,τ , and overlay the respective path
{St }t=0,δt,...,τ for the value of the buy & hold strategy (6.111);
• Plot the evolution of the portfolio weight (6.107) of the risky asset {wt }t=0,δt,...,τ on that path;
• Scatter-plot the final payoff of the buy & hold strategy (6.111) over the payoff of the risky asset,
and verify that the profile is linear.
Hint. See Meucci (2010d).
Solution of E 261
See the MATLAB
R
script S_BuyNHold.
wt ≡ w . (6.112)
Prove that this strategy maximizes the expected final utility:
∗
w(·) ≡ argmax (E {u(Sτ )}) , (6.113)
S0 ,w(·) ∈C
sγ
u(s) = , (6.114)
γ
with γ < 1.
Hint. The strategy evolves as:
dSt
= (r + wt (µ − r))dt + wt σdBt . (6.115)
St
and the final value is lognormally distributed:
Yw(·)
Sτ = S0 e , (6.116)
where Y is a normal:
τ
σ2 2
Z
mw(·) ≡ rτ + (µ − r)wt − w dt (6.118)
0 2 t
and variance:
Z τ
s2w(·) = σ 2 wt2 dt . (6.119)
0
Solution of E 262
From (6.116) we obtain:
S0γ γY
E {u(Sτ )} = E{e w(·) } . (6.120)
γ
Since Yw(·) is normally distributed with expected value (6.118) and variance (6.119), it follows that eγY
is lognormally distributed and thus from (1.98, AM 2005) we obtain:
γYw(·) γ mw(·) + γ2 s2w
E{e }=e (·)
. (6.121)
Therefore, substituting (6.118) and (6.119), the optimal strategy (6.113) solves:
τ
σ2
Z
∗
w(·) ≡ argmax wt (µ − r) − wt2 (1 − γ) dt . (6.122)
w(·) 0 2
The solution to this problem is the value that maximizes the integrand at each time. Therefore, the solution
is the constant:
∗ 1 µ−r
w(·) ≡w≡ . (6.123)
1 − γ σ2
CHAPTER 6. OPTIMIZING ALLOCATIONS 213
F0 ≤ S0 , (6.124)
At all times t, for any level of the strategy St there is an excess cushion:
Ct ≡ max(0, St − Ft ) . (6.126)
According to the CPPI, a constant multiple m of the cushion is invested in the risky asset, therefore
obtaining the dynamic strategy’s weight for the risky asset:
mCt
w ≤ wt ≡ ≤ w. (6.127)
St
Write a MATLAB
R
script in which you:
• Generate the deterministic exponential growth dynamics (6.100) at equally spaced time intervals τ ;
• Generate a large number of Monte Carlo paths from the geometric Brownian motion (6.101) at
equally spaced time intervals [0, δt, 2δt, . . . , τ ];
• Plot one path for the value of the risky asset {Pt }t=0,δt,...,τ , and overlay the respective path
{St }t=0,δt,...,τ for the value of the CPPI strategy (6.127);
• Plot the evolution of the portfolio weight (6.107) of the risky asset {wt }t=0,δt,...,τ on that path;
• Scatter-plot the final payoff of the CPPI strategy (6.127) over the payoff of the risky asset, and
verify that the profile is convex.
Hint. See Meucci (2010d).
Solution of E 264
See the MATLAB
R
script S_CPPI.
E 265 – Option based portfolio insurance I
Consider an arbitrary payoff at the investment horizon as a function of the risky asset:
Sτ = s(Pτ ) . (6.128)
and assume that you can compute the solution G(t, p) of the following partial differential align:
∂G ∂G 1 ∂2G 2 2
+ r+ σ p − Gr = 0 , (6.129)
∂t ∂p 2 ∂p2
with boundary condition:
S0 ≡ G(0, P0 ) (6.131)
Pt ∂G(t, Pt )
wt ≡ , (6.132)
St ∂Pt
provides the desired payoff (6.128).
Hint. The strategy evolves as:
dSt
= (r + wt (µ − r))dt + wt σdBt . (6.133)
St
Solution of E 265
We want to prove that the following identity holds at all times, and in particular at t ≡ τ :
Indeed, using Ito’s rule on G((t, Pt ), where Pt follows the geometric Brownian motion (6.101) yields:
∂G ∂G 1 ∂2G
dGt = dt + dPt + (dPt )2
∂t ∂Pt 2 ∂Pt2
∂G ∂G 1 ∂2G 2 2
= dt + (µPt dt + σPt dB) + σ Pt dt (6.135)
∂t ∂Pt 2 ∂Pt2
1 ∂2G 2 2
∂G ∂G ∂G
= + µPt + 2 σ Pt dt + σPt dBt .
∂t ∂Pt 2 ∂Pt ∂Pt
CHAPTER 6. OPTIMIZING ALLOCATIONS 215
dPt
dSt = St rdt + St wt − rdt
Pt
∂G dPt
= St rdt + Pt − rdt (6.136)
∂Pt Pt
∂G
= St rdt + (µPt dt + σPt dBt − Pt rdt) .
∂Pt
Therefore:
1 ∂2G 2 2
∂G ∂G ∂G
d(Gt − St ) = + µPt + σ Pt dt + σPt dBt
∂t ∂Pt 2 ∂Pt2 ∂Pt
∂G
− St rdt − (µPt dt + σPt dBt − Pt rdt) (6.137)
∂Pt
∂G 1 ∂ 2 G 2 2
∂G
= + σ P t − S t r + P t r dt .
∂t 2 ∂Pt2 ∂Pt
d(Gt − St )
= rdt , (6.138)
(Gt − St )
Which means:
In this context the partial differential align (6.129) was solved in Black and Scholes (1973):
σ2
1 p
d1 (t, p) ≡ √ ln( ) + (r + )(τ − t)
σ τ −t K 2 (6.142)
√
d2 (t, p) ≡ d1 (t, p) − σ τ − t .
From the explicit analytical expression (6.141) we can derive the expression for the weight (6.132) of the
risky asset:
Pt
wt = Φ(d1 (t, Pt )) . (6.143)
St
Write a MATLAB
R
script in which you:
• Generate the deterministic exponential growth dynamics (6.100) at equally spaced time intervals τ ;
• Generate a large number of Monte Carlo paths from the geometric Brownian motion (6.101) at
equally spaced time intervals [0, δt, 2δt, . . . , τ ];
• Plot one path for the value of the risky asset {Pt }t=0,δt,...,τ , and overlay the respective path
{St }t=0,δt,...,τ for the value of the option replication strategy (6.143);
• Plot the evolution of the portfolio weight of the risky asset {wt }t=0,δt,...,τ on that path;
• Scatter-plot the final payoff of the option replication strategy (6.143) over the payoff of the risky
asset, and verify that it matches the option payoff.
Solution of E 266
See the MATLAB
R
script S_OptionReplication.
Chapter 7
n p o
qN
P X ∈ Eµ,Σ = p. (7.1)
p
where qN is the square root of the quantile of the chi-square distribution with N degrees of freedom
relative to a confidence level p:
q
p
qN ≡ Qχ2N (p) . (7.2)
Solution of E 267
Consider the spectral decomposition (3.149, AM 2005) of the covariance matrix:
Σ ≡ EΛE0 , (7.3)
where Λ is the diagonal matrix of the respective eigenvalues sorted in decreasing order:
Λ ≡ diag(λ1 , . . . , λN ) . (7.4)
and the matrix E is the juxtaposition of the eigenvectors, which represents a rotation:
1
Y ≡ Λ− 2 E0 (X − µ) . (7.6)
217
From (2.163, AM 2005) we obtain:
Y ∼ N(0, I) . (7.7)
Therefore from (1.106, AM 2005) and (1.109, AM 2005) it follows:
N
X
Yn2 ∼ χ2N . (7.8)
n=1
N
X
Yn2 = Y0 Y
n=1
h 1
i0 h 1
i
= Λ− 2 E0 (X − µ) Λ− 2 E0 (X − µ) (7.9)
= (X − µ)0 EΛ−1 E0 (X − µ)
= (X − µ)0 Σ−1 (X − µ) .
Therefore for the Mahalanobis distance (2.61, AM 2005) of the variable X from the point µ through the
metric Σ we obtain:
By applying the quantile function (1.17, AM 2005) to both sides of the above equality we obtain:
p 2
p = P (X − µ)0 Σ−1 (X − µ) ≤ (qN
) , (7.12)
p
where qN is the square root of the quantile of the chi-square distribution with N degrees of freedom
relative to a confidence level p:
q
p
qN ≡ Qχ2N (p) . (7.13)
q
≡ X such that (X − µ)0 Σ−1 (X − µ) ≤ q 2 ,
Eµ,Σ (7.14)
we obtain:
n p o
qN
P X ∈ Eµ,Σ = p. (7.15)
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 219
Show (7.32, AM 2005)-(7.33, AM 2005), i.e. that the posterior is, like the prior, a normal-inverse-Wishart
(NIW) distribution.
Solution of E 268
First of all, a comment on the notation to follow: we will denote here γ1 , γ2 , . . . simple normalization
constants. By the NIW (normal-inverse-Wishart) assumption (7.20, AM 2005)-(7.21, AM 2005) on the
prior:
and:
Thus from (2.156, AM 2005) and (2.224, AM 2005) the joint prior pdf of µ and Ω is:
b ∼ N(µ, [T Ω]−1 ) ,
µ (7.19)
and from (4.103, AM 2005) the distribution of the sample covariance is:
b ∼ W(T − 1, Σ) ,
TΣ (7.20)
and these variables are independent. Therefore from (2.156, AM 2005) and (2.224, AM 2005) the pdf
of current information from time series f (iT |µ, Ω) as summarized by iT ≡ (b
µ, T Σ)
b conditioned on
knowledge of the parameters (µ, Ω) reads:
1 1 0 T −1
T −N2 −2 1
f (iT |µ, Ω) = γ2 |Ω| 2 e− 2 (µ−µ) (T Ω)(µ−µ)
|Ω| Σ e− 2 tr(T ΩΣ) . (7.21)
b b 2
b b
Thus, after trivial regrouping and simplifications, the joint pdf of current information and the parameters
reads:
(7.22)
After expanding and rearranging, the terms in the curly brackets in the second row can be re-written as
follows:
{· · · } = (µ − µ1 )0 T1 Ω(µ − µ1 ) + tr(ΦΩ) , (7.23)
where:
T1 ≡ T0 + T (7.24)
T0 µ0 + T µ
µ1 ≡
b
(7.25)
T0 + T
T T0
Φ≡ µ − µ0 )0 .
µ − µ0 )(b
(b (7.26)
T0 + T
Therefore, defining:
TΣ
b + ν0 Σ0 + Φ
Σ1 ≡ , (7.27)
ν1
where ν1 is a number yet to be defined, we can re-write the joint pdf (7.22) as follows:
1 0
T −N2 −2 ν0 T +ν0 −N 1
f (iT , µ, Ω) = γ3 e− 2 (µ−µ1 ) T1 Ω(µ−µ1 ) Σ |Σ0 | 2 |Ω| 2 e− 2 tr(ν1 Σ1 Ω) . (7.28)
b
At this point we can perform the integration over (µ, Ω) to find the marginal pdf f (iT ):
Z
f (iT ) = f (iT , µ, Ω)dµdΩ
Z Z
1
− 21 (µ−µ1 )0 T1 Ω(µ−µ1 )
= γ4 γ5 |Ω| e
2
dµ
T −N2 −2 (7.29)
ν0 T +ν0 −N −1 1
Σ |Σ0 | 2 |Ω| 2
e− 2 tr(ν1 Σ1 Ω) dΩ
b
Z T −N −2 ν0 T +ν0 −N −1
b 2 1
= γ4 Σ |Σ0 | 2 |Ω| 2
e− 2 tr(ν1 Σ1 Ω) dΩ ,
where we have used the fact that the term in curly brackets is the integral of a normal pdf (2.156, AM
2005) over the entire space and thus sum to one. Defining now:
ν1 ≡ T + ν0 , (7.30)
we write (7.29) as follows:
T −N2 −2 ν0 ν
Z
ν1 ν1 −N −1
− 21 − 21 tr(ν1 Σ1 Ω)
f (iT ) = γ6 Σ |Σ0 | |Σ1 |
2
γ7 |Σ1 | |Ω|
2 2
e dΩ
b
T −N2 −2 (7.31)
ν0 ν
− 1
= γ6 Σ |Σ0 | 2 |Σ1 | 2 ,
b
where we have used the fact that the term in curly brackets is the integral of a Wishart pdf (2.224, AM
2005) over the entire space and thus sum to one. Finally, we obtain the posterior pdf (7.15, AM 2005) by
dividing the joint pdf (7.28) by the marginal pdf (7.31):
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 221
f (iT , µ, Ω)
fpo (µ, Ω) ≡
f (iT ) (7.32)
1 ν1 ν1 −N −1
− 12 (µ−µ1 )0 T1 Ω(µ−µ1 ) − 12 tr(ν1 Σ1 Ω)
= γ7 |Ω| e
2
|Σ1 | 2
|Ω| 2
e .
From (2.156, AM 2005) and (2.224, AM 2005) we see that this means:
−1
µ|Ω ∼ N(µ1 , [T1 Ω] ), (7.33)
and:
In other words:
Σ
µ|Σ ∼ N µ1 , , (7.35)
T1
and:
Σ−1
−1
Σ ∼ W ν1 , 1 . (7.36)
ν1
and:
−1
µ|Ω ∼ N(µ1 , [T1 Ω] ). (7.38)
0
θ ≡ (µ0 , vech [Ω] )0 . (7.39)
From (2.156, AM 2005) and (2.144, AM 2005) the joint NIW (normal-inverse-Wishart) pdf of µ and Ω
reads:
ν1 −N T1
1
(µ−µ1 )0 Ω(µ−µ1 )
f (θ) = f (µ|Ω)f (Ω) = γ1 |Ω| 2
e− 2 tr(ν1 Σ1 Ω) e− 2 . (7.40)
h i0 0
e≡
θ e 0 , vech Ω
µ e , (7.41)
we impose the first-order conditions on the logarithm of the joint pdf (7.40):
ν1 − N 1
ln f ≡ γ2 + ln |Ω| − tr {ν1 Σ1 Ω + T1 (µ − µ1 )(µ − µ1 )0 Ω} . (7.42)
2 2
Computing the first variation and using (A.124, AM 2005) we obtain:
1
tr (−(ν1 − N )Ω−1 + ν1 Σ1 + T1 (µ − µ1 )(µ − µ1 )0 )dΩ
d ln f ≡ −
2 (7.43)
− tr {T1 (µ − µ1 )0 Ωdµ} .
Therefore:
where:
1
(ν1 − N )Ω−1 − ν1 Σ1 − T1 (µ − µ1 )(µ − µ1 )0
GΩ ≡ (7.45)
2
Gµ ≡ −T1 (µ − µ1 )0 Ω . (7.46)
Using (A.120, AM 2005) and the duplication matrix (A.113, AM 2005) to get rid of the redundancies of
dΩ in (7.44) we obtain:
0 0
d ln f = vec [G0Ω ] DN vech [dΩ] + vec G0µ vec [dµ] .
(7.47)
∂ ln f
= vec G0µ = −T1 Ω(µ − µ1 ) .
(7.48)
∂µ
Similarly, from (A.116, AM 2005) and (A.118, AM 2005) we obtain:
∂ ln f
= D0N vec [G0Ω ]
∂ vech [Ω]
(7.49)
1
= D0N vec (ν1 − N )Ω−1 − ν1 Σ1 − T1 (µ − µ1 )(µ − µ1 )0 .
2
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 223
Applying the first-order conditions to (7.48) and (7.49) we obtain the mode of the location parameter:
e ≡ µ1 ,
µ (7.50)
e −1 = ν1
Ω Σ1 . (7.51)
ν1 − N
E 270 – Normal-inverse-Wishart location-dispersion: modal dispersion (www.7.3)
(see E 269) *
Consider the same setup than in E 269. Compute the modal dispersion (7.8, AM 2005) of the posterior
distribution of θ in (7.46, AM 2005).
Solution of E 270
To compute the modal dispersion we differentiate (7.43). Using (A.126, AM 2005) the second differential
reads:
1
tr ((ν1 − N )Ω−1 (dΩ)Ω−1 + 2T1 dµ(µ − µ1 )0 )dΩ
d(d ln f ) = −
2
− tr {T1 dµ0 Ωdµ} − tr {T1 (µ − µ1 )0 dΩdµ}
(7.52)
ν1 − N −1
tr Ω (dΩ)Ω−1 dΩ
= −
2
− T1 dµ0 Ωdµ − 2T1 tr {(µ − µ1 )0 dΩdµ} .
The first term can be expressed using (A.107, AM 2005), (A.106, AM 2005) the duplication matrix
(A.113, AM 2005) to get rid of the redundancies of dΩ as follows:
0
tr Ω−1 (dΩ)Ω−1 dΩ = vec [dΩ] vec Ω−1 (dΩ)Ω−1
We are interested in the Hessian evaluated in the mode, where (7.50) holds and thus the last term in (7.52)
cancels:
(ν1 − N ) −1
e −1 DN vech [dΩ]
d(d ln f )|µ,
e Ωe = − vech [dΩ] D0N Ω
e ⊗Ω
2 (7.54)
− T1 dµ0 Ωdµ
e .
Therefore from (A.117, AM 2005) and (A.121, AM 2005) and substituting back (7.51) we obtain:
∂ 2 ln f
ν1 − N −1
0
= −T1 Σ1 (7.55)
∂µ∂µ µ,
e Ω
e ν1
∂ 2 ln f
0
= 0(N (N +1)/2)2 ×N 2 (7.56)
∂ vech [Ω] ∂µ µ, e Ω
e
∂ 2 ln f 1 ν12
D0 (Σ1 ⊗ Σ1 )DN .
= − (7.57)
∂ vech(Ω)∂ vech(Ω)0 µ, e Ω
e 2 ν1 − N N
!−1
∂ 2 ln f
MDis {θ} ≡ − 0
∂(µ, vech(Ω))∂(µ, vech(Ω)) µ, e Ω
e
(7.58)
Sµ 0N 2 ×(N (N +1)/2)2
= ,
0(N (N +1)/2)2 ×N 2 SΣ
where:
1 ν1
Sµ ≡ Σ1 (7.59)
T1 ν1 − N
2 ν1 − N −1
SΣ ≡ [D0N (Σ1 ⊗ Σ1 )DN ] . (7.60)
ν1 ν1
Σ ∼ IW(ν1 , ν1 Σ1 ) . (7.61)
1 ν1 ν +N +1
− 1 2 1 −1
f (Σ) = |ν1 Σ1 | 2 |Σ| e− 2 tr(ν1 Σ1 Σ ) . (7.62)
κ
To determine the mode of this distribution we impose the first-order conditions on the logarithm of the
joint pdf (7.62).
ν1 + N + 1 1
ln |Σ| − tr ν1 Σ1 Σ−1 .
ln f ≡ γ2 − (7.63)
2 2
Computing the first variation and using (A.124, AM 2005) and (A.126, AM 2005):
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 225
ν1 + N + 1
d ln f = − tr(Σ−1 dΣ)
2
1
+ tr ν1 Σ1 Σ−1 (dΣ)Σ−1
(7.64)
2
1 −1 −1 −1
= tr (ν1 Σ Σ1 Σ − (ν1 + N + 1)Σ )dΣ
2
where:
1
ν1 Σ−1 Σ1 Σ−1 − (ν1 + N + 1)Σ−1 .
G≡ (7.65)
2
Using (A.120, AM 2005) and the duplication matrix (A.113, AM 2005) to get rid of the redundancies of
dΣ we obtain:
0
d ln f = vec [G0 ] DN vech [dΣ] . (7.66)
∂ ln f 1
= D0N vec [G0 ] = D0N vec ν1 Σ−1 Σ1 Σ−1 − (ν1 + N + 1)Σ−1 .
(7.67)
∂ vech [Σ] 2
Applying the first-order conditions to (7.67) we obtain the mode:
ν1
vech [ModiT ,eC ] = vech [Σ1 ] . (7.68)
ν1 + N + 1
1
d(d ln f ) = − tr(ν1 Σ−1 (dΣ)Σ−1 Σ1 Σ−1 dΣ)
2
1
− tr(ν1 Σ−1 Σ1 Σ−1 (dΣ)Σ−1 dΣ)
2
1 (7.69)
+ tr((ν1 + N + 1)Σ−1 (dΣ)Σ−1 dΣ)
2
= − ν1 tr((dΣ)Σ−1 (dΣ)Σ−1 Σ1 Σ−1 )
ν1 + N + 1
+ tr((dΣ)Σ−1 (dΣ)Σ−1 ) .
2
Using (A.107, AM 2005) and (A.106, AM 2005) and the duplication matrix (A.113, AM 2005) to get rid
of the redundancies of dΣ we can write:
a ≡ tr((dΣ)Σ−1 (dΣ)Σ−1 )
0
= vec [dΣ] vec Σ−1 (dΣ)Σ−1
0 (7.70)
= vec [dΣ] (Σ−1 ⊗ Σ−1 ) vec [dΣ]
0
= vech [dΣ] D0N (Σ−1 ⊗ Σ−1 )DN vech [dΣ] .
Similarly, using (A.107, AM 2005) and (A.106, AM 2005) and the duplication matrix (A.113, AM 2005)
to get rid of the redundancies of dΣ we can write:
ν1 + N + 1 0
d(d ln f ) = −ν1 b + a = vech [dΣ] H vech [dΣ] , (7.72)
2
where:
ν1 + N + 1 0
H ≡ −ν1 D0N ((Σ−1 Σ1 Σ−1 ) ⊗ Σ−1 )DN + DN (Σ−1 ⊗ Σ−1 )DN . (7.73)
2
We are interested in the Hessian evaluated in the mode, where (7.68) holds, i.e. in the point
ν1
Σ≡ Σ1 . (7.74)
ν1 + N + 1
In this point:
0
d(d ln f )|Mod = vech [dΣ] H|Mod vech [dΣ] , (7.75)
where:
3
ν1 + N + 1
H|Mod ≡ − ν1 D0N (Σ−1 −1
1 ⊗ Σ1 )DN
ν1
2
ν1 + N + 1 ν1 + N + 1
+ D0N (Σ−1 −1
1 ⊗ Σ1 )DN
(7.76)
2 ν1
1 (ν1 + N + 1)3 0
= − DN (Σ−1 −1
1 ⊗ Σ1 )DN .
2 ν12
Therefore:
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 227
−1
∂ 2 ln f [Σ]
MDis ≡ − 0
∂ vech [Σ] ∂ vech [Σ] Mod
(7.78)
2ν12
= (D0 (Σ−1 ⊗ Σ−1
1 )DN )
−1
.
(ν1 + N + 1)3 N 1
E 273 – Normal-inverse-Wishart location-dispersion: marginal distribution of lo-
cation (www.7.5) **
Show (7.22, AM 2005), i.e. that the unconditional (marginal) prior on µ is a multivariate Student t
distribution.
Solution of E 273
First of all, a comment on the notation to follow: we will denote here γ1 , γ2 , . . . simple normalization
constants. We consider the notation for the NIW normal-inverse-Wishart) assumptions (7.20, AM 2005)-
(7.21, AM 2005) on the prior, although of course the solution applies verbatim to the posterior, or any
NIW distribution. Thus we assume:
Σ2 ≡ ν0 Σ0 + T0 (µ − µ0 )(µ − µ0 )0 , (7.82)
we obtain:
Z
f (µ) ≡ f (µ, Ω)dΩ
Z ν0 ν0 −N 1
= γ1 |Σ0 | 2
|Ω| 2
e− 2 tr(Σ2 Ω) dΩ
Z (7.83)
ν0 ν0 +1 ν0 +1 ν0 −N
− 1
= γ2 |Σ0 | 2
|Σ2 | 2
γ3 |Σ2 | 2 |Ω| 2 e− 2 tr(Σ2 Ω) dΩ
ν0 ν0 +1
−
= γ2 |Σ0 | 2
|Σ2 | 2
,
where we have used the fact that the term in curly brackets is the integrals of the Wishart pdf (2.224, AM
2005) over the entire space and thus it sums to one. Thus substituting again (7.82) we obtain that the
marginal pdf (7.83) reads:
ν0 ν0 +1
−
f (µ) = γ2 |Σ0 | 2
|ν0 Σ0 + T0 (µ − µ0 )(µ − µ0 )0 | 2
. (7.84)
From (A.91, AM 2005) we obtain the following identity:
ν0
−
ν0 +1 ν0 − ν02+1
|Σ + vv0 | |Σ| I + Σ−1 vv0
|Σ| 2 2
= |Σ| 2
1 − ν0 +1 (7.85)
= |Σ| 2 I + Σ−1 vv0 2
ν +1
− 12 − 02
= |Σ| (1 + v0 Σ−1 v) .
Applying this result to:
p
v ≡ (µ − µ0 ) T0 (7.86)
Σ ≡ ν0 Σ0 , (7.87)
we reduce (7.84) to the following expression:
1 − ν02+1
Σ0 − 2
1 + 1 (µ − µ0 )0 ( Σ0 )−1 (µ − µ0 )
f (µ) = γ4
. (7.88)
T0 ν0 T0
By comparison with (2.188, AM 2005) we see that this is a multivariate Student t distribution with the
following parameters:
Σ0
µ ∼ St ν0 , µ0 , . (7.89)
T0
E 274 – Normal-inverse-Wishart factor loadings-dispersion: posterior distribution
(www.7.6) **
Show (7.71, AM 2005)-(7.72, AM 2005), i.e. that the posterior distribution of B and Σ is, like the prior,
a normal-inverse-Wishart (NIW) distribution.
Solution of E 274
First of all, a comment on the notation to follow: we will denote here γ1 , γ2 , . . . simple normalization
constants. By the NIW (normal-inverse-Wishart) assumptions (7.58, AM 2005)-(7.59, AM 2005) on the
prior we have:
Σ
B|Σ ∼ N B0 , , Σ−1 , (7.91)
T0 F,0
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 229
B|Ω ∼ N B0 , (T0 Ω)−1 , Σ−1
F,0 . (7.92)
Thus from (2.182, AM 2005) and (2.224, AM 2005) the joint prior pdf of B and Ω is:
The current information conditioned on the parameters B and Ω is summarized by the OLS factor load-
ings and sample covariance:
n o
iT ≡ B,
b Σ
b . (7.94)
Σ b −1
B ∼ N B, , ΣF
b , (7.95)
T
b ∼ W(T − K, Σ) .
TΣ (7.96)
(7.97)
Thus, after trivial regrouping and simplifications, the joint pdf of current information and the parameters
reads:
1
× e− 2 tr(Ω(T Σ+ν0 Σ0 )) .
b
We show below that the terms in curly brackets in (7.98) can be re-written as follows:
{· · · } = T1 Ω(B − B1 )ΣF,1 (B − B1 )0 + ΩΦ , (7.99)
where:
T1 ≡ T0 + T (7.100)
T0 ΣF,0 + T Σ
bF
ΣF,1 ≡ (7.101)
T1
B1 ≡ (B0 T0 ΣF,0 + BT
b Σ b F )−1
b F )(T0 ΣF,0 + T Σ (7.102)
and:
Φ ≡ B0 T0 ΣF,0 B00 + BT
b ΣbFBb0
(7.103)
− (B0 T0 ΣF,0 + BTb Σ b F )−1 (T0 ΣF,0 B0 + T Σ
b F )(T0 ΣF,0 + T Σ b 0) .
bFB
0
a ≡ (B − B0 )D(B − B0 )0 + (B − B)C(B
b b 0
− B)
= BDB0 + B0 DB0 − 2BDB0 + BCB0 + BC
0 0
b B b 0 − 2BCB
b0
0
= B(D + C)B + B0 DB00 − 2BDB00 + BC
b Bb 0 − 2BCB
b0
= B(D + C)B + B1 (D + C)B01 − 2B(D + C)B01
0
+ B0 DB0 − 2BDB0 + BC
b Bb 0 − 2BCB
b0 (7.104)
0 0
− B1 (D + C)B01 + 2B(D + C)B01
= (B − B1 )(D + C)(B − B1 )0
+ B0 DB00 + BC
b Bb 0 − 2BDB0 − 2BCB
0
b0
− B1 (D + C)B01 + 2B(D + C)B01 ,
defining:
B1 ≡ (B0 D + BC)(D
b + C)−1 , (7.105)
the above simplifies to:
a = (B − B1 )(D + C)(B − B1 )0
(7.106)
+ B0 DB0 + BC
0
b Bb 0 − (B0 D + BC)(D
b + C)−1 (B0 D + BC)
b 0,
ν1 ≡ T + ν0 (7.107)
TΣb + ν0 Σ0 + Φ
Σ1 ≡ , (7.108)
ν1
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 231
we obtain:
At this point we can perform the integration over (B, Ω) to determine the marginal pdf f (iT ):
Z
f (iT ) = f (iT , B, Ω)dBdΩ
Z Z
K N 0
γ5 |Ω| 2 |ΣF,1 | 2 e− 2 tr{T1 Ω(B−B1 )ΣF,1 (B−B1 ) } dB
1
= γ4
N2 T −K−N −1
2 −N N
× Σ Σ |ΣF,1 | 2 |ΣF,0 | 2
b b
F (7.110)
ν0 ν1 −N −1
− 21 tr(Ων 1 Σ1 )
× |Σ0 | |Ω| 2
e 2
dΩ
Z N T −K−N −1
b 2 b 2 −N N
= γ4 Σ F Σ |ΣF,1 | 2 |ΣF,0 | 2
ν0 ν1 −N −1 1
× |Σ0 | 2
|Ω| 2
e− 2 tr(Ων 1 Σ1 ) dΩ ,
where we used the fact that the expression in curly brackets is the integral of the pdf of a matrix-valued
normal distribution (2.182, AM 2005) over the entire space and thus sums to one. Thus we can write
(7.110) as follows:
Z
ν1 ν1 −N −1 1
f (iT ) = γ5 γ6 |Σ1 | 2
|Ω| 2
e− 2 tr(ν1 Σ1 Ω) dΩ
N2 T −K−N −1
ν0 ν
2 −N N
− 1 (7.111)
× Σ Σ |ΣF,1 | 2 |ΣF,0 | 2 |Σ0 | 2 |Σ1 | 2
b b
F
N2 T −K−N −1
ν0 ν
2 −N N
− 1
= γ5 Σ Σ |ΣF,1 | 2 |ΣF,0 | 2 |Σ0 | 2 |Σ1 | 2 ,
b b
F
where we used the fact that the term in curly brackets is the integral of the pdf of a Wishart distribution
(2.224, AM 2005) over the entire space and thus sums to one. Finally, we obtain the posterior pdf (7.15,
AM 2005) by dividing the joint pdf by the marginal pdf:
f (iT , B, Ω)
fpo (B, Ω) ≡
f (iT )
N ν1 K+ν1 −N −1
= γ7 |ΣF,1 | 2 |Σ1 | 2
|Ω| 2
0 (7.112)
× e− 2 tr{T1 Ω(B−B1 )ΣF,1 (B−B1 ) } e− 2 tr(Ων1 Σ1 )
1 1
K N 0
= γ8 |Ω| 2 |ΣF,1 | 2 e− 2 tr{T1 Ω(B−B1 )ΣF,1 (B−B1 ) }
1
ν1 ν1 −N −1 1
× γ9 |Σ1 | 2
|Ω| 2
e− 2 tr(Ων1 Σ1 ) .
and:
Ω ∼ W ν1 , (ν1 Σ1 )−1 .
(7.114)
Σ−1
−1 1
Σ ∼ W ν1 , , (7.115)
ν1
and:
Σ
B|Σ ∼ N B1 , , Σ−1 . (7.116)
T1 F,1
0 0
θ ≡ (vec [B] , vech [Ω] )0 . (7.117)
and:
From (2.182, AM 2005) and (2.224, AM 2005) the joint NIW (normal-inverse-Wishart) pdf of B and Ω
reads:
h i0 h i0 0
e≡
θ vec B
e , vech Ω
e , (7.121)
we impose the first-order condition on the logarithm of the joint pdf (7.120):
ν1 + K − N − 1
ln f ≡ γ2 + ln |Ω|
2 (7.122)
1
− tr {[(B − B1 )T1 ΣF,1 (B − B1 )0 + ν1 Σ1 ] Ω} .
2
To compute the first variation we use (A.124, AM 2005) obtaining:
1
tr (ν1 + K − N − 1)Ω−1 − a dΩ
d ln f ≡
2 (7.123)
− tr {T1 ΣF,1 (B − B1 )0 ΩdB} ,
where:
Therefore:
where:
1
(ν1 + K − N − 1)Ω−1 − a
GΩ ≡ (7.126)
2
GB ≡ −T1 ΣF,1 (B − B1 )0 Ω . (7.127)
Using (A.120, AM 2005) and the duplication matrix (A.113, AM 2005) to get rid of the redundancies of
dΩ in (7.125) we obtain:
0 0
d ln f = vec [G0Ω ] DN vech [dΩ] + vec [G0B ] vec [dB] . (7.128)
∂ ln f
= vec [G0B ] = −T1 vec [Ω(B − B1 )ΣF,1 ] . (7.129)
∂ vec [B]
∂ ln f 1
= D0N vec [G0Ω ] = D0N vec (ν1 + K − N − 1)Ω−1 − a .
(7.130)
∂ vech [Ω] 2
Applying the first-order conditions to (7.129) and (7.130) and re-substituting (7.124) we obtain the mode
of the factor loadings:
e ≡ B1 ,
B (7.131)
e −1 = ν1
Ω Σ1 . (7.132)
ν1 + K − N − 1
E 276 – Normal-inverse-Wishart factor loadings-dispersion: modal dispersion (www.7.7)
(see E 275) *
Consider the same setup than in E 275. Prove the expression (7.82, AM 2005) for the modal dispersion
(7.8, AM 2005) of the posterior distribution of θ.
Solution of E 276
To compute the modal dispersion we differentiate (7.123). Using (A.126, AM 2005) the second differen-
tial reads:
1
tr (ν1 + K − N − 1)Ω−1 (dΩ)Ω−1 + 2T1 dBΣF,1 (B − B1 )0 dΩ
d(d ln f ) = −
2
− tr {T1 ΣF,1 dB0 ΩdB} − tr {T1 ΣF,1 (B − B1 )0 dΩdB}
(7.133)
ν1 + K − N − 1 −1
tr Ω (dΩ)Ω−1 dΩ
= −
2
− T1 tr {ΣF,1 dB0 ΩdB} − 2T1 tr {ΣF,1 (B − B1 )0 dΩdB} .
The first term in (7.133) can be expressed using (A.107, AM 2005), (A.106, AM 2005) the duplication
matrix (A.113, AM 2005) to get rid of the redundancies of dΩ as follows:
0
tr Ω−1 (dΩ)Ω−1 dΩ = vec [dΩ] vec Ω−1 (dΩ)Ω−1
Similarly, the second term in (7.133) can be expressed using (A.107, AM 2005), (A.106, AM 2005),
(A.108, AM 2005) and (A.109, AM 2005):
Since we are interested in the Hessian evaluated in the mode, where (7.131) holds. Therefore the last
term in (7.133) cancels and we can express the second differential (7.133) as follows:
CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS 235
ν1 + K − N − 1 −1
e −1 DN vech [dΩ]
d(d ln f )|B,
e Ωe = − vech [dΩ] D0N Ω
e ⊗Ω
2 (7.136)
0
− T1 vec [dB] KN K (Ω
e ⊗ ΣF,1 )KKN vec [dB] .
Therefore from (A.117, AM 2005) and (A.121, AM 2005) and substituting back (7.132) we obtain:
∂ 2 ln f
ν1 + K − N − 1
KN K (Σ−1
0 = −T1 1 ⊗ ΣF,1 )KKN
∂ vec [B] ∂ vec [B] B,e Ω
e ν1
∂ 2 ln f
0 = 0(N (N +1)/2)2 ×(N K)2 (7.137)
∂ vech [Ω] ∂ vec [B] B, e Ω
e
∂ 2 ln f ν12
1
D0 (Σ1 ⊗ Σ1 )DN .
= −
∂ vech(Ω)∂ vech(Ω)0 B, e Ω
e 2 ν1 + K − N − 1 N
−1
∂ 2 ln f
SB 0(N K)2 ×(N (N +1)/2)2
MDis {θ} ≡ − = , (7.138)
∂θ∂θ 0 θe 0(N (N +1)/2)2 ×(N K)2 SΣ
1 ν1
SB ≡ KN K (Σ1 ⊗ Σ−1
F,1 )KKN (7.139)
T1 ν1 + K − N − 1
2 ν1 + K − N − 1 0 −1
SΣ ≡ [DN (Σ1 ⊗ Σ1 )DN ] . (7.140)
ν1 ν1
E 277 – Normal-inverse-Wishart factor loadings-dispersion: marginal distribution
of factor loadings (www.7.8) *
Prove the expression (7.60, AM 2005) for the unconditional (marginal) prior on B.
Solution of E 277
First of all, a comment on the notation to follow: we will denote here γ1 , γ2 , . . . simple normalization
constants. We consider the notation for the NIW (normal-inverse-Wishart) assumptions (4.129, AM
2005)-(7.59, AM 2005) on the prior, although of course the solution applies verbatim to the posterior, or
any NIW distribution. Thus we assume:
and:
From (A.182, AM 2005) and (A.224, AM 2005) the joint prior pdf of B and Ω is:
f (B, Ω) = f (B|Ω)f (Ω)
K N 0
= γ1 |Ω| 2 |ΣF,0 | 2 e− 2 tr{(T0 Ω)(B−B0 )ΣF,0 (B−B0 ) }
1
ν0 ν0 −N −1 1
× |Σ0 | 2
|Ω| 2
e− 2 tr(ν0 Σ0 Ω) (7.143)
N ν0 ν0 +K−N −1
= γ1 |ΣF,0 | 2
|Σ0 | 2
|Ω| 2
we obtain:
Z
f (B) ≡ f (B, Ω)dΩ
Z ν0 ν0 +K−N −1
N 1
= γ1 |ΣF,0 | 2 |Σ0 | 2
|Ω| 2
e− 2 tr{ΩΣ2 } dΩ
Z (7.145)
N ν0 ν0 +K ν0 +K ν0 +K−N −1
− − 12 tr{ΩΣ2 }
= γ2 |ΣF,0 | 2
|Σ0 | 2
|Σ2 | 2
γ3 |Σ2 | 2
|Ω| 2
e dΩ
N ν0 ν0 +K
−
= γ2 |ΣF,0 | 2 |Σ0 | 2
|Σ2 | 2
,
where we have used the fact that the term in curly brackets is the integrals of the Wishart pdf (2.224, AM
2005) over the entire space and thus it sums to one. Thus substituting again (7.144) we obtain that the
marginal pdf (7.145) reads:
N ν0 ν0 +K
−
f (B) = γ2 |ΣF,0 | 2 |Σ0 | 2
|ν0 Σ0 + (B − B0 )T0 ΣF,0 (B − B0 )0 | 2
. (7.146)
ν0
−
ν0 +K ν0 − ν0 +K
|Σ + vv0 | |Σ| IN + Σ−1 vv0
|Σ| 2 2
= |Σ| 2 2
−K − ν0 +K
= |Σ| 2 IN + Σ−1 vv0 2 (7.147)
−K − ν0 +K
= |Σ| 2 IK + v0 Σ−1 v 2
.
Applying this result to:
v ≡ (B − B0 )pF,0 (7.148)
Σ ≡ ν0 Σ0 , (7.149)
ν0 +K
IN + (ν0 Σ0 )−1 (B − B0 )T0 ΣF,0 (B − B0 )0 − 2 .
N
−K
f (B) = γ4 |ΣF,0 | 2 |ν0 Σ0 | 2
(7.151)
− N2
−K
f (B) = γ4 Σ−1 |ν0 Σ0 | 2
F,0
− ν0 +K
× IK + T0 ΣF,0 (B − B0 )0 (ν0 Σ0 )−1 (B − B0 )
2
− N2 K (7.152)
= γ5 Σ−1
(ν0 + K − N )−1 ν0 Σ0 − 2
F,0
− ν0 +K
−1 2
(ν0 + K − N )(ν0 Σ0 )
× IK + T0 ΣF,0 (B − B0 )0 (B − B0 ) .
(ν0 + K − N )
Comparing with (2.199, AM 2005) we see that this is the pdf of a matrix-variate Student t distribution
with the following parameters:
ν0
B ∼ St ν0 + K − N, B0 , Σ0 , (T0 ΣF,0 )−1 . (7.153)
ν0 + K − N
C1 : α0 pT = wT , (7.154)
and:
C2 : g ≤ Gα ≤ g , (7.155)
where G is a K × N matrix and (g , g) are K-dimensional vectors. From (7.91, AM 2005) we obtain the
allocation function:
1 0
α(µ, Σ) ≡ argmax α0 diag(pT )(1 + µ) − α diag(pT )Σ diag(pT )α . (7.156)
α0 pT =wT
2ζ
g≤Gα≤g
We can solve this problem by means of Lagrange multipliers. We define the Lagrangian:
1 0
L ≡ α0 diag(pT )(1 + µ) − α diag(pT )Σ diag(pT )α
2ζ (7.157)
− λα0 pT − (γ − γ)0 Bα ,
where λ is the multiplier relative to the equality constraint α0 pT = wT and (Λ, Λ) are the multipliers
relative to the additional inequality constraints (7.155) and satisfy the Kuhn-Tucker conditions:
γ, γ ≥ 0 (7.158)
N
X N
X
γ k Gkn g n = γ k Gkn g n = 0, k = 1, . . . , K . (7.159)
n=1 n=1
Therefore, defining:
e ≡ µ − [diag(pT )]−1 G0 (γ − γ) ,
µ (7.160)
1 0
L = α0 diag(pT )(1 + µ
e ) − λα0 − α diag(pT )Σ diag(pT )α . (7.161)
2ζ
This is the Lagrangian of the optimization (7.156) with the constraints (7.154) but without the constraints
(7.155). Its solution is (6.39, AM 2005). After substituting (7.90, AM 2005) in that expression we obtain
the respective allocation function:
wT − ζ10 Σ−1 µ
−1
µ, Σ) 7→ α(e
µ, Σ) ≡ [diag(pT )] Σ−1 ζ µ
e
(e e+ 1 . (7.162)
10 Σ−1 1
This can be inverted, by pinning down specific values Σ for the covariance matrix and solving the ensuing
implicit align:
−1
10 Σ
1 µ wT
e− Σ diag(pT )α −
e
µ −1 1 = ζ −1 1 . (7.163)
0
1Σ 1 10 Σ 1
From the inverse function:
α 7→ µ
e (α) , (7.164)
and from (7.160) the implied returns that include the constraints (7.155) read:
−1
µc = µ
e (α) + [diag(pT )] G0 (γ − γ) . (7.165)
Solution of E 279
In our example (7.91, AM 2005), consider an investor who has no risk propensity, i.e. such that ζ →
0 in his exponential utility function. Then the quadratic term becomes overwhelming in the index of
satisfaction, which becomes independent of the expected returns:
1 0
CEΣ (α) ≈ − α diag(pT )Σ diag(pT ) . (7.166)
2ζ
Assume there exists a budget constraint:
C1 : α0 pT = wT , (7.167)
C2 : α ≥ 0 . (7.168)
where:
Λ ≥ 0, λn = 0 ⇐⇒ αn > 0 . (7.172)
Σ−1 1 ≥ 0 , (7.173)
iT ≡ {X1 , . . . , XT } , (7.175)
reads:
T
Y
l(iT |θ) ≡ fX (Xt |θ) . (7.176)
t=1
Assume a prior for the parameters f0 (θ). Then posterior distribution of the parameters reads:
see (7.15, AM 2005). To generate samples from the posterior distribution we use the Metropolis-Hastings
algorithm.
R First we select a one-parameter family of candidate-generating densities q(ξ, θ), which satis-
fies q(ξ, θ)dθ = 1. Then we define the function:
l(iT |ξ)f0 (ξ)q(ξ, θ)
α(θ, ξ) ≡ min ,1 . (7.178)
l(iT |θ)f0 (θ)q(θ, ξ)
In particular, if we choose a symmetric function q(ξ, θ) = q(θ, ξ), this function simplifies to:
l(iT |ξ)f0 (ξ)
α(θ, ξ) ≡ min ,1 . (7.179)
l(iT |θ)f0 (θ)
A convenient rule of thumb is to pick q to be the multivariate normal density:
Solution of E 280
See the MATLAB
R
script S_MarkovChainMonteCarlo
Xt ∼ N(µ, Σ) , (7.181)
0 1 θ12 θ13
µ≡ 0 , Σ ≡ θ12 1 θ23 . (7.182)
0 θ13 θ23 1
In this situation the joint distribution of the returns is fully determined by three parameters:
Since Σ is positive definite, the domain Θ must be a proper subset of (−1, 1) × (−1, 1) × (−1, 1). For
instance, Θ ≡ −(0.9, 0.9, 0.9)0 is not a feasible value. Assume an uninformative uniform prior for the
correlations. In other words, assume that θ is uniformly distributed on its domain:
θ ∼ U(Θ) . (7.185)
Write a MATLAB
R
script in which you generate 10,000 simulations from (7.185). In three subplots
plot the histograms of θ12 , θ13 and θ23 respectively, showing how the uniform prior implies non-uniform
marginal distributions on each of the correlations.
Hint. Generate a uniform distribution on (−1, 1)3 then discard the simulations such that Σ is not positive
definite.
Solution of E 281
See the MATLAB
R
script S_CorrelationPriorUniform.
Evaluating allocations
1 0
S = α0 diag(pT )(1 + µ) − α diag(pT )Σ diag(pT )α . (8.1)
2ζ
Substituting in this expression the optimal allocation (8.32, AM 2005), which we report here:
−1 wT − ζ10 Σ−1 µ −1
α = ζ [diag(pT )] Σ−1 µ + [diag(pT )] Σ−1 1 , (8.2)
10 Σ−1 1
we obtain:
wT − ζ10 Σ−1 µ −1
0 −1
S = (1 + µ) ζΣ µ + Σ 1
10 Σ−1 1
wT − ζ10 Σ−1 µ 0 wT − ζ10 Σ−1 µ −1
1 0 −1
− ζµ + 1 ζΣ µ + Σ 1 (8.3)
2ζ 10 Σ−1 1 10 Σ−1 1
wT − ζ10 Σ−1 µ
= ζ(1 + µ)0 Σ−1 µ + (1 + µ)0 Σ−1 1 .
10 Σ−1 1
Defining:
243
wT − ζB wT − ζB
S = ζB + ζC + A+ B
A A
1 2 wT − ζB wT − ζB wT − ζB 2
− ζ C +ζ B+ζ B+( ) A
2ζ A A A
wT − ζB
= ζB + ζC + wT − ζB + B (8.5)
A
−2BwT + ζB 2 1 wT2
1 wT − ζB
− ζC + 2 B+ −
2 A A 2ζ A
B2
1 B 1 wT
= ζ C− + wT 1 + − .
2 A A 2ζ A
1
b ∼ N µ, Σ ,
µ b ∼ W(T − 1, Σ) .
TΣ (8.6)
T
where W denotes the Wishart distribution. Define:
vb ≡ α0 diag(pT )Σ
b diag(pT )α . (8.7)
where Ga denotes the gamma distribution. Thus from (1.113, AM 2005) the expected value of vb reads:
T −1 0
E {b
v} = α diag(pT )Σ diag(pT )α , (8.9)
T
and from (1.114, AM 2005) the inefficiency of vb reads:
r
T −1 0
Sd {b
v} = 2 α diag(pT )Σ diag(pT )α . (8.10)
T2
Similarly, define:
eb ≡ α0 diag(pT )(1 + µ
b) . (8.11)
α0 diag(pT )Σ diag(pT )α
0
eb ∼ N α diag(pT )(1 + µ), . (8.12)
T
e} = α0 diag(pT )(1 + µ) ,
E {b (8.13)
r
α0 diag(pT )Σ diag(pT )α
Sd {b
e} = . (8.14)
T
Furthermore, since µ
b and Σ
b are independent, so are vb and eb.
Optimizing allocations
n h io
µ[i ],Σ[i
b T]
αrs [iT ] ≡ E αs IT T
b
n o n w o
−1 T −1
= E ζ [diag(pT )] Vu + E 0
[diag(pT )] V1
0 1V1
ζ1 Vu −1
−E [diag(pT )] V1
10 V1
−1 −1 V1
= ζ [diag(pT )] E {V} E {u} + wT [diag(pT )] E
10 V1 (9.1)
−1 0 V1
− ζ [diag(pT )] E {u} E V1
10 V1
−1 −1 V1
= ζ [diag(pT )] E {V} µ b + wT [diag(pT )] E
10 V1
−1 0 V1
− ζ [diag(pT )] µ b E V1 .
10 V1
Therefore:
0
−1 1 Vbµ V1
αrs [iT ] = [diag(pT )] ζ E {Vb
µ} − E V1 + wT E . (9.2)
10 V1 10 V1
246
CHAPTER 9. OPTIMIZING ALLOCATIONS 247
Σt
b ∼ N µt ,
µ , (9.3)
T
where µt and Σt are the true underlying parameters. Therefore from (9.53, AM 2005) we have:
−1
Σt
µ − µt )0
(b µ − µt ) ∼ χ2N .
(b (9.4)
T
( −1 )
Σt
t 0 t
Fχ2N (T γ) ≡ P (b
µ−µ ) µ − µ ) ≤ Tγ
(b
T (9.5)
b )0 (Σt )−1 (µt − µ
= P (µt − µ
b) ≤ γ .
By applying the quantile function (1.17, AM 2005) to both sides of the above equality we obtain:
Qχ2N (p)
t 0 t −1 t
p = P (µ − µ
b) Σ (µ − µ
b) ≤ . (9.6)
T
Qχ2N (p)
Θ≡ b , Σt ) ≤
µ ∈ RN | Ma2 (µt , µ , (9.7)
T
P µt ∈ Θ = p .
(9.8)
fX,V (X, V)
fX|v (X|V) ≡ , (9.9)
fV (V)
Z
fV (v) ≡ fX,V (x, v)dx , (9.10)
is the marginal pdf of V. On the other hand, by the definition of the conditional density we also have:
Thus:
− 21
|Σ| 1 0 −1
fX (x) ≡ N e− 2 (x−µ) Σ (x−µ)
, (9.13)
(2π) 2
− 12
|Ω| 1 0 −1
fV|Px (v|x) ≡ K e− 2 (v−Px) Ω (v−Px)
. (9.14)
(2π) 2
We define µ
e in such a way that the following holds:
−1
Σ µ + P0 Ω−1 v ≡ (Σ−1 + P0 Ω−1 P)e
µ. (9.17)
This implies:
where:
α = µ0 Σ−1 µ + v0 Ω−1 v
− (µ0 Σ−1 + v0 Ω−1 P)(Σ−1 + P0 Ω−1 P)−1 (Σ−1 µ + P0 Ω−1 v)
= µ0 Σ−1 µ + v0 Ω−1 v − µ0 Σ−1 (Σ−1 + P0 Ω−1 P)−1 Σ−1 µ
− v0 Ω−1 P(Σ−1 + P0 Ω−1 P)−1 P0 Ω−1 v
(9.21)
+ 2µ0 Σ−1 (Σ−1 + P0 Ω−1 P)−1 P0 Ω−1 v
= v0 Ω−1 − Ω−1 P(Σ−1 + P0 Ω−1 P)−1 P0 Ω−1 v
Using the identity (A.90, AM 2005) we write the expression in curly brackets as follows:
Also, we define v
e in such a way that:
Therefore:
where:
does not depend on either V or X. Therefore neither does φ in (9.25). Substituting (9.24) back in (9.19)
the expression in square brackets in (9.15) reads:
− 21 − 21 1 0 −1
+P0 Ω−1 P)(x−µ(v))
fX,V (x, v) ∝ |Σ| |Ω| e− 2 (x−µ(v))
e (Σ e
1 0 0 −1
× e− 2 (v−ev) (Ω+PΣP ) (v−ev)
1 0
(9.28)
1
(Σ−1 +P0 Ω−1 P)(x−µ(v))
= Σ−1 + P0 Ω−1 P 2 e− 2 (x−µ(v))
e e
− 12 1 0 0 −1
× |Ω + PΣP0 | e− 2 (v−ev) (Ω+PΣP ) (v−e
v)
,
|Ω + PΣP0 |
= 1, (9.29)
|Σ| |Ω| Σ−1 + P0 Ω−1 P
= |Ω + PΣP0 | .
where:
1 1 0
(Σ−1 +P0 Ω−1 P)(x−µ(v))
fX|v (x|v) ∝ Σ−1 + P0 Ω−1 P 2 e− 2 (x−µ(v))
e e
, (9.32)
and:
− 12 1 0 0 −1
fV (v) ∝ |Ω + PΣP0 | e− 2 (v−ev) (Ω+PΣP ) (v−e
v)
. (9.33)
Since (9.32) and (9.33) are normal pdfs, it follows that the random variable X conditioned on V = v is
normally distributed:
CHAPTER 9. OPTIMIZING ALLOCATIONS 251
X|v = v ∼ N(e
µ, Σ)
e , (9.34)
V ∼ N(e
v, Ω)
e , (9.35)
Noticing that:
which can be easily checked by left-multiplying both sides by (PΣP0 + Ω), the expression for the
expected value µ
e (v) in (9.34) can be further simplified as follows:
Similarly, from (9.32) and using (A.90, AM 2005) the covariance matrix in (9.34) reads:
e ≡ Ω + PΣP0 .
Ω (9.40)
Q
S≡ , (9.41)
P
where Q is an arbitrary full-rank (N − K) × N matrix. It will soon become evident that the choice of
Q is irrelevant. Then we compute the pdf of the following random variable:
QX YA
Y ≡ SX = ≡ . (9.42)
PX YB
Y ∼ N(ν, T) , (9.43)
where:
νA Qµ
ν≡ = , (9.44)
νB Pµ
and:
QΣQ0 QΣP0
TAA TAB
T≡ ≡ . (9.45)
TBA TBB PΣQ0 PΣP0
At this point we can compute the conditional pdf. From (2.164, AM 2005) we obtain:
ξ ≡ ν A + TAB T−1
BB (yB − ν B ) (9.47)
Φ ≡ TAA − TAB T−1
BB TBA . (9.48)
E {YA |YB = v}
E {Y|YB = v} =
v
(9.49)
Qµ + QΣP0 (PΣP0 )−1 (v − Pµ)
= .
v
Recalling that Y = SX and rewriting v as Pµ + PΣP0 (PΣP0 )−1 (v − Pµ) we can express (9.49) as
follows:
which is the expression of the conditional expectation that we were looking for.
Cov {YA |YB = v} 0
Cov {Y|YB = v} =
0 0
Φ 0
= (9.52)
0 0
QΣQ0 − QΣP0 (PΣP0 )−1 PΣQ0
0
= .
0 0
as follows:
a = Cov {SX|PX = v}
Q(Σ − ΣP0 (PΣP0 )−1 PΣ)Q0 0
=
0 0
Q(Σ − ΣP (PΣP ) PΣ)Q Q(Σ − ΣP0 (PΣP0 )−1 PΣ)P0
0 0 −1 0
(9.54)
=
P(Σ − ΣP0 (PΣP0 )−1 PΣ)Q0 P(Σ − ΣP0 (PΣP0 )−1 PΣ)P0
Q 0
Q
= Σ − ΣP0 (PΣP0 )−1 PΣ .
P P
Since S is invertible we can pre- and post- multiply (9.53) by S−1 and finally obtain:
which is the expression of the conditional covariance that we were looking for.
E 293 – Computations for the robust version of the leading example (www.9.5) *
Show that using the uncertainty set (9.108, AM 2005) in (9.105, AM 2005) the ensuing robust allocation
decision solves problem (9.111, AM 2005).
Solution of E 293
From (8.33, AM 2005), (8.25, AM 2005) and (8.29, AM 2005) we obtain:
0 −1
ζ
µ − A1 (10 Σ−1 µ)2 )
2 (µ Σ
α∗ ≡ argmin max +wT (1 + A1 10 Σ−1 µ − wζT 2A
1
)
α µ∈θb p 0 1 0
−α diag(pT )(1 + µ) + 2ζ α Φα
(9.56)
0
α pT = wT √
s.t.
(1 − γ)wT − α0 diag(pT )(1 + µ) + 2α0 Φαλ ≤ 0, for all µ ∈ Θ
bp,
where:
A ≡ 10 Σ−1 1 (9.57)
−1
λ ≡ erf (2c − 1) (9.58)
Φ ≡ diag(pT )Σ diag(pT ) , (9.59)
and:
QN (p)
bp ≡
Θ b )0 Σ−1 (µ − µ
µ | (µ − µ b) ≤ . (9.60)
T
Using the budget constraint this becomes:
( )
ζ 0 −1 ζ
(10 Σ−1 µ)2 + wAT (10 Σ−1 µ)
2µ Σ µ − 2A
α∗ ≡ argmin max 0
α µ∈Θ
cp −α diag(pT )µ + 2ζ1
α0 Φα
(9.61)
α0 pT = wT
s.t. √
α0 diag(pT )µ ≥ 2α0 Φαλ − γwT , for all µ ∈ Θ
bp,
or:
( )
ζ 0 −1 ζ
(10 Σ−1 µ)2 + wAT (10 Σ−1 µ)
2µ Σ µ − 2A
α∗ ≡ argmin max 0
α µ∈Θ
cp −α diag(pT )µ + 2ζ1
α0 Φα
(9.62)
α0 pT = wn
(
T
s.t. √ o
maxµ∈Θcp 2α0 Φαλ − α0 diag(pT )µ ≤ γwT ,
n√ o
max 2α0 Φαλ − α0 diag(pT )µ ≤ γwT . (9.63)
µ∈Θ
cp
is a maximization constrained on an ellipsoid of contour surfaces that describe parallel hyperplanes. The
tangency condition is achieved when the gradients are parallel. For the gradient of the ellipsoid we have
−1
cp ∝ Σ
gΘ (µ − µ
b) . (9.64)
CHAPTER 9. OPTIMIZING ALLOCATIONS 255
gH ∝ diag(pT )α . (9.65)
Σ−1 (µ − µ
b ) = ρ diag(pT )α . (9.66)
Since µ ∈ Θ
b p we have:
QN (p)
b )0 Σ−1 (µ − µ
= (µ − µ b)
T
b )0 Σ−1 ΣΣ−1 (µ − µ
= (µ − µ b) (9.67)
= ρ2 α0 diag(pT )Σ diag(pT )α .
Therefore:
s
QN (p) 1
ρ=± . (9.68)
T α0 diag(pT )Σ diag(pT )α
s
QN (p)/T
b−
µ=µ Σ diag(pT )α , (9.69)
α0 diag(pT )Σ diag(pT )α
where the choice of the sign follows from the maximization (9.63). Therefore the original problem (9.62)
reads:
( )
wT 0 −1 1
α∗ ≡ argmin max µ0 Tµ + 1 Σ µ − α0 diag(pT )µ + α0 Φα
α µ∈Θ
cp A 2ζ
(9.70)
α0 pT = wT q
(
s.t. √
2α0 Φαλ + Qα
N (p)/T
0 Φα − α0 Φα − α0 diag(pT )b
µ ≤ γwT ,
where:
ζ −1 ζ −1 0 −1
T≡ Σ − Σ 11 Σ . (9.71)
2 2A
( )
0
α(i)
r = argmax min {α µ}
α µ∈Θ
cµ
(9.72)
α∈C
s.t.
α0 Σα
b ≤ v (i) ,
where:
b µ ≡ µ | (µ − m)0 T−1 (µ − m) ≤ q 2 .
Θ (9.73)
Then:
n o
b µ ≡ µ | (µ − m)0 EΛ−1/2 Λ−1/2 E0 (µ − m) ≤ q 2 .
Θ (9.75)
1 −1/2 0
u≡ Λ E (µ − m) , (9.76)
q
which implies:
µ ≡ m + qEΛ1/2 u . (9.77)
Then:
n o
b µ ≡ m + qEΛ1/2 u | u0 u ≤ 1 .
Θ (9.78)
n o
min {α0 µ} = min
0
α0 (m + qEΛ1/2 u)
µ∈Θ
cµ u u≤1
n o
= α0 m + q min
0
α0 EΛ1/2 u (9.79)
u u≤1
D E
= α0 m + q min
0
Λ 1/2 0
E α, u ,
u u≤1
where h·, ·i denotes the standard scalar product (A.5, AM 2005). This scalar product reaches a minimum
when the vector u is opposite to the other term in the product:
CHAPTER 9. OPTIMIZING ALLOCATIONS 257
Λ1/2 E0 α
e ≡ −
u
1/2 0
, (9.80)
Λ E α
and the respective minimum reads:
D E D E
min
0
Λ1/2 E0 α, u = Λ1/2 E0 α, u
e
u u≤1
* +
1/2 0 Λ1/2 E0 α
= Λ E α, −
1/2 0
Λ E α
1 D E
= −
Λ1/2 E0 α, Λ1/2 E0 α (9.81)
1/2 0
Λ E α
1
2
1/2 0
= −
1/2 0
Λ E α
Λ E α
= −
Λ1/2 E0 α
.
Show that if the investment constraint are regular enough, the problem (9.130, AM 2005) can be cast in
the form of a second-order cone programming problem.
Solution of E 295
To put the problem (9.130, AM 2005) in the SOCP form (6.55, AM 2005) we introduce an auxiliary
variable z:
0
(α(i) (i)
r , zr ) = argmax {α m − z}
α,z
α
∈ C
(9.84)
s.t. q
Λ1/2 E0 α
≤ z
0b
α Σα ≤ v (i) .
Furthermore, considering the spectral decomposition (A.70, AM 2005) of the estimate of the covariance:
b ≡ FΓ1/2 Γ1/2 F0 ,
Σ (9.85)
we can write:
D E
α0 Σα
b = Γ1/2 F0 α, Γ1/2 F0 α . (9.86)
0
(α(i) (i)
r , zr ) = argmax {α m − z}
α,z
α
∈ C
(9.87)
q
Λ1/2 E0 α
≤ z
s.t.
1/2 0
√ (i)
Γ F α
≤ v .
If the investment constraints C are regular enough, this problem is in the SOCP form (6.55, AM 2005).
and let us assume that C represents the full-budget constraint and the long-only constraints:
N
X
xn = 1 (9.89)
n=1
xn ≥ 0 , n = 1, . . . , N . (9.90)
h i
A01 ≡ qΛ1/2 E0 |0N
B01 ≡ [00N |1] (9.93)
d1 ≡ 0
C1 ≡ 0N ;
• Variance:
h i
A02 ≡ Γ1/2 F0 |0N
B02 ≡ 00N +1
√ (9.94)
d2 ≡ vi
C2 ≡ 0N .
Then our problem (9.87) reads:
subject to:
D0 x + f ≥ 0
kA01 x + C1 k ≤ b01 x + d1 (9.96)
kA02 x + C2 k ≤ b02 x + d2 .
This problem is in the standard SeDuMi format.
Z
fM (m) ≡ fµ,Σ (m)fν,Φ (µ)dµ
1 0 −1 1 0 −1
e− 2 (m−µ) Σ (m−µ) e− 2 (µ−ν) Φ (µ−ν)
Z
= N p N p dµ (9.97)
(2π) 2 |Σ| (2π) 2 |Φ|
(2π)−N
Z
1
=p p e− 2 a dµ ,
|Σ| |Φ|
where:
Defining:
we can write:
1
= γ2 e− 2 c ,
Defining:
we obtain:
c = m0 Tm − 2m0 Tg + h
= m0 Tm − 2m0 Tg + G0 Tg − G0 Tg + h (9.104)
0 0
= (m − G) T(m − g) − g Tg + h .
Since:
−1 −1 −1
g = Σ−1 − Σ−1 (Σ−1 + Φ−1 )−1 Σ−1 Σ (Σ + Φ−1 )−1 Φ−1 ν ,
(9.105)
Therefore:
1 0
fM (m) = γ2 e− 2 (m−g) T(m−g) . (9.107)
or in other words:
In our example:
Σ
Φ≡ . (9.109)
T
Therefore:
−1 −1 −1
g = Σ−1 − Σ−1 (Σ−1 + T Σ−1 )−1 Σ−1 Σ (Σ + T Σ−1 )−1 T Σ−1 ν
−1
1 T
= Σ−1 − Σ−1 Σ−1 ν
1+T 1+T (9.110)
1+T T
= Σ Σ−1 ν
T 1+T
=ν,
and:
E 298 – The robustness uncertainty set for the mean vector (www.9.8) *
Show that the optimization step in (9,139, AM 2005):
where:
1 ν1
bµ ≡
Θ µ | (µ − µ1 )0 Σ−1
1 (µ − µ1 ) ≤ q2 , (9.113)
T1 ν1 − 2 µ
can be expressed as:
1/2
!
0 1 ν1
1/2 0
min w µ1 − q2
Γ F w
, (9.114)
µ∈Θ
cµ T1 ν1 − 2 µ
CHAPTER 9. OPTIMIZING ALLOCATIONS 263
where:
where F is the juxtaposition (A.62, AM 2005) of the eigenvectors and Γ is the diagonal matrix (A.65,
AM 2005) of the eigenvalues.
Solution of E 298
We can write (9.113) as follows:
0 −1/2 −1/2 0 1 ν1
bµ ≡
Θ µ | (µ − µ1 ) FΓ Γ F (µ − µ1 ) ≤ q2 . (9.116)
T1 ν1 − 2 µ
−1/2
1 ν1
u≡ q2 Γ−1/2 F0 (µ − µ1 ) , (9.117)
T1 ν1 − 2 µ
which implies:
1/2
1 ν1
µ = µ1 + q2 FΓ1/2 u , (9.118)
T1 ν1 − 2 µ
( 1/2 )
1 ν1 1/2 0
bµ ≡
Θ µ1 + q2 FΓ u|u u ≤ 1 . (9.119)
T1 ν1 − 2 µ
Since:
* 1/2 +
0 1 ν1 2 1/2
w µ = w, µ1 + q FΓ u (9.120)
T1 ν1 − 2 µ
* 1/2 +
1 ν1 2 1/2 0
hw, µ1 i q Γ F w, u , (9.121)
T1 ν1 − 2 µ
we have:
* 1/2 +
0 1 ν1 2 1/2 0
min {w µ} = hw, µ1 i + min q Γ F w, u
µ∈Θ
cµ 0 u u≤1 T1 ν1 − 2 µ
1/2
(9.122)
0 1 ν1 2
1/2 0
= w µ1 − qµ
Γ F w
.
T1 ν1 − 2
E 299 – The robustness uncertainty set for the covariance matrix (www.9.8) **
Show that the optimization step in (9,139, AM 2005):
where:
h i0 h i
bΣ ≡
Θ b CE S−1 vech Σ − Σ
Σ | vech Σ − Σ b CE ≤ q 2 , (9.124)
Σ Σ
with:
ν1
Σ
b CE = Σ1 , (9.125)
ν1 + N + 1
and:
2ν12
SΣ = (D0 (Σ−1 ⊗ Σ−1
1 )DN )
−1
. (9.126)
(ν1 + N + 1)3 N 1
can be expressed as:
" 1/2 #
2ν12 qΣ
2
ν1
1/2 0
2
0
max {w Σw} = +
Γ F w
. (9.127)
Σ∈ΘΣ
c ν 1 + N +1 (ν1 + N + 1)3
Solution of E 299
Consider the spectral decomposition of the rescaled dispersion parameter (7.78):
2
2ν12 qΣ
h i0 h i
bΣ ≡
Θ b CE EΛ−1/2 Λ−1/2 E0 vech Σ − Σ
vech Σ − Σ b CE ≤ . (9.131)
(ν1 + N + 1)3
Define the new variable:
CHAPTER 9. OPTIMIZING ALLOCATIONS 265
−1/2
2ν12 qΣ
2
h i
u≡ Λ−1/2 E0 vech Σ − Σ
b CE , (9.132)
(ν1 + N + 1)3
which implies:
1/2
h i 2ν12 qΣ
2
vech [Σ] ≡ vech ΣCE +
b EΛ1/2 u . (9.133)
(ν1 + N + 1)3
( 1/2 )
2ν12 qΣ
2
h i
bΣ ≡
Θ vech Σ
b CE + EΛ 1/2
u | u0 u ≤ 1
(ν1 + N + 1)3
N (N +1)/2 1/2
(9.134)
h i X 2ν12 qΣ
2
λs
= vech Σ
b CE + e(s) us | u0 u ≤ 1 .
s=1
(ν1 + N + 1)3
Each eigenvector e(s) represents the non-redundant entries of a matrix. To consider all the elements we
simply multiply by the duplication matrix (A.113, AM 2005). Then from (9.133) we obtain:
Therefore:
ν1
max w0 Σw = w0 Σ1 w
Σ∈Θ
cΣ ν1 + N + 1
1/2
(9.137)
2ν12 qΣ
2
1/2 0 0 0 0
+ E DN (w ⊗ w )
.
(ν1 + N + 1)3
Λ
D
e N DN = IN (N +1)/2 . (9.138)
It is possible to show that:
(D0N (Σ−1 −1
1 ⊗ Σ1 )DN )
−1 e N (Σ−1 ⊗ Σ−1 )−1 D
=D 1 1
e0 ,
N (9.139)
and:
(w0 ⊗ w0 )DN D
e N = (w0 ⊗ w0 ) , (9.140)
see Magnus and Neudecker (1999). Now consider the square of the norm in (9.137). Using (9.139) and
(9.140) we obtain:
2
a ≡
Λ1/2 E0 D0N (w0 ⊗ w0 )0
ν1
max w0 Σw = w0 Σ1 w
Σ∈Θ
cΣ ν1 + N + 1
1/2
2
2ν12 qΣ
+ (w0 Σ1 w) (9.143)
(ν1 + N + 1)3
" 1/2 #
2
2ν12 qΣ
ν1
= + (w0 Σ1 w) .
ν1 + N + 1 (ν1 + N + 1)3
CHAPTER 9. OPTIMIZING ALLOCATIONS 267
" 1/2 #
2ν12 qΣ
2
ν1
1/2 0
2
max {w0 Σw} = +
Γ F w
. (9.144)
Σ∈ΘΣ
c ν 1 + N +1 (ν1 + N + 1)3
!1/2
2
1 qµ ν1
γµ ≡ (9.145)
T1 ν1 − 2
(i) v (i)
γΣ ≡ 1/2 , (9.146)
ν1 2ν12 qΣ
2
ν1 +N +1 + (ν1 +N +1)3
n
o
(i)
wrB = argmax w0 µ1 − γµ
Γ1/2 F0 w
w
q (9.147)
1/2 0
(i)
s.t.
Γ F w
≤ γΣ .
(i)
(wrB , z ∗ ) = argmax {w0 µ1 − z} , (9.148)
w∈C,z
subject to:
1/2 0
Γ F w
≤ z/γµ (9.149)
q
1/2 0
(i)
Γ F w
≤ γΣ . (9.150)
Solution of E 301
See the MATLAB
R
script S_MeanVarianceCallsRobust.
Compute the inputs of the mean-variance approach, namely expectations and covariances of the linear
returns.
Solution of E 302
Also from (2.219, AM 2005)-(2.220, AM 2005) for a log-normal variable:
Y ∼ LogN(µ, Σ) . (9.152)
Then:
1
E{Y} = eµ+ 2 diag(Σ)
1 1
(9.153)
E{YY0 } = (eµ+ 2 diag(Σ) (eµ+ 2 diag(Σ) )0 ) ◦ eΣ ,
1 + R ∼ LogN(µ, Σ) , (9.154)
we can easily compute the expectations E{R} and the second moments E{RR0 }. The covariance then
follows from:
• Construct a pick matrix that sets views on the spread between the compounded return of the first
and the last security;
• Set a one-standard deviation bullish view on that spread;
• Use the market-based Black-Litterman formula (9.44, AM 2005) to compute the normal parameters
that reflect those views;
• Map the results into expectations and covariances for the linear returns;
• Compute and plot the efficient frontier under the same constraints as above.
Solution of E 303
See the MATLAB
R
script S_BlackLittermanBasic.
d
X = BZ−1 + (1 − B)Z1 , (9.158)
where:
B is Bernoulli with P{B = 1} ≡ 1/2, and all the variables are independent. Write a MATLAB
R
script
in which you compute and plot the posterior market distribution that is the most consistent with the view:
E{X}
e ≡ 0.5 . (9.160)
Solution of E 304
See the MATLAB
R
script S_EntropyView.
Bibliography
Abramowitz, M., Stegun, I. A., 1974. Handbook of Mathematical Functions with Formulas, Graphs, and
Mathematical Tables. Dover.
Albanese, C., Jackson, K., Wiberg, P., 2004. A new Fourier transform algorithm for value at risk. Quan-
titative Finance 4 (3), 328–338.
Bertsimas, D., Lauprete, G. J., Samarov, A., 2004. Shortfall as a risk measure: Properties, optimization
and applications. Journal of Economic Dynamics and Control 28, 1353–1381.
Black, F., Scholes, M. S., 1973. The pricing of options and corporate liabilities. Journal of Political
Economy 81, 637–654.
Chib, S., Greenberg, E., 1995. Understanding the Metropolis-Hastings algorithm. The American Statisti-
cian 49, 327–335.
Dickey, J. M., 1967. Matrix-variate generalizations of the multivariate t distribution and the inverted
multivariate t distribution. Annals of Mathematical Statistics 38, 511–518.
Embrechts, P., Klueppelberg, C., Mikosch, T., 1997. Modelling Extremal Events. Springer.
Fang, K. T., Kotz, S., Ng, K. W., 1990. Symmetric Multivariate and Related Distributions. CRC Press.
Feuerverger, A., Wong, A. C., 2000. Computation of value at risk for nonlinear portfolios. Journal of Risk
3, 37–55.
Gourieroux, C., Laurent, J. P., Scaillet, O., 2000. Sensitivity analysis of values at risk. Journal of Empiri-
cal Finance 7, 225–245.
Kendall, M., Stuart, A., 1969. The Advanced Theory of Statistics, Volume, 3rd Edition. Griffin.
Ledoit, O., Santa-Clara, P., Wolf, M., 2003. Flexible multivariate GARCH modeling with an application
to international stock markets. Review of Economics and Statistics 85, 735–747.
Magnus, J. R., Neudecker, H., 1999. Matrix Differential Calculus with Applications in Statistics and
Econometrics, Revised Edition. Wiley.
Merton, R. C., 1976. Option pricing when underlying stocks are discontinuous. Journal of Financial
Economics 3, 125–144.
Meucci, A., 2005. Risk and Asset Allocation. Springer.
URL http://symmys.com
270
BIBLIOGRAPHY 271
Meucci, A., 2009. Review of statistical arbitrage, cointegration, and multivariate Ornstein-Uhlenbeck.
Working Paper.
URL http://symmys.com/node/132
Meucci, A., 2010a. Annualization and general projection of skweness, kurtosis, and all summary statis-
tics. GARP Risk Professional August, 55–56.
URL http://symmys.com/node/136
Meucci, A., 2010b. Common misconceptions about ’beta’ - hedging, estimation and horizon effects.
GARP Risk Professional June, 42–45.
URL http://symmys.com/node/165
Meucci, A., 2010c. Factors on Demand - building a platform for portfolio managers risk managers and
traders. Risk 23 (7), 84–89.
URL http://symmys.com/node/164
Meucci, A., 2010d. Review of dynamic allocation strategies: Convex versus concave management. Work-
ing Paper.
URL http://symmys.com/node/153
Meucci, A., 2010e. Review of linear factor models: Unexpected common features and the systematic-
plus-idiosyncratic myth. Working paper.
URL http://www.symmys.com/node/336
Rau-Bredow, H., 2004. Value at risk, expected shortfall, and marginal risk contribution. In: Szego, G.
(Ed.), Risk Measures for the 21st Century. Wiley, pp. 61–68.
Rudin, W., 1976. Principles of Mathematical Analysis, 3rd Edition. McGraw-Hill.