You are on page 1of 281

R

Exercises in Advanced Risk and Portfolio Management


(ARPM)

with Solutions and Code, supporting the 6-day intensive course ARPM Bootcamp

Attilio Meucci
attilio.meucci@arpm.co

Contents
0.1
1

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ix

Univariate statistics
E 1 Pdf of an invertible transformation of a univariate random variable (www.1.1) . . . . . .
E 2 Cdf of an invertible transformation of a univariate random variable (www.1.1) . . . . . .
E 3 Quantile of an invertible transformation of a random variable (www.1.1) . . . . . . . . .
E 4 Pdf of a positive affine transformation of a univariate random variable (www.1.2) . . . .
E 5 Cdf of a positive affine transformation of a univariate random variable (www.1.2) . . . .
E 6 Quantile of a positive affine transformation of a univariate random variable (www.1.2) .
E 7 Characteristic function of a positive affine transformation of a univariate random variable
(www.1.2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 8 Pdf of an exponential transformation of a univariate random variable (www.1.3) . . . . .
E 9 Cdf of an exponential transformation of a univariate random variable (www.1.3)
. . . .
E 10 Characteristic function of an exponential transformation of a univariate random variable
(www.1.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 11 Affine equivariance of the expected value (www.1.4) . . . . . . . . . . . . . . . . . . .
E 12 Affine equivariance of the median (www.1.4) . . . . . . . . . . . . . . . . . . . . . . .
E 13 Affine equivariance of the range (www.1.4) . . . . . . . . . . . . . . . . . . . . . . . .
E 14 Affine equivariance of the mode (www.1.4) . . . . . . . . . . . . . . . . . . . . . . . .
E 15 Expected value vs. median of symmetrical distributions (www.1.5) . . . . . . . . . . . .
E 16 Raw moments to central moments . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 17 Relation between the characteristic function and the moments (www.1.6) . . . . . . . .
E 18 First four central moments (www.1.6) . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 19 Central moments of a normal random variable . . . . . . . . . . . . . . . . . . . . . .
E 20 Histogram vs. pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 21 Sum of random variables via the characteristic function . . . . . . . . . . . . . . . . .
E 22 Sum of random variables via simulation
. . . . . . . . . . . . . . . . . . . . . . . . .
E 23 Simulation of univariate random normal variable
. . . . . . . . . . . . . . . . . . . .
E 24 Simulation of a Student t random variable
. . . . . . . . . . . . . . . . . . . . . . . .
E 25 Simulation of a lognormal random variable . . . . . . . . . . . . . . . . . . . . . . . .
E 26 Raw moments of a lognormal random variable . . . . . . . . . . . . . . . . . . . . . .
E 27 Comparison of the gamma and chi-square distributions . . . . . . . . . . . . . . . . .

1
1
2
2
3
3
3

5
5
5
5
6
6
7
8
8
9
11
11
11
12
12
13
14
14

Multivariate statistics
E 28 Distribution of the grades (www.2.1) . . . . . . . . . . . . . . . . . . . . . . .
E 29 Simulation of random variables by inversion (www.2.1) . . . . . . . . . . . . .
E 30 Pdf of an invertible function of a multivariate random variable (www.2.2) . . . .
E 31 Cdf of an invertible function of a multivariate random variable (www.2.2)
. . .

15
15
15
16
17

ii

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

4
4
4

CONTENTS
E 32 Pdf of a copula (www.2.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 33 Pdf of the normal copula
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 34 Cdf of a copula (www.2.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 35 Cdf of the normal copula
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 36 Cdf of the lognormal copula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 37 Invariance of a copula (www.2.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 38 Normal copula and given marginals . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 39 FX copula-marginal factorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 40 Pdf of an affine transformation of a multivariate random variable (www.2.4) . . . . . .
E 41 Characteristic function of an affine transformation of a multivariate random variable
(www.2.4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 42 Pdf of a non-invertible affine transformation of a multivariate random variable (www.2.4)
E 43 Characteristic function of a non-invertible affine transformation of a multivariate random
variable (www.2.4)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 44 Affine equivariance of the mode (www.2.5) . . . . . . . . . . . . . . . . . . . . . . . .
E 45 Affine equivariance of the modal dispersion (www.2.5) . . . . . . . . . . . . . . . . . .
E 46 Modal dispersion and scatter matrix (www.2.5) . . . . . . . . . . . . . . . . . . . . . .
E 47 Affine equivariance of the expected value (www.2.6) . . . . . . . . . . . . . . . . . . .
E 48 Affine equivariance of the covariance (www.2.6) . . . . . . . . . . . . . . . . . . . . .
E 49 Covariance and scatter matrix (www.2.6) . . . . . . . . . . . . . . . . . . . . . . . . .
E 50 Regularized call option payoff (www.2.7) . . . . . . . . . . . . . . . . . . . . . . . . .
E 51 Regularized put option payoff (www.2.7) . . . . . . . . . . . . . . . . . . . . . . . . .
E 52 Location-dispersion ellipsoid and geometry . . . . . . . . . . . . . . . . . . . . . . . .
E 53 Location-dispersion ellipsoid and statistics . . . . . . . . . . . . . . . . . . . . . . . .
E 54 The align of the enshrouding rectangle (www.2.8)
. . . . . . . . . . . . . . . . . . . .
E 55 The Chebyshevs inequality (www.2.9)
. . . . . . . . . . . . . . . . . . . . . . . . . .
E 56 Relation between the characteristic function and the moments (www.2.10)
. . . . . . .
E 57 Expected value and covariance matrix as raw moments
. . . . . . . . . . . . . . . . .
E 58 Pdf of a uniform random variable on the ellipsoid (www.2.11) . . . . . . . . . . . . . .
E 59 Characteristic function of a uniform random variable on the ellipsoid (www.2.11) . . .
E 60 Moments of a uniform random variable on the ellipsoid (www.2.11) . . . . . . . . . . .
E 61 Marginal distribution of a uniform random variable on the unit sphere (www.2.11) . . .
E 62 Characteristic function of a multivariate normal random variable (www.2.12)
. . . . .
E 63 Characteristic function of a multivariate normal random variable . . . . . . . . . . . .
E 64 Simulation of a multivariate normal random variable with matching moments
. . . . .
E 65 Pdf of the copula of a bivariate normal random variable (www.2.12) . . . . . . . . . .
E 66 Lognormal random variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 67 Pdf of the matrix-valued normal random variable (www.2.13) . . . . . . . . . . . . . .
E 68 Covariance of a matrix-valued normal random variable (www.2.13) . . . . . . . . . . .
E 69 Limit of the Student t distribution (www.2.14) . . . . . . . . . . . . . . . . . . . . . . .
E 70 Mode of a Cauchy random variable (www.2.15)
. . . . . . . . . . . . . . . . . . . . .
E 71 Modal dispersion of a Cauchy random variable (www.2.15) . . . . . . . . . . . . . . .
E 72 Pdf of a log-variable (www.2.16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 73 Raw moments of a log-variable (www.2.16) . . . . . . . . . . . . . . . . . . . . . . . .
E 74 Relation between the Wishart and the gamma distributions (www.2.17) . . . . . . . . .
E 75 Simulation of a Wishart random variable . . . . . . . . . . . . . . . . . . . . . . . . .
E 76 Pdf of an inverse-Wishart random variable (www.2.17) . . . . . . . . . . . . . . . . . .
E 77 Characteristic function of the empirical distribution . . . . . . . . . . . . . . . . . . .
E 78 Order statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

iii
17
18
18
18
19
19
19
20
20
21
21
22
23
24
24
25
26
26
26
27
28
28
29
30
32
32
33
33
34
35
35
36
37
39
40
40
41
42
44
44
45
46
47
47
48
49
49

E 79 Pdf of an elliptical random variable (www.2.18) . .


E 80 Moments of an elliptical random variable (www.2.18)
E 81 Radial-uniform representation . . . . . . . . . . . .
E 82 Elliptical markets and portfolios
. . . . . . . . . .
E 83 Generalized function m (www.2.19) . . . . . . . . .
E 84 Correlation in normal markets
. . . . . . . . . . .
E 85 Correlation in lognormal markets . . . . . . . . . .
E 86 Independence versus no correlation . . . . . . . . .
E 87 Correlation and location-dispersion ellipsoid . . . .
E 88 Copula vs. correlation . . . . . . . . . . . . . . . .
E 89 Full co-dependence . . . . . . . . . . . . . . . . .
3

. .
.
. .
. .
. .
. .
. .
. .
. .
. .
. .

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.

49
50
53
53
54
54
54
55
56
57
57

Modeling the market


E 90 Approximation of the ATMF implied volatility (www.3.1) . . . . . . . . . . . . . . . . .
E 91 Distribution of the sum of independent variables (www.3.2) . . . . . . . . . . . . . . .
E 92 Investment-horizon characteristic function (www.3.2)
. . . . . . . . . . . . . . . . . .
E 93 The square-root rule for the expectation (www.3.3) . . . . . . . . . . . . . . . . . . . .
E 94 The square-root rule for the covariance (www.3.3) . . . . . . . . . . . . . . . . . . . .
E 95 Multivariate square-root rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 96 Projection of Cauchy invariants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 97 Projection of skewness, kurtosis, and all standardized summary statistics . . . . . . . .
E 98 Explicit factors: regression factor loadings (www.3.4) . . . . . . . . . . . . . . . . . .
E 99 Explicit factors: expected value and correlation of residuals (www.3.4) . . . . . . . . .
E 100 Explicit factors: covariance of residuals (www.3.4) . . . . . . . . . . . . . . . . . . .
E 101 Explicit factors (with a constant among the factors): recovered invariants (www.3.4) .
E 102 Explicit factors (with a constant among the factors): expected value of residuals (www.3.4)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 103 Explicit factors (with a constant among the factors): covariance of residuals (www.3.4)
E 104 Explicit factors: generalized r-square (www.3.4) . . . . . . . . . . . . . . . . . . . .
E 105 Spectral decomposition: symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 106 Spectral decomposition: positivity . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 107 Hidden factors: recovered invariants as projection (www.3.5)
. . . . . . . . . . . . .
E 108 Hidden factors: generalized r-square (www.3.5) . . . . . . . . . . . . . . . . . . . . .
E 109 Hidden factors: derivation, correlations and r-square . . . . . . . . . . . . . . . . . .
E 110 Hidden factors: principal component analysis of a two-point swap curve
. . . . . . .
E 111 Hidden factors: puzzle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 112 Pure residual models: duration/curve attribution . . . . . . . . . . . . . . . . . . . .
E 113 Time series factors: unconstrained time series correlations and r-square . . . . . . . .
E 114 Time series factors: unconstrained time series industry factors . . . . . . . . . . . . .
E 115 Time series factors: generalized time-series industry factors . . . . . . . . . . . . . .
E 116 Time series factors: analysis of residuals I . . . . . . . . . . . . . . . . . . . . . . . .
E 117 Time series factors: analysis of residuals II . . . . . . . . . . . . . . . . . . . . . . .
E 118 Time series factors: analysis of residuals III . . . . . . . . . . . . . . . . . . . . . . .
E 119 Time series factors: analysis of residuals IV . . . . . . . . . . . . . . . . . . . . . . .
E 120 Cross-section factors: unconstrained cross-section correlations and r-square I
. . . .
E 121 Cross-section factors: unconstrained cross-section correlations and r-square II . . . .
E 122 Cross-section factors: unconstrained cross-section industry factors
. . . . . . . . . .
E 123 Cross-section factors: generalized cross-section industry factors . . . . . . . . . . . .
E 124 Cross-section factors: comparison cross-section with time-series industry factors . . .

58
58
59
60
61
61
63
63
64
66
67
67
68
69
70
70
73
73
73
74
76
78
78
79
79
80
81
81
83
83
84
84
85
85
86
87

CONTENTS
E 125 Correlation factors-residual: normal example . . . . . . .
E 126 Factors on demand: horizon effect . . . . . . . . . . . . .
E 127 Factors on demand: no-Greek hedging
. . . . . . . . . .
E 128 Factors on demand: selection heuristics . . . . . . . . . .
E 129 Spectral basis in the continuum (www.3.6) . . . . . . . . .
E 130 Eigenvectors for Toeplitz structure . . . . . . . . . . . . .
E 131 Numerical market projection . . . . . . . . . . . . . . . .
E 132 Simulation of a jump-diffusion process . . . . . . . . . . .
E 133 Simulation of a Ornstein-Uhlenbeck process . . . . . . . .
E 134 Simulation of a GARCH process . . . . . . . . . . . . . .
E 135 Equity market: quest for invariance . . . . . . . . . . . .
E 136 Equity market: multivariate GARCH process . . . . . . .
E 137 Equity market: linear vs. compounded returns projection I
E 138 Equity market: linear vs. compounded returns projection II
E 139 Fixed-income market: quest for invariance
. . . . . . . .
E 140 Fixed-income market: projection of normal invariants
. .
E 141 Fixed-income market: projection of Student t invariants
.
E 142 Derivatives market: quest for invariance
. . . . . . . . .
E 143 Derivatives market: projection of invariants . . . . . . . .
E 144 Statistical arbitrage: co-integration trading . . . . . . . .
4

v
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

87
87
89
90
91
94
94
97
97
98
98
98
99
100
100
100
102
104
104
105

Estimating the distribution of the market invariants


E 145 Smallest ellipsoid (www.4.1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 146 Ordinary least squares estimator of the regression factor loadings (www.4.1) . . . . .
E 147 Maximum likelihood estimation for elliptical distributions (www.4.2)
. . . . . . . . .
E 148 Maximum likelihood estimation for univariate elliptical distributions
. . . . . . . . .
E 149 Maximum likelihood estimator of explicit factors under conditional elliptical distribution
(www.4.2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 150 Explicit factors: t-test of factor loadings . . . . . . . . . . . . . . . . . . . . . . . . .
E 151 Explicit factors: maximum likelihood estimator of the factor loadings . . . . . . . . .
E 152 Explicit factors: maximum likelihood estimator of the dispersion parameter . . . . . .
E 153 Explicit factors: t-test of factor loadings . . . . . . . . . . . . . . . . . . . . . . . . .
E 154 Explicit factors: hypothesis testing . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 155 Independence of the sample mean and the sample covariance (www.4.3) . . . . . . . .
E 156 Distribution of the sample mean (www.4.3) . . . . . . . . . . . . . . . . . . . . . . .
E 157 Testing of the sample mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 158 p-value of the sample mean
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 159 t-test of the sample mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 160 Distribution of the sample covariance (www.4.3) . . . . . . . . . . . . . . . . . . . .
E 161 Estimation error of the sample mean . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 162 Estimation error of the sample covariance (www.4.3) . . . . . . . . . . . . . . . . . .
E 163 Maximum likelihood estimator of the conditional factor loadings (www.4.4) . . . . . .
E 164 Steins lemma (www.4.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 165 Shrinkage estimator of location (www.4.5) . . . . . . . . . . . . . . . . . . . . . . . .
E 166 Shrinkage estimator of location
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 167 Singular covariance matrix (www.4.6) . . . . . . . . . . . . . . . . . . . . . . . . . .
E 168 Sample covariance and eigenvalue dispersion . . . . . . . . . . . . . . . . . . . . . .
E 169 Shrinkage estimator of dispersion (www.4.6)
. . . . . . . . . . . . . . . . . . . . . .
E 170 Shrinkage estimator of scatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

106
106
107
108
109

.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

111
112
113
113
114
115
115
116
117
118
119
120
121
122
123
125
127
129
130
130
130
132

E 171 Maximum likelihood estimator as implicit functional (www.4.7)


. . . . . .
E 172 Influence function of the sample mean I (www.4.7)
. . . . . . . . . . . . .
E 173 Influence function of the sample mean II . . . . . . . . . . . . . . . . . . .
E 174 Influence function of the sample covariance (www.4.7) . . . . . . . . . . .
E 175 Influence function of the sample variance . . . . . . . . . . . . . . . . . .
E 176 Influence function of the ordinary least squares estimator (www.4.7) . . . .
E 177 Expectation-Maximization algorithm for missing data: formulas (www.4.8)
E 178 Expectation-Maximization algorithm for missing data: example . . . . . .
E 179 Mixture distribution
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 180 Moment-based functional of a mixture I . . . . . . . . . . . . . . . . . . .
E 181 Moment-based functional of a mixture II . . . . . . . . . . . . . . . . . . .
E 182 Moment-based functional of a mixture III . . . . . . . . . . . . . . . . . .
E 183 Moment-based functional of a mixture IV . . . . . . . . . . . . . . . . . .
E 184 Estimation of a quantile of a mixture I . . . . . . . . . . . . . . . . . . . .
E 185 Estimation of a quantile of a mixture II
. . . . . . . . . . . . . . . . . . .
E 186 Maximum likelihood estimation . . . . . . . . . . . . . . . . . . . . . . .
E 187 Quantile estimation: maximum likelihood vs. non-parametric
. . . . . . .
E 188 Maximum likelihood estimation of a multivariate Student t distribution
. .
E 189 Random matrix theory: semi-circular law . . . . . . . . . . . . . . . . . .
E 190 Random matrix theory: Marchenko-Pastur limit . . . . . . . . . . . . . . .
E 191 Non-parametric estimators of regression parameters . . . . . . . . . . . .
E 192 Maximum likelihood vs. non-parametric estimators of regression parameters
E 193 Simulation of the distribution of statistics of regression parameters . . . . .
5

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

132
132
133
134
136
137
138
140
141
143
144
144
145
145
146
146
147
147
148
149
149
150
150

Evaluating allocations
E 194 Gamma approximation of the investors objective (www.5.1) . . . . . . . . . . . . . .
E 195 Moments of the approximation of the investors objective (www.5.1) . . . . . . . . . .
E 196 Estimability and sensibility imply consistence with weak dominance (www.5.2) . . . .
E 197 Translation invariance and positive homogeneity imply constancy (www.5.2)
. . . . .
E 198 Consistence with weak dominance (www.5.3) . . . . . . . . . . . . . . . . . . . . . .
E 199 Positive homogeneity of the certainty-equivalent and utility functions (www.5.3) . . . .
E 200 Translation invariance of the certainty-equivalent and utility functions (www.5.3) . . .
E 201 Risk aversion/propensity of the certainty-equivalent and utility functions (www.5.3) . .
E 202 Risk premium in the case of small bets (www.5.3) . . . . . . . . . . . . . . . . . . . .
E 203 Dependence on allocation: approximation in terms of the moments of the objective
(www.5.3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 204 First-order sensitivity analysis of the certainty-equivalent I (www.5.3) . . . . . . . . .
E 205 First-order sensitivity analysis of the certainty-equivalent II . . . . . . . . . . . . . .
E 206 Second-order sensitivity analysis of the certainty-equivalent (www.5.3)
. . . . . . . .
E 207 Interpretation of the certainty-equivalent
. . . . . . . . . . . . . . . . . . . . . . . .
E 208 Certainty-equivalent computation I
. . . . . . . . . . . . . . . . . . . . . . . . . . .
E 209 Certainty-equivalent computation II . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 210 Constancy of the quantile-based index of satisfaction (www.5.4) . . . . . . . . . . . .
E 211 Homogeneity of the quantile-based index of satisfaction (www.5.4) . . . . . . . . . . .
E 212 Translation invariance of the quantile-based index of satisfaction (www.5.4) . . . . . .
E 213 Example of strong dominance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 214 Example of weak dominance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 215 Additive co-monotonicity of the quantile-based index of satisfaction (www.5.4) . . . .
E 216 Cornish-Fisher approximation of the quantile-based index of satisfaction (www.5.4)
.

151
151
155
157
158
159
160
160
162
162
163
164
164
166
167
167
168
169
169
170
170
171
171
171

CONTENTS

vii

E 217 First-order sensitivity analysis the quantile-based index of satisfaction (www.5.4) . . .


E 218 Second-order sensitivity analysis of the quantile-based index of satisfaction I (www.5.4)
E 219 Second-order sensitivity analysis of the quantile-based index of satisfaction II (www.5.4)
E 220 Value-at-Risk in elliptical markets I . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 221 Value-at-Risk in elliptical markets II . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 222 Value-at-Risk in elliptical markets III
. . . . . . . . . . . . . . . . . . . . . . . . . .
E 223 Cornish-Fisher approximation of the Value-at-Risk . . . . . . . . . . . . . . . . . . .
E 224 Spectral representation (www.5.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 225 Spectral indices of satisfaction and risk aversion . . . . . . . . . . . . . . . . . . . .
E 226 Cornish-Fisher approximation of the spectral index of satisfaction (www.5.5) . . . . .
E 227 Extreme value theory I (www.5.5) . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 228 Extreme value theory II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 229 Extreme value theory approximation of Value-at-Risk . . . . . . . . . . . . . . . . . .
E 230 First-order sensitivity analysis of the expected shortfall (www.5.5) . . . . . . . . . . .
E 231 Second-order sensitivity analysis of the expected shortfall (www.5.5) . . . . . . . . . .
E 232 Expected shortfall in elliptical markets I . . . . . . . . . . . . . . . . . . . . . . . . .
E 233 Expected shortfall in elliptical markets II . . . . . . . . . . . . . . . . . . . . . . . .
E 234 Expected shortfall in elliptical markets III . . . . . . . . . . . . . . . . . . . . . . . .
E 235 Expected shortfall and linear factor models . . . . . . . . . . . . . . . . . . . . . . .
E 236 Simulation of the investors objectives . . . . . . . . . . . . . . . . . . . . . . . . . .
E 237 Arrow-Pratt aversion and prospect theory . . . . . . . . . . . . . . . . . . . . . . . .

172
173
176
176
177
178
179
179
181
181
181
182
183
184
185
186
187
187
188
188
189

Optimizing allocations
E 238 Feasible set of the mean-variance efficient frontier (www.6.1)
. . . . . . . . . . . . .
E 239 Maximum achievable certainty-equivalent with exponential utility I (www.6.1)
. . . .
E 240 Maximum achievable certainty-equivalent with exponential utility II (www.6.1) . . . .
E 241 Results on constrained optimization: QCQP as special case of SOCP (www.6.2)
. . .
E 242 Feasible set of the mean-variance problem in the space of moments (www.6.3) . . . . .
E 243 Reformulation of the efficient frontier with affine constraints (www.6.3)
. . . . . . . .
E 244 Least-possible variance allocation (www.6.3) . . . . . . . . . . . . . . . . . . . . . .
E 245 Highest-possible Sharpe ratio allocation (www.6.3) . . . . . . . . . . . . . . . . . . .
E 246 Geometry of the mean-variance efficient frontier (www.6.3) . . . . . . . . . . . . . . .
E 247 Reformulation of the efficient frontier with linear constraints (www.6.3) . . . . . . . .
E 248 Effect of correlation on the mean-variance efficient frontier: total correlation case
(www.6.4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 249 Effect of correlation on the mean-variance efficient frontier: total anti-correlation case
(www.6.4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 250 Total return efficient allocations in the plane of relative coordinates (www.6.5)
. . . .
E 251 Benchmark-relative efficient allocation in the plane of absolute coordinates (www.6.5)
E 252 Formulation of mean-variance in terms of returns I (www.6.6) . . . . . . . . . . . . .
E 253 Formulation of mean-variance in terms of returns II (www.6.6) . . . . . . . . . . . . .
E 254 Mean-variance pitfalls: two-step approach I
. . . . . . . . . . . . . . . . . . . . . .
E 255 Mean-variance pitfalls: two-step approach II . . . . . . . . . . . . . . . . . . . . . .
E 256 Mean-variance pitfalls: horizon effect . . . . . . . . . . . . . . . . . . . . . . . . . .
E 257 Benchmark driven allocation I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 258 Benchmark driven allocation II
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 259 Mean-variance for derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 260 Dynamic strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 261 Buy and hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

191
191
191
192
193
194
198
198
198
199
199
199
201
202
204
205
205
206
206
207
207
209
209
209
211

E 262 Utility maximization I


. . . . . . . .
E 263 Utility maximization II . . . . . . . .
E 264 Constant proportion portfolio insurance
E 265 Option based portfolio insurance I . .
E 266 Option based portfolio insurance II .
7

. . .
. . .
. .
. . .
. . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

211
213
213
214
215

Estimating the distribution of the market invariants


E 267 Mahalanobis square distance of normal random variables (www.7.1)
. . . . . . . . .
E 268 Normal-inverse-Wishart location-dispersion: posterior distribution (www.7.2)
. . . .
E 269 Normal-inverse-Wishart location-dispersion: mode (www.7.3) . . . . . . . . . . . . .
E 270 Normal-inverse-Wishart location-dispersion: modal dispersion (www.7.3) . . . . . . .
E 271 Inverse-Wishart dispersion: mode (www.7.4) . . . . . . . . . . . . . . . . . . . . . .
E 272 Inverse-Wishart dispersion: modal dispersion (www.7.4) . . . . . . . . . . . . . . . .
E 273 Normal-inverse-Wishart location-dispersion: marginal distribution of location (www.7.5)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 274 Normal-inverse-Wishart factor loadings-dispersion: posterior distribution (www.7.6) .
E 275 Normal-inverse-Wishart factor loadings-dispersion: mode (www.7.7) . . . . . . . . .
E 276 Normal-inverse-Wishart factor loadings-dispersion: modal dispersion (www.7.7) . . .
E 277 Normal-inverse-Wishart factor loadings-dispersion: marginal distribution of factor loadings (www.7.8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 278 Allocation-implied parameters (www.7.9) . . . . . . . . . . . . . . . . . . . . . . . .
E 279 Likelihood maximization (www.7.9) . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 280 Markov chain Monte Carlo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 281 Bayesian: prior on correlation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
E 282 Bayesian: normal-inverse-Wishart posterior
. . . . . . . . . . . . . . . . . . . . . .

217
217
219
221
223
224
225
227
228
232
234
235
237
238
239
240
241

Evaluating allocations
243
E 283 Optimal allocation as function of invariant parameters (www.8.1) . . . . . . . . . . . 243
E 284 Statistical significance of sample allocation (www.8.2) . . . . . . . . . . . . . . . . . 244
E 285 Estimation risk and opportunity cost . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Optimizing allocations
E 286 Allocation of the resampled allocation (www.9.1) . . . . . . . . . .
E 287 Probability bounds for the sample mean (www.9.2) . . . . . . . . .
E 288 Bayes rule (www.9.3) . . . . . . . . . . . . . . . . . . . . . . . .
E 289 Black-Litterman posterior distribution (www.9.3) . . . . . . . . . .
E 290 Black-Litterman conditional distribution (www.9.4) . . . . . . . . .
E 291 Black-Litterman conditional expectation (www.9.4) . . . . . . . . .
E 292 Black-Litterman conditional covariance (www.9.4) . . . . . . . . .
E 293 Computations for the robust version of the leading example (www.9.5)
E 294 Computations for the robust mean-variance problem I (www.9.6) . .
E 295 Computations for the robust mean-variance problem II (www.9.6) .
E 296 Restating the robust mean-variance problem in SeDuMi format
. .
E 297 Normal predictive distribution (www.9.7) . . . . . . . . . . . . . .
E 298 The robustness uncertainty set for the mean vector (www.9.8)
. . .
E 299 The robustness uncertainty set for the covariance matrix (www.9.8)
E 300 Robust Bayesian mean-variance problem (www.9.8)
. . . . . . . .
E 301 Robust mean-variance for derivatives . . . . . . . . . . . . . . . .
E 302 Black-Litterman and beyond I . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

246
246
246
247
248
251
252
253
253
255
257
258
259
262
264
267
267
268

CONTENTS

ix

E 303 Black-Litterman and beyond II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268


E 304 Entropy pooling
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Bibliography

270

0.1

Preface

This exercise book supports the review sessions of the 6-day intensive course Advanced Risk and Portfolio
R
Management (ARPM) Bootcamp
. 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.

R
The MATLAB
files and this exercise book are provided "as is": no claim of accuracy is made and no
R
responsibility is taken for possible errors. Both this exercise book and the MATLAB
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
E 1 Pdf of an invertible transformation of a univariate random variable (www.1.1)
Consider the following transformation of the generic random variable X:
X 7 Y g(X) ,

(1.1)

where g is an increasing and thus invertible function. Show that:

fY (y) =

fX (g 1 (y))
.
|g 0 (g 1 (y))|

(1.2)

Solution of E 1
By the definition (1.3, AM 2005) of the pdf fY we have:
fY (y)dy = P{Y [y, y + dy]}
= P{g(X) [y, y + dy]}
= P{X [g 1 (y), g 1 (y + dy)]}
Z g1 (y+dy)
=
fX (x)dx ,

(1.3)

g 1 (y)

where the third equality follows from the invertibility of the function g. On the other hand, from a Taylor
expansion we obtain:
g 1 (y + dy) = g 1 (y) +

1
dy .
g 0 (g 1 (y))

(1.4)

Substituting (1.4) in the last expression of (1.3) we obtain:


Z
fY (y)dy =

1
g 1 (y)+ g0 (g1
dy
(y))

g 1 (y)



fX (x)dx = fX (g 1 (y))



dy ,
0
1
g (g (y))
1

(1.5)


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:
FY (y) = FX (g 1 (y)) .

(1.6)

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}


= P X g 1 (y)

(1.7)

= 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}
= P{X g 1 (y)} = 1 P{X g 1 (y)}

(1.8)

= 1 FX (g 1 (y)) .


E 3 Quantile of an invertible transformation of a random variable (www.1.1)


(see E 1)
Consider the same setup than in E 1. Show that:
QY (p) = g(QX (p)) .

(1.9)

Solution of E 3
Consider the following series of identities that follow from the definition (1.7, AM 2005) of the cdf FY :
FY (g(QX (p))) P{Y g(QX (p))} = P{X QX (p)} = p ,

(1.10)

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 FY1 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:
QY (p) = g(QX (1 p)) .

(1.11)


CHAPTER 1. UNIVARIATE STATISTICS

E 4 Pdf of a positive affine transformation of a univariate random variable (www.1.2)


Consider the following positive affine transformation of the generic random variable X:
X 7 Y g(X) m + sX ,

(1.12)

where s > 0 and m is a generic constant. Show that:


1
fY (y) = fX
s

ym
s


.

(1.13)

Solution of E 4
We use the fact that:
g 1 (y) =

ym
,
s

g 0 (x) = s ,

(1.14)


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:

FY (y) = FX

ym
s


.

(1.15)

Solution of E 5
We use the fact that:
g 1 (y) =

ym
,
s

g 0 (x) = s ,

(1.16)


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:
QY (p) = m + s QX (p) .

(1.17)

Solution of E 6
We use the fact that:
g 1 (y) =
in (1.9).

ym
,
s

g 0 (x) = s ,

(1.18)


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:
Y () = eim X (s) .

(1.19)

Solution of E 7
We use the definition (1.12, AM 2005) of the characteristic function:
o
n


Y () E{eiY } = E ei(m+sX) = eim E eisX .

(1.20)


E 8 Pdf of an exponential transformation of a univariate random variable (www.1.3)


Given the following exponential transformation:
X 7 Y g(X) eX ,

(1.21)

show that:

fY (y) =

1
fX (ln(y)) .
y

(1.22)

Solution of E 8
We use the fact that:
g 1 (y) = ln(y) ,

g 0 (x) = ex ,

(1.23)


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:
FY (y) = FX (ln(y)) .

(1.24)

Solution of E 9
We use the fact that:
g 1 (y) = ln(y) ,
in (1.6).

g 0 (x) = ex ,

(1.25)


CHAPTER 1. UNIVARIATE STATISTICS

E 10 Characteristic function 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:
QY (p) = eQX (p) .

(1.26)

Solution of E 10
We use the fact that:
g 1 (y) = ln(y) ,

g 0 (x) = ex ,

(1.27)


in (1.9).

E 11 Affine equivariance of the expected value (www.1.4)


Prove that the expected value (1.25, AM 2005) is an affine equivariant parameter of location, i.e. it
satisfies (1.22, AM 2005).
Solution of E 11
Z
E {m + sX}

Z
(m + s x)fX (x)dx = m

Z
fX (x)dx + s

x fX (x)dx
R

(1.28)

m + s E {X} .


E 12 Affine equivariance of the median (www.1.4)


Prove that the median (1.26, AM 2005) is an affine equivariant parameter of location, i.e. it satisfies (1.22,
AM 2005).
Solution of E 12
From (1.17), the quantile, and thus in particular the median, is invariant with respect to any positive affine
transformation:
Med {m + sX} Qm+sX

 
 
1
1
= m + s QX
2
2

(1.29)

m + s Med {X} .


E 13 Affine equivariance of the range (www.1.4)


Prove that the range (1.37, AM 2005) is an affine equivariant parameter of location, i.e. it satisfies (1.22,
AM 2005).
Solution of E 13
Using (1.9) and assuming s > 0, we have:
Ran {m + sX} Qm+sX (p) Qm+sX (p)


= [m + sQX (p)] m + sQX (p)


= s QX (p) QX (p)
s Ran {X} .

(1.30)

When s < 0, using (1.11), we have:


Ran {m + sX} Qm+sX (p) Qm+sX (p)


= [m + sQX (1 p)] m + sQX (1 p)


= s QX (1 p) QX (1 p)

(1.31)

s Ran {X} .


E 14 Affine equivariance of the mode (www.1.4)


Prove that the mode (1.37, AM 2005) is an affine equivariant parameter of location, i.e. it satisfies (1.22,
AM 2005).
Solution of E 14
From (1.13) we know the density fY (y) and therefore:

Mod{m + sX} argmax {fm+sX (y)} = argmax
yR

yR

= argmax fX
yR

ym
s

1
fX
s

ym
s




= m + s argmax {fX (x)}

(1.32)

xR

m + s Mod{X} .


E 15 Expected value vs. median of symmetrical distributions (www.1.5)


Show that if a pdf is symmetrical around x
e, the area underneath the pdf on the half-line (, x
e] is
the same as the area underneath the pdf on the half-line [e
x, +), and thus they must both equal 1/2.
Moreover, show that the symmetry point x
e is the expected value and the median.
Solution of E 15
For any pdf fX and a point x
e in the domain of the density we have:
Z

x
e

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
2

x
e

fX (x)dx = 1 ,

(1.34)

and therefore:
Z
FX (e
x)

x
e

For the expected value, we proceed as follows:

fX (x)dx =

1
.
2

(1.35)

CHAPTER 1. UNIVARIATE STATISTICS

Z
E{X}

x fX (x)dx
Z
=x
e + (x x
e)fX (x)dx
ZR
=x
e + u fX (e
x + u)du = x
e.
R

(1.36)

where the last integral in (1.36) is null since due to (1.28, AM 2005) we have:
Z

u fX (e
x u)du = 0 .

u fX (e
x + u)du =

(1.37)

Finally, from the definition of the median (1.26, AM 2005) we have:

Med{X} QX

 
 
1
1
1
= FX
=x
e.
2
2

(1.38)


E 16 Raw moments to central moments


Consider the raw moments (1.47, AM 2005):
n
RMX
n E{X },

n = 1, 2, . . . ,

(1.39)

and the central moments (1.48, AM 2005):


X
CMX
1 RM1
n
CMX
n E{(X E{X}) },

n = 2, 3, . . . .

(1.40)

Determine how to map the first n raw moments into the first n central moments, and how to map the first
R
n central moments into the first n raw moments. Write two MATLAB
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:
n
CMX
n E{(X E{X}) }
(n1
)
X
k
n
=E
(1)nk CMX
nk X + X
k=0

n1
X

 k
(1)nk CMX
+ E {X n }
nk E X

k=0

n1
X

X
X
(1)nk CMX
nk RMk + RMn .

k=0

(1.41)

Now, for the mapping of the central moments to the raw moments, we have from (1.41) the following
recursive formula:

X
RMX
n = CMn +

n1
X

X
(1)nk+1 CMX
nk RMk ,

(1.42)

k=0
X
R

which is initialized with RMX
functions Raw2Central and Central2Raw for
1 = CM1 . See the MATLAB
the implementations of the mappings.


E 17 Relation between the characteristic function and the moments (www.1.6)


Assume the characteristic function of the random variable X is analytical, i.e. it can be recovered entirely
from its Taylor expansion. Consider the expansion of the characteristic function of X around the origin:
X () = 1 + (i) RMX
1 + +

(i)k
RMX
k + ,
k!

(1.43)

where the generic coefficient RMX


k is defined in terms of the derivatives of the characteristic function as
follows:
RMX
k


dk X ()
.
d k =0

(1.44)

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:
Z

dk
dk
ix
{
()}

e
f
(x)dx
X
X
d k
d k
R
Z
= ik
eix xk fX (x)dx .

(1.45)

Therefore:

Z

dk X ()
k
=i
xk fX (x)dx = ik E X k ,

k
d
R
=0

(1.46)

and substituting this in (1.44) concludes the solution. The expected value is obtained as a special case
with k = 1.


E 18 First four central moments (www.1.6)


Using the fact that the generic central moment of order k defined in (1.48, AM 2005) is a function of the
raw moments of order up to k:

CMX
k =

k
X
k!(1)kj
j=0

j!(k j)!

X kj
RMX
,
j (RM1 )

(1.47)

CHAPTER 1. UNIVARIATE STATISTICS

see e.g. Abramowitz and Stegun (1974), derive the following first four central moments:
X 2
X
CMX
2 = (RM1 ) + RM2
X 3
X
X
X
CMX
3 = 2(RM1 ) 3(RM1 )(RM2 ) + RM3

CMX
4

4
3(RMX
1 )

X
2
6(RMX
1 ) (RM2 )

4 RMX
1

(1.48)
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:
Var{X} E{(X E{X})2 } = CMX
2
q
p
X
Sd{X} Var{X} = CM2

(1.49)
(1.50)

Sk{X}

E{(X E{X})3 }
CMX
3
=
3/2
(Sd{X})3
CMX
2

(1.51)

Ku{X}

E{(X E{X})4 }
CMX
4
=
 .
X 2
(Sd{X})4
CM2

(1.52)


E 19 Central moments of a normal random variable


Compute the central moments:
n
CMX
n E {(X E {X}) } ,

(1.53)

X N(, 2 ) ,

(1.54)

of a normal distribution:

using the moment generating function.


Hint. For a generic random variable X, the moment generating function:
Z
MX (z)

ezx fX (x)dx ,

(1.55)

is such that Dn MX (0) = RMX


n , where D is the derivation operator and:
n
RMX
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

(1.58)
2

From (1.69, AM 2005) and (1.57) we obtain MY (z) e 2 z . Computing the derivatives:
1

D0 MY (z) = e 2 z

D1 MY (z) = ze 2 z

D2 MY (z) = e 2 z + z 2 e 2 z
2

D3 MY (z) = z 3 e 2 z + 3ze 2 z
2

D4 MY (z) = 3e 2 z + 6z 2 e 2 z + z 4 e 2 z
1

(1.59)

D5 MY (z) = 10z 3 e 2 z + z 5 e 2 z + 15ze 2 z


1

D6 MY (z) = 15e 2 z + 45z 2 e 2 z + 15z 4 e 2 z + z 6 e 2 z


..
.

and evaluating at zero yields the result:

RMYn


=

0
(n 1)!!

if n is odd
if n is even ,

(1.60)

where n!! 1 3 5 n. Now we notice that:


X
CMX
,
n = RMn

(1.61)

which follows from (1.53), (1.56) and E{X} = . Furthermore:


RMnX = n RMYn ,

(1.62)

X
n
because X = Y . Hence CMX
and:
n = RMn

CMX
n


=

0
n (n 1)!!

if n is odd
if n is even .

(1.63)


CHAPTER 1. UNIVARIATE STATISTICS

11

E 20 Histogram vs. pdf *


Consider a set of T random i.i.d. variables:
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:

f iT

T
1 X (xt )

fX .

T
T t=1

(1.65)

Denoting #
i the number of points included in the generic i-th bin, the following relation holds:

#
i

xi +
2

T
xi
2

fiT (y)dy fX (xi )T .


T

Therefore the histogram represents a regularized version of the true pdf.

(1.66)


E 21 Sum of random variables via the characteristic function


Consider the random variable defined in distribution as:
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 eiX = E ei(Y +Z) = E eiY eiZ



= E eiY E eiZ Y ()Z () .

(1.68)
(1.69)


E 22 Sum of random variables via simulation


Consider a Student t random variable:
X St(, , 2 ) ,

(1.70)

where 8, 0 and 2 0.1. Consider an independent lognormal random variable:


Y LogN(, 2 ) ,

(1.71)

where 0.1 and 2 0.2. Consider the random variable defined as:
Z X +Y .

(1.72)

R
Write a MATLAB
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
R
See the MATLAB
script S_NonAnalytical.

E 23 Simulation of univariate random normal variable


Consider as in (1.66, AM 2005) a normal random variable X N(, 2 ). First, determine and 2 such
R
script in which you:
that E {X} 3 and Var {X} 5. Then write a MATLAB
Generate a sample of 10,000 draws X from this distribution using normrnd;
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 normcdf. Use a different color;
Plot the empirical quantile. Use prctile;
Superimpose (use hold on) the exact quantile as computed by norminv. Use a different color.

R
Hint. Notice that the MATLAB
built-in functions take and 2 as inputs.
Solution of E 23
From (1.71, AM 2005) we have E {X} = and from (1.72, AM 2005) Var {X} = 2 . For the
R
implementation, see the MATLAB
script S_NormalSample.


E 24 Simulation of a Student t random variable


Consider a Student t random variable:
X St(, , 2 ) .

(1.73)

Knowing that 2 6, determine and such that E {X} 2 and Var {X} 7. Then write a
R
MATLAB
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:
Y
d
X =+ p
,
Z/

(1.74)

where Y and Z are independent variables distributed as follows:


Y N(0, 2 ) ,

Z 2 ;

(1.75)

CHAPTER 1. UNIVARIATE STATISTICS

13

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

2 .
Note. There is a typo in (1.90, AM 2005), which should be Sd{X} = 2
Solution of E 24
From (1.89, AM 2005) E{X} = and Var{X} =
script S_StudentTSample for the implementation.

2
2 ,

R
which leads to = 14. See the MATLAB


E 25 Simulation of a lognormal random variable


Consider as in (1.94, AM 2005) a lognormal random variable:
X LogN(, 2 ) .

(1.76)

R
Write a MATLAB
function which determine and 2 from E{X} and Var{X}, and use it to determine
R
2
and such that E {X} 3 and Var {X} 5. Then write a MATLAB
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.

R
Note. The MATLAB
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:
E = e+

2
2

V = e2+ (e 1) ,

(1.77)

or:
2 ln(E) = 2 + 2
2

ln(V ) = 2 + 2 + ln(e 1) .

(1.78)

Therefore:

ln
or:

V
E2

= ln(e 1) ,

(1.79)



V
2 = ln 1 + 2 .
E

(1.80)



1
V
= ln(E) ln 1 + 2 .
2
E

(1.81)

From (1.78) we then obtain:

R
See the MATLAB
function LognormalMoments2Parameters and the script S_LognormalSample for the implementation.


E 26 Raw moments of a lognormal random variable


Consider as in (1.94, AM 2005) a lognormal random variable:
X LogN(, 2 ) .

(1.82)

n
Compute the raw moments RMX
n E {X } for all n = 1, 2, . . ..

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

n+n
RMX
n =e

2 /2

(1.85)


E 27 Comparison of the gamma and chi-square distributions


Consider as in (1.107, AM 2005) a gamma-distributed random variable:
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 + + Y2 ,
d

(1.87)

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
E 28 Distribution of the grades (www.2.1)
Prove that the grade of X, U FX (X), is uniformly distributed on [0, 1]:
U U([0, 1]) .

(2.1)

Solution of E 28
From the standard uniform distribution defined in (1.54, AM 2005), we have to show that:

0
u
P {U u} =

if
if
if

u0
u [0, 1]
u 1.

(2.2)

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:

P {U u} =

0
1

if
if

u0
u 1.

(2.3)

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 .


E 29 Simulation of random variables by inversion (www.2.1)


Prove that if U U([0, 1]), then for any random variable Z we have:
d

QZ (U ) = Z ,
d

where = means "has the same distribution as".


15

(2.5)

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) *


Define a random variable Y as an invertible, increasing function g of a random variable X:
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:
fY (y) =

fX (g1 (y))
,
|Jg (g1 (y))|

(2.8)

where Jg denotes the Jacobian of g defined as follows:


Jgmn (x)

gm (x)
.
xn

(2.9)

Solution of E 30
From the definition of the pdf (2.4, AM 2005) we can write:
fy (y)dy P {g(X) [y, y + dy]}



= P X g1 (y), g1 (y + dy)
Z
=
fX (x)dx .

(2.10)

[g1 (y),g1 (y+dy)]

On the other hand, from a first order Taylor expansion we obtain:



1
g1 (y + dy) g1 (y) + Jg (g1 (y))
dy ,

(2.11)

Therefore:
Z
fY (y)dy =

fX (x)dx
[g1 (y),g1 (y)+[Jg (g1 (y))]1 dy]

1

= fX (g1 (y)) Jg (g1 (y)) dy ,

(2.12)

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

fX (g1 (y))
fY (y) = q
.
2
|Jg (g1 (y))|

17

(2.13)

E 31 Cdf of an invertible function of a multivariate random variable (www.2.2)


(see E 30)
Consider the same setup than in E 30. Show that:
FY (y) = FX (g1 (y)) .

(2.14)

Solution of E 31
From the definition (2.9, AM 2005) of the cdf FY we have:


FY (y) P {Y y} = P {g(X) y} = P X g1 (y) = FX (g1 (y)) .

(2.15)


E 32 Pdf of a copula (www.2.3)


Show that the pdf of the copula of X can be expressed as in (2.30, AM 2005).
Solution of E 32
Consider the random variable U defined by the following transformation:
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 :
gn (x1 , . . . , xN ) FXn (xn ) .

(2.17)

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:
gn1 (u1 , . . . , uN ) QXn (un ) ,

(2.18)

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:
J = diag(fX1 , . . . , fXN ) ,

(2.19)

and thus from (A.42, AM 2005) its determinant is:


|J| = fX1 fXN ,

(2.20)

which yields:

fU (u1 , . . . , uN ) =

fX (QX1 (u1 ), . . . , QXN (uN ))


.
fX1 (QX1 (u1 )) fXN (QXN (uN ))

(2.21)


E 33 Pdf of the normal copula


R
Consider a generic N -variate normal random variable X N(, ). Write a MATLAB
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. Use the following function header: pdfu = NormalCopulaPdf(u,
R

Mu, Sigma) and save the function as NormalCopulaPdf. In a second step, write a MATLAB
script which
calls the above function to evaluate the copula pdf at a select grid of bivariate values:

u G [0.05 : 0.05 : 0.95] [0.05 : 0.05 : 0.95] .

(2.22)

Pick and of your choice and plot the ensuing surface using surf.
Hint. See (2.30, AM 2005). Since is a generic N 1 vector and is a generic symmetric and positive
N N matrix, you need the multivariate normal distribution function. Use mvnpdf and norminv. For the
display, calculate the pdf value on each grid point, which gives you a 19 19 matrix.
Solution of E 33
R
script S_DisplayNormalCopulaPdf.
See the MATLAB

E 34 Cdf of a copula (www.2.3) (see E 32)


Consider the same setup than in E 32. Show that the cdf of the copula of X can be expressed as in (2.31,
AM 2005):
FU (u1 , . . . , uN ) = FX (QX1 (u1 ), . . . , QXN (uN )) .

(2.23)

Solution of E 34
Use (2.14) with gn1 (u1 , . . . , un ) QXn (un ).

E 35 Cdf of the normal copula


Consider a bi-variate normal random variable:

X N(, ) ,

0
0


,

1
1


.

(2.24)

Pick as you please, but make sure to play around with the values 0.99, 0.99 and 0.
R
Write a MATLAB
script which evaluates the copula cdf at a select grid of bivariate values:
u G [0.05 : 0.05 : 0.95] [0.05 : 0.05 : 0.95] .

(2.25)

Do not call functions from within the script. In a separate figure, plot the ensuing surface using surf.
Hint. Calculate the cdf value on each grid point, which gives you a 19 19 matrix. Use (2.31, AM 2005)
and the built-in function mvncdf.

CHAPTER 2. MULTIVARIATE STATISTICS

19

Solution of E 35
R
See the MATLAB
script S_DisplayNormalCopulaCdf.

E 36 Cdf of the lognormal copula


R
Consider a generic N -variate lognormal random variable X LogN(, ). Write a MATLAB
function which takes as input a generic value u in the N -dimensional unit hypercube as well as the parameters
R
and and outputs the pdf of the copula of X in u. Write a MATLAB
script where you call the above
function to evaluate the copula pdf at a select grid of bivariate values:

u G [0.05 : 0.05 : 0.95] [0.05 : 0.05 : 0.95] .

(2.26)

In a separate figure, plot the ensuing surface.


Hint. Use (2.38, AM 2005) and (2.196, AM 2005).
Solution of E 36
R
See the MATLAB
function LognormalCopulaPdf and the script S_DisplayLogNormalCopulaPdf.

E 37 Invariance of a copula (www.2.3) (see E 32)


Consider the same setup than in E 32. Prove the invariance of the copula under a generic increasing
transformation X 7 Y h(X).
Solution of E 37
From (2.23) the copulas of X and Y are the same if and only if the following is true:
FY (QY1 (u1 ), . . . , QYN (uN )) = FX (QX1 (u1 ), . . . , QXN (uN )) .

(2.27)

From (2.14) we have:


1
FY (y1 , . . . , yN ) = FX (h1
1 (y1 ), . . . , hN (yN )) .

(2.28)

On the other hand, the invariance property of the quantile (1.9), reads in this context:
QYn (un ) = hn (QXn (un )) .

(2.29)


Substituting (2.29) in (2.28) yields (2.27).

E 38 Normal copula and given marginals


R
Write a MATLAB
script in which you:
Generate a bivariate sample X, i.e. a (T 10,000) (N 2) matrix of joint observations, from a
bivariate random variable X whose distribution is defined as follows: the copula is the copula of a
normal distribution with correlation r 0.8 and the marginals are distributed as follows:

X1 Ga(1 , 12 )
X2 LogN(2 , 22 ) ,
where 1 9, 12 2, 2 0 and 22 0.04;

(2.30)

In a separate figure, subplot the histogram of the simulations for X1 and subplot the histogram of
the simulations of X2 ;
Comment on how these histograms, which represent the marginal pdfs of X1 and X2 , change as
the correlation r of the normal distribution varies;
Scatter-plot the simulations of X1 against the respective simulations of X2 ;
Use hist3 to plot the respective 3D-histogram to visualize the joint pdf of X1 and X2 ;
Plot the histogram of the grade of X1 and subplot the histogram of the grade of X2 ;
Scatter-plot the simulations of the grade of X1 against the respective simulations of the grade of
X2 .
Hint. You are asked to generate a bivariate sample, which has a marginal gamma distribution and a lognormal distribution but with a copula which is the same as the copula from a bivariate normal distribution.
You will notice that the correlation of this normal distribution is r, but no other information is provided
on the expected values or the standard deviations. Why? See (2.38, AM 2005). Therefore, first generate a
bivariate normal distribution sample with correlation r; then calculate its copula using (2.28, AM 2005);
finally remap it to the bivariate distribution you want using (2.34, AM 2005).
Solution of E 38
R
See the MATLAB
script S_BivariateSample.

E 39 FX copula-marginal factorization
R
script in which you:
Write a MATLAB
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
R
See the MATLAB
script S_FxCopulaMarginal.

E 40 Pdf of an affine transformation of a multivariate random variable (www.2.4)


Consider a generic random variable X and a random variable Y defined as an invertible affine transformation of X:
X 7 Y g(X) m + BX ,

(2.31)

where m is an N -dimensional vector and B is a N N invertible matrix. Show that:

fY (y) =

fX (B1 (y m))
p
.
|BB0 |

(2.32)

Jg B .

(2.33)

Solution of E 40
In this case the Jacobian (2.9) is:

CHAPTER 2. MULTIVARIATE STATISTICS

21

From (A.82, AM 2005) and (A.84, AM 2005) we see that:


2

|Jg | = |B| = |B| |B0 | = |BB0 | .

(2.34)

Therefore, according to (2.13) the pdf of Y reads:

fY (y) =

fX (B1 (y m))
p
.
|BB0 |

(2.35)


E 41 Characteristic function of an affine transformation of a multivariate random 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
0
0
0
= ei m E ei(B ) X

(2.37)

= ei m X (B0 ) .


E 42 Pdf of a non-invertible affine transformation of a multivariate random variable (www.2.4) **


Consider a generic random variable X and a random variable Y defined as an non-invertible affine transformation of X:
X 7 Y g(X) m + BX ,

(2.38)

rank(B) 6= N dim(X) .

(2.39)

where:

In particular, consider linear combinations of random variables:


b0 X .
Determine the pdf f .

(2.40)

Solution of E 42
The distribution of is the marginal distribution of any invertible affine transformation that extends
(2.40):

Y2
..
.

BX .

(2.41)

YN
For example, we can extend (2.40) defining B as follows:


b1

0N 1

(b2 , . . . , bN )
IN 1


,

(2.42)

where 0N 1 is an (N 1)-dimensional column vector of zeros and IN 1 is the (N 1)-dimensional


identity matrix. The pdf of (2.40) is obtained by integrating out in (2.32) the dependence on the ancillary
variables (2.41) as in (2.22, AM 2005):
Z
fY (, y2 , . . . , yN ) dy2 dyN
Z
1
fX (B1 Y)dy2 dyN .
=p
|BB0 | RN 1

f () =

RN 1

(2.43)

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:

B1 =

1
b1

0N 1

N)
(b2 ,...,b
b1
IN 1


,

(2.44)

and thus from (2.43) the pdf of (2.40) reads:


1
f () = p 2
b1

Z
fX
RN 1

b2
bN

y2
yN , y2 , . . . , yN
b1
b1
b1


dy2 dyN .

(2.45)


E 43 Characteristic function of a non-invertible affine transformation of a multivariate 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 ancillary variables (2.41) as in (2.24, AM 2005):
() = Y (, 0N 1 )
 


= X B0
.
0N 1

(2.46)

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:
() = X (b) .

(2.47)


E 44 Affine equivariance of the mode (www.2.5)


Consider a generic invertible affine transformation:
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:
Mod {a + BX} = a + B Mod {X} .

(2.49)

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:

fY (y)
(B0 )1 fX
=p
.
y
|BB0 | x x=B1 (ya)

(2.50)

Deriving further, we obtain the matrix of the second order derivatives:



2 fY (y)
(B0 )1 2 fX
p
B1 .
=
yy0
|BB0 | xx0 x=B1 (ya)

(2.51)

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.
x x=Mod{X}

(2.52)



fY
(B0 )1 fX
p
=
= 0.
y y=a+B Mod{X}
|BB0 | x x=Mod{X}

(2.53)

From (2.50) and (2.52) we obtain:

By the definition (2.52) of mode we have:



fY
= 0,
y y=Mod{Y}
then (2.49) follows.

(2.54)


E 45 Affine equivariance of the modal dispersion (www.2.5) (see E 44)


Consider the same setup than in E 44. Prove that the modal dispersion (2.65, AM 2005) is affine equivariant, i.e. it satisfies (2.64, AM 2005).
Solution of E 45
From its definition, the modal dispersion of a generic random variable X reads:

MDis {X}

!1

2 ln fX
xx0 x=Mod{X}

!1



1 fX
=
x fX x0 x=Mod{X}
!1


1 2 fX
1 fX fX
=
2
fX xx0 x=Mod{X} fX
x x0 x=Mod{X}
!1

2 fX
.
= fX (Mod {X})
xx0 x=Mod{X}

(2.55)

Therefore from (2.51) and (2.49) we obtain:

MDis {Y} = fY (Mod {Y})

= fY (Mod {Y})

= fY (Mod {Y})

!1

2 fY
yy0 y=Mod{Y}
!1

(B0 )1 2 fX
1
p
B
|BB0 | xx0 x=B1 (Mod{Y}a)
!1

(B0 )1 2 fX
1
p
B
.
|BB0 | xx0 x=Mod{X}

(2.56)

Using (2.32) and (2.49) this expression becomes:


!1

(B0 )1 2 fX
p
B1
|BB0 | xx0 X=Mod{X}
!1

2 fX
B0 .
= fX (Mod {X})B
xx0 x=Mod{X}

fX (Mod {X})
MDis {Y} = p
|BB0 |

(2.57)

Finally, using (2.55) we obtain:


MDis {Y} = B MDis {X} B0 .
This proves that the modal dispersion is affine equivariant.

E 46 Modal dispersion and scatter matrix (www.2.5) (see E 44)


Consider the same setup than in E 44. Show that the modal dispersion is a scatter matrix.

(2.58)


CHAPTER 2. MULTIVARIATE STATISTICS

25

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.


E 47 Affine equivariance of the expected value (www.2.6) *


Consider a generic affine transformation:
e a
e ,
e + BX
X 7 Y

(2.59)

e is a non-invertible K N matrix. Prove the affine equivariance


e is a K-dimensional vector and B
where a
(2.51, AM 2005) of the expected value under generic affine transformations, i.e.:
n
o
e
e E {X} .
e + BX
e+B
E a
=a

(2.60)

e and (N K) elements to a
e.
Hint. Consider adding (N K) non-collinear rows to B
Solution of E 47
e (N K) elements a to a
e and denoting Y a set of (N K)
Adding (N K) non-collinear rows B to B,
ancillary random variables as follows:

Y

e
Y
Y


,

e
a
a


,

e
B
B


,

(2.61)

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:


Z
n
o Z
e
e + BX
e fY
e fY,Y
(e
y, y)de
ydy
E a
y
y)de
y=
y
e (e
e
RK
RN
Z
Z
fX (B1 (y a))
p
e
e fY (y)dy =
y
=
y
dy
|BB0 |
RN
RN
Z
fX (x)
e p
=
(e
a + Bx)
dy .
|BB0 |
RN

(2.63)

With the change of variable y a + Bx we obtain:


n
o Z
e
e + BX
E a
=

fX (x)
e p
(e
a + Bx)
|B| dx
|BB0 |
RN
Z
e
e+B
=a
xfX (x)dx

(2.64)

RN

e E {X} .
e+B
=a


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
e
e Cov {X} B
e0 .
e + BX
Cov a
=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 
e
e E a
e
e E a
e
e + BX
e + BX
e + BX
e + BX
e + BX
Cov a
E
a
a
n
o
e
e0
= E B(X
E {X})(X E {X})0 B

(2.66)

e Cov {X} B
e0 ,
=B
where the last equality follows from the linearity of the expectation operator (B.56, AM 2005).

E 49 Covariance and scatter matrix (www.2.6) (see E 48)


Consider the same setup than in E 48. Show that the covariance is a scatter matrix.
Solution of E 49
It is immediate to check from the definition (2.68, AM 2005) that the covariance matrix is symmetric.
Furthermore, from the affine equivariance (2.65) we obtain:
a0 Cov {X} a = Cov {a0 X} = Var {a0 X} 0 .

(2.67)

which proves the positiveness of the covariance matrix. Affine equivariance, symmetry and positivity
make the covariance matrix a scatter matrix.


E 50 Regularized call option payoff (www.2.7)


Show that the regularized call payoff is given by:

C (x) =

(x K)
2




2
1
xK

1 + erf
+ e 22 (xK) .
2
2
2

(2.68)

Hint. See (B.4, AM 2005).


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

i
h
C (x) C (0) (x)
Z +
2
1
1
=
max(y K, 0)e 22 (xy) dy
2
Z +
2
1
1
(y K)e 22 (yx) dy
=
2 K
Z +
2
1
1
(u + x K)e 22 u du
=
2 Kx
Z +
Z +
2
2
1
1
1
1
ue 22 u du +
e 22 u du
(x K)
=
2 Kx
2
Kx

Z +
Z +
2
d h 2 12 u2 i
1
(x K) 2

 e 2
ez dz ,
=
du +
Kx
2

2 Kx du
2

(2.69)

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.


E 51 Regularized put option payoff (www.2.7)


Show that the regularized put payoff is given by:

P (x) =

(x K)
2


1 erf

xK

22



2
1

+ e 22 (xK) .
2

(2.70)

Hint. See (B.4, AM 2005).


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 +
2
1
1
=
min(y K, 0)e 22 (xy) dy
2
Z K
2
1
1

=
(y K)e 22 (yx) dy
2
Z Kx
2
1
1
=
(u + x K)e 22 u du
2
Z Kx
Z Kx
2
2
1
1
1
1
=
ue 22 u du
(x K)
e 22 u du
2
2

"
#
Kx
Z Kx
Z
h
i
2
2
(x K) 2
1
d 2 12 u
22
z

du
=
 e 2
e dz ,
2

2 du

(2.71)


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.


E 52 Location-dispersion ellipsoid and geometry


Consider the ellipsoid:


Em,S X RN | (X m)0 S1 (X m) 1 .

(2.72)

What is the geometrical interpretation of m?


What is the geometrical interpretation of the eigenvectors of S?
What is the geometrical interpretation of the eigenvalues of S?
What is the statistical interpretation of this ellipsoid?

Solution of E 52
The vector m represents the center of ellipsoid. The eigenvectors are the directions of the principal axes
of the ellipsoid. The square root of the eigenvalues are the length of the principal axes of the ellipsoid.
There is no statistical interpretation, as long as m and S are not the expected value and the covariance
matrix respectively of a multivariate distribution.


E 53 Location-dispersion ellipsoid and statistics


R
Write a MATLAB
script in which you generate J 10,000 simulations from a bi-variate log-Student-t
variable:

ln(X) St(, , ) ,

(2.73)

where 40, 0.5 and diag() 0.01 (you can choose the off-diagonal element). Consider the
generic vector in the plane:

e

cos
sin


.

(2.74)

Consider the random variable Z e0 X, namely the projection of X on the direction e . In the same
R
MATLAB
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.
R
Hint. You will have to shift and rescale the output of the MATLAB
function mvtrnd. Also, to compute
r notice that it satisfies:

CHAPTER 2. MULTIVARIATE STATISTICS

29

(r e )0 S1 (r e ) = 1 .
Solution of E 53
R
See the MATLAB
script S_MaxMinVariance.

(2.75)

E 54 The align of the enshrouding rectangle (www.2.8) *


Prove that for n = 1, . . . , N , the two hyperplanes described by the following align:
xn = E {Xn } Sd {Xn } ,

(2.76)

are tangent to the ellipsoid EE,Cov defined in (2.75, AM 2005).


Solution of E 54
First consider the implicit representation of the surface of EE,Cov :
g(x) = 0 ,

(2.77)

g(x) (x E)0 Cov1 (x E) 1 .

(2.78)

where from (2.75, AM 2005) the function g is:

To find the tangency condition of the ellipsoid with the rectangle we compute the gradient of the implicit
representation of EE,Cov :
g
= 2 Cov1 (x E) .
x

(2.79)

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:
Cov1 (x E) = (n) ,

(2.80)

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 Cov1 (x E)
= ( Cov (n) )0 Cov1 ( Cov (n) )

(2.81)

= Var {Xn } ,
so that:

1
.
Sd {Xn }

(2.82)

Substituting (2.82) back in (2.80) and then again in (2.77) yields:


1 = (x E)0 Cov1 (x E)


1
xn E {Xn }
(n)
0
= (x E)

=
.
Sd {Xn }
Sd {Xn }

(2.83)

E 55 The Chebyshevs inequality (www.2.9) **


Show that the location-dispersion ellipsoid EE,Cov in (2.74, AM 2005) is, among all the ellipsoids of
equal volumes, the one that contains the highest probability of occurrence of the N dimensional random
variable X withing its boundaries.
Solution of E 55
Consider a generic vector v and a generic symmetric and positive matrix U. These define an ellipsoid
q
Ev,U
as in (2.87, AM 2005). Therefore:
n
o Z
q
q2 P X
/ Ev,U
=

q
RN /Ev,U

q
RN /Ev,U

q 2 fX (x)dx
(X v)0 U1 (x v)fX (x)dx

(2.84)

(x v)0 U1 (x v)fX (x)dx


Rn


= E (x v)0 U1 (x v)

a(v, U) .
Notice that we can re-write a(v, U) as follows:
a(v, U) = tr(E {(X v)(X v)0 } U1 ) .

(2.85)

a(E, Cov) = tr(Cov Cov1 ) = tr(IN ) = N .

(2.86)

From this we obtain:

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:
|U| = |Cov {X}| ,

(2.87)

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 .
If v minimizes (2.85), in the limit 0 we must have:

(2.88)

CHAPTER 2. MULTIVARIATE STATISTICS

31



0 = E (X (v + u))0 U1 (X (v + u))


E (X v)0 U1 (X v)


2 E u0 U1 (X v) = 2u0 U1 (E {X} v) ,

(2.89)

and therefore we must have:


v E {X} .

(2.90)

U 7 U(I + B) ,

(2.91)

Now consider an arbitrary perturbation of U:

where I is the identity matrix and B is a matrix that preserves the volumes. From (A.77, AM 2005) this
means:
|U(I + B)| = |U| .

(2.92)

In the limit of small perturbations  0, from (A.122, AM 2005) this condition becomes:
tr(B) = 0 .

(2.93)

If (E {X} , U) minimize (2.85), in the limit  0 we must have:


n
o
1
0 = E (X E {X})0 [U(I + B)] (X E {X})


E (X E {X})0 U1 (X E {X})
1

= tr(Cov {X} [U(I + B)]

) tr(Cov {X} U1 )

= tr(Cov {X} (I B)U1 ) tr(Cov {X} U1 )

(2.94)

=  tr(Cov {X} BU1 )


=  tr(BU1 Cov {X}) .
To summarize, from (2.93) and (2.94) we must have:
tr(B) = 0 tr(BU1 Cov {X}) = 0 ,

(2.95)

which is only true if U is proportional to the covariance, i.e.:


U = Cov {X} ,
for some scalar . Given the normalization (2.87) we obtain the desired result.

(2.96)


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 differentiating the characteristic function of X.
Solution of E 56
Consider the expansion of the characteristic function of X around zero:

X () = 1 + i

N
X

n RMX
n +

n=1
N
X
i
(n1 nk ) RMX
+
n1 nk + .
k! n ,...,n =1
k

(2.97)

where RMX
n1 nk is defined as follows:
RMX
n1 nk


k X ()
.
n1 nk =0

(2.98)

By performing the derivatives on the definition (2.13, AM 2005) of the characteristic function we obtain:
Z

0
k
k
{X ()}
ei x fX (x)dx
n1 nk
n1 nk
RN
Z
0
= ik
xn1 xnk ei X fX (x)dx .

(2.99)

RN

Therefore:

Z
k X ()
k
=i
xn1 xnk fX (x)dx = ik E {Xn1 Xnk } .
n1 nk =0
RN

(2.100)

Substituting this in (2.98) shows that RMX


n1 nk is the k-th raw moment defined in (2.91, AM 2005):
RMX
n1 nk E {Xn1 Xnk } .
Therefore any raw moment can be easily computed by differentiating the characteristic function.

(2.101)


E 57 Expected value and covariance matrix as raw moments


Express the expected value and the covariance matrix as raw moments.
Solution of E 57
From (2.98) we obtain the expected value, which is the raw moment of order one:

E {Xn } =
On the other hand, the k-th central moment:

RMX
n


1 X ()
=
.
i n =0

(2.102)

CHAPTER 2. MULTIVARIATE STATISTICS

33

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:
X
X
X
Cov {Xm , Xn } = CMX
mn = RMmn RMm RMn ,

(2.104)

where the second raw moment follows from (2.98):

RMX
mn


2 X ()
.
=
m n =0

(2.105)


E 58 Pdf of a uniform random variable on the ellipsoid (www.2.11)


Show that the pdf of a uniform random variable on the ellipsoid E, in RN is given by (2.145, AM
2005).
Solution of E 58
First, assume that the random variable X is uniformly distributed on the unit sphere in RN :
X U(E0N ,IN ) .

(2.106)

1
IE (X) ,
VN 0,I

(2.107)

The pdf of X reads:

where VN is the volume of the unit sphere in RN :


N

VN

,
N
( 2 + 1)

(2.108)

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).


E 59 Characteristic function of a uniform random variable on the ellipsoid (www.2.11)


Show that the characteristic function of a uniform random variable on the ellipsoid E, in RN is given
by (2.146, AM 2005).
Note. There is a typo in Fang et al. (1990).

Solution of E 59
Using Fang et al. (1990, result 2.9) and (2.119) the characteristic function of a variable X uniformly
distributed on the unit sphere in RN is given by:
o
n 0
n 0 o
() E ei X = E ei XN
Z +
0
=
ei xN f (xN )dxN
=

Z +1

( N2+2 )
N 1
cos( 0 x)(1 x2 ) 2 dx
1
N +1
( 2 ) 2 1
Z +

( N2+2 )
N 1
+ i N +1 1
sin( 0 x)(1 x2 ) 2 dx .
( 2 ) 2

(2.109)

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:

B

1 N +1
,
2
2

( 21 )( N2+1 )
=
=
( N2+2 )

( N2+1 )
.
( N2+2 )

(2.110)

Therefore the characteristic function of X reads:


2
() =
B( 12 , N2+1 )

+1

N 1
cos( 0 x)(1 x2 ) 2 dx .

(2.111)

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).


E 60 Moments of a uniform random variable on the ellipsoid (www.2.11)


Compute the moments of a uniform random variable on the ellipsoid E, in RN .
Solution of E 60
First, consider a variable X uniformly distributed on the unit sphere in RN . To compute the moments,
we represent X as follows:
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:
E {X} = E {R} E {U} = 0 .

(2.113)




Cov {X} = E R2 UU0 = E R2 Cov {U} .

(2.114)

Similarly:

CHAPTER 2. MULTIVARIATE STATISTICS

35

From Fang et al. (1990, p.75) the pdf of R reads:


fR (r) = N rN 1 I[0,1] (r) ,

(2.115)

where I is the indicator function (B.72, AM 2005). Therefore:



E Rk =

r Nr

N 1

Z
dr = N

rN +k1 dr =

N
.
N +k

(2.116)

Using (2.229) in E 80 we obtain:

Cov {X} =

N IN
IN
=
.
N +2 N
N +2

(2.117)

More in general, we can obtain any moment by applying (2.233):


RU
RU
CMX
m1 mk = CMm1 mk = RMm1 mk

= E {RUn1 RUnk }

= E Rk E {Un1 Unk }
N
E {Un1 Unk } ,
=
N +k

(2.118)

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:

f (xK+1 , . . . , xN ) =

( N2+2 )
( K+2
2 )

N K
2

N
X

! K2
x2n

(2.119)

n=K+1

where:
N
X

x2n 1 .

(2.120)

n=K+1

Therefore, the marginal distribution is not uniform.


Note. Expression (2.151, AM 2005) is a special case of (2.119), as follows immediately from (B.81, AM
2005) and (B.82, AM 2005). See also Fang et al. (1990, p.75).


E 62 Characteristic function of a multivariate normal random variable (www.2.12)


Show that the characteristic function of a multivariate normal random variable Y N(, ) is given by:
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{eiX }
Z +
x2
1
eix e 2 dx
=
2
Z +
2
1
1
=
e 2 (x 2ix) dx
2
Z +
2
2
1
1
=
e 2 [(xi) + ] dx
2
Z +
2
1
12 2 1

=e
e 2 (xi) d(x i)
2
1

= e 2

(2.122)

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
N
n 0 o Y

Y
1 2
1 0
e 2 n = e 2 .
() E ei X =
E ein Xn =

(2.124)

n=1

n=1

With the transformation X 7 Y + BX where BB0 we obtain a generic multivariate normal


random vector Y N(, ) whose characteristic function is obtained by applying (2.36) to (2.124). 

E 63 Characteristic function of a multivariate normal random variable


Shows that the characteristic function (2.157, AM 2005) of the multivariate normal random variable can
be written as:
 Z
i0
N
()
=
e
exp

RN

Hint. Use | 0 s| = ( 0 s)(s0 ).


2
| 0 s| m (s)ds .

(2.125)

CHAPTER 2. MULTIVARIATE STATISTICS

37

Solution of E 63
First note that we have:
Z

1
ss m (s)ds
4
0

RN

ss0

RN

N 
X


(vn ) + (vn ) (s)ds

n=1

N
X

1
1
1
1
1
vn vn0 = VV0 = E 2 2 E0
2 n=1
2
2

1
.
2

(2.126)

Therefore:
Z

| 0 s| m (s)ds =

RN

( 0 s)(s0 )m (s)ds
Z

0
0
=
ss m (s)ds
RN

(2.127)

RN

1 0
.
2

With this result, we have:


 Z
0
ei exp
RN


0
1 0
2
| 0 s| m (s)ds = ei 2 N
, () .

(2.128)


E 64 Simulation of a multivariate normal random variable with matching moments **


Consider a multivariate normal market:
X N(, ) ,

(2.129)

R
where and are arbitrary. Write a MATLAB
script in which you generate a large number of scenarios {Xj }j=1,...,J from the distribution (2.129) in such a way that the sample mean and covariance:

J
1X
Xj ,
J j=1

J
X
b 1

(Xj )(Xj )0 ,
J j=1

(2.130)

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


H

b
0


.

(2.132)

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
R
decomposition are similar in nature to principal components and are computed by MATLAB
. Then the
solution of the Riccati align (2.138) reads:
B ULL U1
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:
e j}
{Y
j=1,..., J

(2.135)

from the distribution N(0, ). Then complement these scenarios with their opposite
(
ej
Y

ej
Y
e J
Y
j

if 1 j J/2
if J/2 + 1 j J .

(2.136)

These antithetic variables still represent the distribution N(0, ), but they are more efficient as they satisfy
e j , which again preserves
the zero-mean condition. Next apply a linear transformation to the scenarios Y
normality:
e j,
Yj BY

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
BB,

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)

R
which satisfy (2.131). See the MATLAB
function MvnRnd and the script S_ExactMeanAndCovariance for an
implementation of this methodology.


CHAPTER 2. MULTIVARIATE STATISTICS

39

E 65 Pdf of the copula of a bivariate normal random variable (www.2.12)


Show that the pdf of a bivariate normal distribution can be expressed as:

f N (u1 , u2 ) = p

exp(g (u1 , u2 )) ,

1 2

(2.140)

where:
0
erf 1 (2u1 1)
g (u1 , u2 )
erf 1 (2u2 1)


erf 1 (2u1 1)
.
erf 1 (2u2 1)


1
1

1

1
0

0
1

!
(2.141)

Solution of E 65
From (2.30, AM 2005), the pdf of the normal copula reads:

f N (u1 , u2 ) =

N
f,
(QN
(u1 ), QN
(u2 ))
1 , 2
2 , 2
1

fN1 ,2 (QN
(u1 ))fN2 ,2 (QN
(u2 ))
1 , 2
2 , 2
1

(2.142)

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:

N
N
f,
(QN
1 , 2 (u1 ), Q2 , 2 (u2 )) =
1

1 z2 +z2
(12 22 (1 2 )) 2 21 z1 2z
(12 )
e
,
2
2

(2.144)

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

2 2
fNi ,2 (QN
e
i , 2 (ui )) = (2i )
i

zi2
2

(2.146)

Therefore:

f N (u1 , u2 ) = p
where:

1
1 2

exp(g (u1 , u2 )) ,

(2.147)

0
erf 1 (2u1 1)
g (u1 , u2 )
erf 1 (2u2 1)


erf 1 (2u1 1)
.
erf 1 (2u2 1)


1

1
1

1
0

0
1

!
(2.148)

E 66 Lognormal random variable


Consider an N -variate lognormal random variable:
X LogN(, ) .

(2.149)

R
Write a MATLAB
function that computes m E {X}, S Cov {X} and C Corr {X} as functions
of the generic inputs , .

Solution of E 66
R
function LognormalParam2Statistics.
See the MATLAB

E 67 Pdf of the matrix-valued normal random variable (www.2.13) *


Show that the pdf of a matrix-valued normal random variable (2.81, AM 2005) can be expressed as
follows:
f (X) (2)

K
2

NK
2

|N |

N
2

e 2 tr{SK
1

|SK |

(XM)0 1
N (XM)}

(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))
(2)
e

NK
2

|SK N |

12

(2.151)

12 (vec(X)vec(M))0 (SK N )1 (vec(X)vec(M))

From the property (A.102, AM 2005) of the Kronecker product we can write:
|SK N |

12

N
2

= |SK |

K
2

|N |

(2.152)

Furthermore, from the property (A.101, AM 2005) of the Kronecker product, we can write:
1
(SK N )1 = S1
K N .

(2.153)

Therefore (2.151) can be written as follows:


f (X) = (2)

NK
2

|SK |

N
2

K
2

|N |
0

e 2 {(vec(X)vec(M)) (SK
1

1
N )(vec(X)vec(M))}

(2.154)
.

CHAPTER 2. MULTIVARIATE STATISTICS

41

On the other hand, defining:


Y X M,

N 1
N ,

K S1
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:
{ } vec(Y)0 (K N ) vec(Y)

11
..
(1) 0
(K) 0
..
(Y
Y
)
.
.
K1
X
0
=
Y(k) (kj )Y(j)

1K
Y(1)

..
..

.
.
(K)
KK
Y
(2.156)

k,j

Ynk kj nm Ymj

n,m,k,j

mn Ynk kj Ymj

n,m,k,j

= tr {YY0 } = tr {Y0 Y} .


E 68 Covariance of a matrix-valued normal random variable (www.2.13) *


Given a matrix-valued normal random variable X with pdf (2.181, AM 2005), show that the matrix
N defines the overall covariance structure between any two N -dimensional columns among the K that
constitute the random matrix X, and that SK defines the overall covariance structure between any two
K-dimensional rows among the N that constitute the random matrix X.
Solution of E 68
To prove the role of the matrices N and SK , consider two generic N -dimensional columns X(j) and
X(k) among the K that compose the random matrix X. The (m, n)-entry of the N N covariance matrix
between the two columns X(j) and X(k) can be written as follows:
h
n
oi
Cov X(j) , X(k)
m,n



= Cov X(j1)N +m , X(k1)N +n
= (SK N )(j1)N +m,(k1)N +n

S11 S1K

..
..
..
=

.
.
.
SK1

SKK

(2.157)

(j1)N +m,(k1)N +n

= Sj,k m,n .
This proves that if X N(M, , S) then:
n
o
Cov X(j) , X(k) = Sj,k .
On the other hand, from the following identities:

(2.158)

f (X) (2)

NK
2

= (2)

NK
2

K
2

|N |

N
2

|SK |

|N |

N
2

e 2 tr{SK

K
2

e 2 tr{N

|SK |

(XM)0 1
N (XM)}

0
(XM)S1
K (XM) }

(2.159)
,

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)


E 69 Limit of the Student t distribution (www.2.14) *


Show that the Student t distribution yields the normal distribution when the degrees of freedom tend to
infinity. In other words, prove the following result:
St(, M, , S) = N(M, , S) ,

(2.161)

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:
St(, m, ) = St(, m, , 1) = N(m, , 1) = N(m, ) .

(2.162)

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:
pN,

q K,

m+N,

Q S ,

P 1 .

(2.163)

If X St(, M, , S) then:
E {X} = M
n
o

Cov X(j) , X(k) =


Sjk
2


Cov X(m) , X(n) =


mn S .
2

(2.164)

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

K
2

f (X) ||

K
2

||

N
2

|S|

N
2

|S|

43


+N
1

2
IK + S1 (X M)0 (X M)


 +N
2
1
1
0 1
,
1 + tr(S (X M) (X M))

(2.165)

where is the normalization constant (2.200, AM 2005), which we report here:


1+N
( +N
( K+1+N
)
)
2 ) (
2
2

1
K+1
( 2 )
( 2 )
( 2 )

NK
2

() ()

(2.166)

Using the following limit (see e.g. Rudin, 1976):




ex = lim

1+

x n
,
n

(2.167)

we can then write:


K

St
f,,,S
(X) || 2 |S| 2
  21

1
1
0 1
1 + tr(S (X M) (X M))

K
2

||

|S|

N
2

e 2 tr(S

(XM)0 1 (XM))

(2.168)

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

(2.169)

Applying this result recursively we obtain in the limit n the following approximation:


n+N
2

 n  N2
2

n
2

(2.170)

Applying this to the normalization constant (2.166) we obtain in the limit the following approximation:

( ) ()

N2K

  N2
2

()

NK
2

= (2)

NK
2

  N2K

K +1
2

 N2
(2.171)

2
.

Thus in the limit the pdf of the matrix-variate Student t distribution St(, M, , S) reads:

St
f,,,S
(X) (2)

NK
2

K
2

||

N
2

|S|

e 2 tr(S

(XM)0 1 (XM))

which is the pdf of the matrix-variate normal distribution N(M, , S).

(2.172)


E 70 Mode of a Cauchy random variable (www.2.15)


Show that for X Ca(, ), we have the following result:
Mod {X} = .

(2.173)

Solution of E 70
The logarithm of the Cauchy pdf (2.209, AM 2005) reads:
N +1
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) =

Ca
(x)
ln f,
1 (x )
= (N + 1)
.
x
1 + (x )0 1 (x )

(2.175)


Setting this expression to zero we obtain the mode.

E 71 Modal dispersion of a Cauchy random variable (www.2.15)


Show that for X Ca(, ), we have the following result:
MDis {X} =

1
.
N +1

(2.176)

Solution of E 71
The logarithm of the Cauchy pdf (2.209, AM 2005) reads:
N +1
ln(1 + (x )0 1 (x )) ,
2
where is a constant which does not depend on x. The Hessian of the log-Cauchy pdf reads:
Ca
ln f,
(x) =

Ca
2 ln f,
(x)

(x )0 1
=

(N
+
1)
xx0
x 1 + (x )0 1 (x )

1

(x )0 1
= (N + 1)
1
0
x
1 + (x ) (x )



1
(N + 1)
(x )0 1
x 1 + (x )0 1 (x )

= (N + 1)

1
1 + (x )0 1 (x )

(N + 1)

21 (x )(x )0 1
.
(1 + (x )0 1 (x ))2

(2.177)

(2.178)

CHAPTER 2. MULTIVARIATE STATISTICS

45

Evaluating this expression at the mode (2.211, AM 2005) we obtain:



Ca
2 f,
(x)

xx0

= (N + 1)1 .

(2.179)

x=Mod{X}

Therefore the modal dispersion (2.65, AM 2005) reads:


1


Ca
2 f,
(x)
MDis {X}

xx0

x=Mod{X}

1
.
N +1

(2.180)


E 72 Pdf of a log-variable (www.2.16)


Assume the distribution of the random variable X is known and is represented by its pdf fX . Consider a
random variable Y defined as follows:
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
n=1 yn

(2.182)

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:
gn (x1 , . . . , xN ) exn .

(2.183)

The inverse transformation g1 reads component-wise:


gn1 (y1 , . . . , yN ) ln(yn ) .

(2.184)

Jg = diag(ex1 , . . . , exN ) ,

(2.185)

The Jacobian (2.9) reads:

and thus from (A.42, AM 2005) its determinant reads:

|J | =

N
Y

exn .

n=1

We have to evaluate (2.186) in x = g1 (y). Therefore from (2.184) we obtain:

(2.186)

N
g 1
Y
J (g (y)) =
yn ,

(2.187)

n=1

and the expression (2.182) follows. In particular, for a lognormal distribution, from (2.156, AM 2005)
and (2.182) we have:
12

LogN
f,
(y) =

(2) 2 ||
QN
n=1 yn

e 2 (ln(y))

(ln(y))

(2.188)


E 73 Raw moments of a log-variable (www.2.16)


Determine the raw moments of a log-variable Y eX in terms of the characteristic function X of X.
In particular, determine the expression for the lognormal distribution and its first two raw moments.
Solution of E 73
RMY
n1 nk E {Yn1 Ynk }


= E eXn1 eXnk


= E eXn1 ++Xnk


= E exp(i 0n1 nk X) ,

(2.189)

where the vector is defined in terms of the canonical basis (A.15, AM 2005) as follows:

n1 nk


1  (n1 )

+ + (nk ) .
i

(2.190)

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

(
RMY
n1 nk = e

(n1 )

e 2 (

++ (nk ) )

(n1 )

++ (nk ) )0 ( (n1 ) ++ (nk ) )

(2.192)
.

In particular the expected value, which is the first raw moment, reads:
n +
E {Yn } = RMY
n =e

nn
2

(2.193)

The second raw moment reads:


m +n +
E {Ym Yn } = RMY
mn = e

mm
2

+ nn
2 +mn

(2.194)

CHAPTER 2. MULTIVARIATE STATISTICS

47

Therefore the covariance matrix reads:


Cov {Xm , Xn } = E {Ym Yn } E {Ym } E {Yn }
= em +n +

mm
2

+ nn
2

(emn 1) .

(2.195)


E 74 Relation between the Wishart and the gamma distributions (www.2.17)


Given W W(, ), a Wishart distributed variable as in (2.223, AM 2005) and a generic vector a, show
that:
a0 Wa Ga(, a0 a) .

(2.196)

Solution of E 74
If W is Wishart distributed then from (2.222, AM 2005) for any conformable matrix A we have:
AWA0 = AX1 X01 A0 + + AX X0 A0
= Y10 Y10 + + Y Y0

(2.197)

W(, AA ) ,
since:
Yt AXt N(0, AA0 ) .

(2.198)

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:
Yt a0 Xt N(0, a0 a) .

(2.199)

a0 Wa Ga(, a0 a) .

(2.200)

Therefore from (1.106, AM 2005):

E 75 Simulation of a Wishart random variable


Consider the bivariate Wishart random variable W W(, ) where:


12
1 2

1 2
22


.

(2.201)

R
Fix 1 1 and 2 1 and write a MATLAB
script in which you:
Set the inputs and ;
Generate a sample of size J 10,000 from W(, ) using the equivalent stochastic representation
(2.222, AM 2005);

Plot the histograms of the realizations of D det(W) and T tr(W) to show that indeed these
random variables are positive, see (2.236, AM 2005) and (2.237, AM 2005). Comment on whether
this is also true for 1;
Plot the 3D scatter-plot of the realizations of W11 vs. W12 vs. W22 to show the Wishart cloud.
Note that symmetry implies that a matrix is fully determined by the three non-redundant entries
(W11 , W22 , W12 ) and notice that as the degrees of freedom increases the clouds becomes less
and less "wedgy". Eventually, it becomes a normal ellipsoid, in accordance with the central limit
theorem;
Plot the separate histograms of the realizations of W11 , W12 and W22 ;
Superimpose the rescaled pdf (1.110, AM 2005) of the marginals of W11 and W22 to the respective
histograms to show that histogram and gamma pdf coincide. Indeed, from (2.230, AM 2005) the
marginal distributions of the diagonal elements of a Wishart matrix are gamma-distributed:
Wnn Ga(, nn ) ;

(2.202)

Compute and show on the command window the sample means, sample covariances, sample standard 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
R
script S_Wishart.
See the MATLAB

E 76 Pdf of an inverse-Wishart random variable (www.2.17)


Show that the pdf of the inverse-Wishart distribution reads:

IW
f,
(Z) =

+1

1
1
1
+N
2
|| 2 |Z|
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) W1 where W W(, 1 ). Then, from (2.13):


W
1
f,
(Z))
1 (g
IW
f,
(Z) = q
.
2
|Jg (g1 (Z))|

(2.205)

Using the following result in Magnus and Neudecker (1999) that applies to any invertible N N matrix
Q:


Q1
N (N +1)
(N +1)


2
|Q|
,
Q = (1)
we derive:

(2.206)

CHAPTER 2. MULTIVARIATE STATISTICS

49

(N +1)

W
1
f,
)
1 (Z

N 1


1

(N +1)
1 2 Z1 2 e 12 tr(Z1 )
= |Z|

+1

1
1
1
+N
2
2
= || |Z|
e 2 tr(Z ) .

IW
f,
(Z) = |Z|

(2.207)

E 77 Characteristic function of the empirical distribution


Derive expression (2.243, AM 2005) for the characteristic function of the empirical distribution.
Solution of E 77
n 0 o Z
0
iT () E ei X =
ei x fiT (x)dx
N
R
"
#
Z
T
X
0
i x 1
(xt )
e
=

(x) dx
T t=1
RN
T Z
0
1X
ei x (xt ) (x)dx .
=
T t=1 RN

(2.208)

Using (B.17, AM 2005) we obtain:

iT () =

T
1 X i0 xt
e
.
T t=1

(2.209)


E 78 Order statistics
R
Replicate the exercise of the MATLAB
script S_OrderStatisticsPdfStudentT assuming that the i.i.d.
variables are lognormal instead of Student t distributed.

Solution of E 78
R
See the MATLAB
script S_OrderStatisticsPdfLognormal.

E 79 Pdf of an elliptical random variable (www.2.18) *


Show that the pdf of an elliptical random variable is of the form:


1
f, (x) = p
g Ma2 (x, , ) ,
||

(2.210)

where g is any positive function that satisfies:


Z

y
0

Hint. See Fang et al. (1990, p.35).

N 2
2

g(y)dy < .

(2.211)

Solution of E 79
The family of ellipsoids centered in with shape are described by the following implicit aligns:
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:


f, (x) = h Ma2 (x, , ) ,

(2.213)

where h is a positive function, such that the normalization condition is satisfied, i.e.:
Z



h Ma2 (x, , ) dx = 1 .

(2.214)

RN

e
Suppose we have determined such a function h. From (2.32), changing into a generic parameter
does not affect the normalization condition, and therefore the ensuing pdf is still the pdf of an elliptical
e in
e . On the other hand, if we change into a generic dispersion parameter ,
distribution centered in
order to preserve the normalization condition we have to rescale (2.213) accordingly:
v
u
u
e
i
t h 2
e .
e , )
h Ma (x,
f,
(x)
=
e
e
||

(2.215)

Therefore, it is more convenient to replace (2.213) with the following specification:




1
f, (x) = p
g Ma2 (x, , ) ,
||

(2.216)

in such a way that the same functional form g is viable for any location and dispersion parameters (, ).


E 80 Moments of an elliptical random variable (www.2.18)


Consider a generic elliptical random variable X with location parameter and scatter parameter . Show
the that the following relations hold:
E {X} =
Cov {X} =

E{R2 }
,
N

(2.217)

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
Y

)
Xi2si

=E

(N
Y

i=1

)
2si

(kXk Ui )

i=1

(
=E

N
Y

!
2si

kXk

i=1

N
Y

!)
Ui2si

(2.219)

i=1

(N
)
n
o
Y
2s
2si
= E kXk
E
Ui
,
i=1

where s

PN

i=1 si .

Thus:

(N
Y
i=1

)
Ui2si

QN
=



E Xi2si
n
o .
2s
E kXk
i=1

(2.220)

On the other hand, for a standard normal variable Xi we have:



(2si )!
E Xi2si = si ,
2 si !

(2.221)

see e.g. www.mathworld.com and references therein. For a standard multivariate normal variable X we
have:
n
o


2s
2 s
E kXk
= E (X12 + + XN
) E {Y s } ,

(2.222)

where Y 2N . Therefore from (1.109, AM 2005) we see that (2.222) is the s-th raw moment of a chisquare 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
=
.
( N2 )

(2.223)

From (B.82, AM 2005) we have:








N
N + 2s
(N + 2s 2)(N + 2(s 1)) n0
+s =
=
,
N +2s1
2
2
2 2

(2.224)

where n0 1 is n is odd and n0 2 if n is even. Defining:


x[s] x(x + 1) (x + s 1) ,
we can write (2.223) as follows:

(2.225)

n
o
2s
E kXk
= (N + 2(s 1)) (N + 2)N

 

N
N
N
= 2s
+ (s 1)
+1
2
2
2
 [s]
N
= 2s
.
2

(2.226)

Substituting (2.221) and (2.226) in (2.220) we obtain:

(N
Y

)
Ui2si

i=1

N
1 Y (2si )!
,
( N2 )[s] i=1 4si si !

(2.227)

which is Fang et al. (1990, formula 3.6). In particular:


E {U} = 0 ,

(2.228)

and

Cov {U} =

IN
,
N

(2.229)

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
A1 (X )
kA1 (X )k
1

R A (X ) .

(2.231)

From (2.259, AM 2005)-(2.260, AM 2005), R is independent of U, which is uniformly distributed on the


surface of the unit ball. Using (2.228) we obtain:
E {X} = E { + RAU} = + E {R} A E {U} = .
Using (2.93, AM 2005) we obtain:

(2.232)

CHAPTER 2. MULTIVARIATE STATISTICS

53

+RAU
ARU
CMX
m1 mk = CMm1 mk = CMm1 mk

N
X

Am1 n1 Amk nk CMRU


m1 mk

n1 ,...,nk =1

N
X

Am1 n1 Amk nk RMRU


m1 mk

n1 ,...,nk =1

N
X

(2.233)

Am1 n1 Amk nk E {RUn1 RUnk }

n1 ,...,nk =1


= E Rk

N
X

Am1 n1 Amk nk E {Un1 Unk } .

n1 ,...,nk =1

Substituting (2.227) in (2.233) yields the desired result.

E 81 Radial-uniform representation
R
script in which you:
Write a MATLAB
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 ) ,
where 0.1 and 2 0.04.
Solution of E 81
R
See the MATLAB
script S_EllipticalNDim.

(2.235)

E 82 Elliptical markets and portfolios


Consider an elliptical market M El(, , gN ) together with the objective a a0 M, where a is a
generic vector of exposures. Prove that:
d

a = a + a Z ,

Z El(0, 1, g1 ) ,

(2.236)

and write the expression for a and a .


Solution of E 82
From (2.270, AM 2005) we obtain:
a El(a , a2 , g1 ) ,
where a a0 and a2 a0 a. From (2.258, AM 2005):

(2.237)

a = a + a Z ,

(2.238)

where Z is spherically symmetrical and therefore Z El(0, 1, g1 ).

E 83 Generalized function m (www.2.19)


Show that m in (2.291, AM 2005) satisfies (2.283, AM 2005) and (2.284, AM 2005).
Solution of E 83
First, note that the vectors v(n) and their opposite belong to the surface of the ellipsoid centered at zero
with shape parameter in (A.73, AM 2005). Indeed:
i0
h
i h
i0
h
i
h
v(m) 1 v(n) = v(m) 1 v(n)


= V0 1 V mn
h 1
i
1
1
1
= ( 2 E0 )E 2 2 E0 (E 2 )

(2.239)

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.


E 84 Correlation in normal markets


Consider a bivariate normal random variable:


X1
X2


N

1
2


,S

12
1 2

1 2
22


.

(2.241)

R
Fix 1 0, 2 0, 1 1, 2 1 and write a MATLAB
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)

Hint. Remember the relationship between eigenvalues and ellipsoid.


Solution of E 84
R
See the MATLAB
script S_AnalyzeNormalCorrelation.

E 85 Correlation in lognormal markets


Consider the bivariate lognormal variable:


X1
X2


LogN

1
2

 
,

12
1 2

1 2
22


.

R
Fix 1 0, 2 0, 1 1, 2 1 and write a MATLAB
script in which you:

(2.243)

CHAPTER 2. MULTIVARIATE STATISTICS

55

R
Rely on the MATLAB
function LogNormalParam2Statistics to plot the correlation between X1
and X2 as a function of (1, 1) (notice that the correlation will not approach 1, why?);
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.244)

Hint. Remember the relationship between eigenvalues and ellipsoid.


Solution of E 85
R
See the MATLAB
script S_AnalyzeLognormalCorrelation.

E 86 Independence versus no correlation


Consider a random vector X (X1 . . . , XT )0 that is Student t distributed:
X St(, 0T , IT ) ,

(2.245)

where 0T is a T -dimensional vector of zeros and IT is the T T identity matrix.


Compute the distribution of the marginals Xt , t = 1, . . . , T , the correlation among each pair of
entries and the distribution of:

T
X

Xt .

(2.246)

t=1

Then consider T i.i.d. Student t-distributed random variables:


et St(, 0, 1),
X

t = 1, . . . , T ,

(2.247)

and compute the correlation among each pair of entries.


Finally, consider the limit T and compute the distribution of:

Ye

T
X

et ,
X

(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:
Xt St(, 0, 1),

t = 1, . . . , T .

(2.249)

From (2.191, AM 2005) the cross-correlations read:


Corr {Xt , Xs } = 0,
From (2.195, AM 2005) we obtain:

t 6= s .

(2.250)

T
X

Xt = 10 X St(, 10 0T , 10 IT 1) .

(2.251)

t=1

Therefore:
Y St(, 0, T ) .

(2.252)

e is concerned, from (2.136, AM 2005) the cross-correlations read:


As far as X
n
o
et , X
es = 0,
Corr X

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:

e
Y N 0,

T
2


.

(2.254)

Both Y and Ye are the sum of uncorrelated identically distributed t variables. If the variables are independent, 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.


E 87 Correlation and location-dispersion ellipsoid (see E 75)


Consider the same setup than in E 75. Consider the first diagonal entry and the off-diagonal entry
(W11 , W12 ). Define the following two rescaled variables:
W11 E {W11 }
Sd {W11 }
W12 E {W12 }
X2
.
Sd {W12 }
X1

(2.255)
(2.256)

R
Write a MATLAB
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.
R
In order to do so, feed the MATLAB
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

Hint. The correlation can be computed analytically.


Solution of E 87
Corr {X1 , X2 } = Cov {X1 , X2 }
1
p
=p
Cov {W11 , W12 }
Var {W11 } Var {W12 }
1
p
(11 12 + 12 11 )
=p
2
211 (11 22 + 12 21 )

2
=p
.
1 + 2
R
For the MATLAB
scripts, see S_WishartLocationDispersion and S_WishartCorrelation.

(2.257)

E 88 Copula vs. correlation


R
Consider a generic N -variate Student t random variable X St(, , ). First, write a MATLAB
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.
R
Then, write a MATLAB
script where you call the above function to evaluate the copula pdf at a select
grid of bivariate values:

u G [0.05 : 0.05 : 0.95] [0.05 : 0.05 : 0.95] .

(2.258)

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
R
MATLAB
function StudentTCopulaPdf and the script S_DisplayStudentTCopulaPdf.


E 89 Full co-dependence
R
Write a MATLAB
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
R
See the MATLAB
script S_FullCodependence.

Chapter 3

Modeling the market


E 90 Approximation of the ATMF implied volatility (www.3.1)
Prove the following approximation for the ATMF implied volatility:
(Kt ,E)

(K ,E)

2 Ct t
E t Ut

Hint. Using the following Maple command: taylor(RootOf(erf(y)


third-order Taylor expansion of the inverse error function:
erf 1 (x) =
Moreover, since the term

(Kt ,E)

Ct

Ut

(3.1)

= x, y), x = 0, 3);

1/2
3/2 3
x+
x + .
2
24

we can perform a

(3.2)

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:
(Kt ,E)

Ct

(E)

(K,E)

= C BS (E t, Kt , Ut , Zt , t
)



1
E t (K,E)
= Ut 1 + erf
t
2
2



1
E t (K,E)
Ut 1 + erf
t
2
2



E t (K,E)

= Ut erf
t
.
8

(3.3)

Therefore:
(K ,E)
t t

r
=

8
erf 1
Et
58

(Kt ,E)

Ct

Ut

!
,

(3.4)

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.


E 91 Distribution of the sum of independent variables (www.3.2)


Show that the pdf of the sum of two independent variables XA and XB is the convolution of the marginal
pdfs fXA and fXB :
fXA +XB = fXA fXB .

(3.5)

Note. Repeating the argument in (3.7) we obtain that the sum of any number of independent and identically distributed random variables reads:
fX1 ++XT = fX fX ,

(3.6)

where fX is the common pdf of each generic variable Xt .


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
fXA ,XB (y x, x)dx ,

fY (y) = fXA +XB (y) =

(3.7)

which follows from:


fY (y)dy = P {Y [y, y + dy]} = P {XA + XB [y, y + dy]}
= P {XA [y XB , y XB + dy]}
Z

=
fXA ,XB (y xB , xB )dxB dy .

(3.8)

If the variables X and Y are independent, the joint pdf is the product of the marginal pdf:
fXA ,XB (xA , xB ) = fXA (xA )fXB (xB ) .

(3.9)

Therefore the pdf of the sum (3.7) becomes:


Z
fXA (y x)fXB (x)dx .

fXA +XB (y) =

(3.10)

We see that this is the convolution (B.43, AM 2005) of the marginal pdf:
fXA +XB = fXA fXB .

(3.11)


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:
X1 ++XT () = (X ())T .

(3.12)

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:
X1 ++XT = F [fX1 ++XT ] ,

(3.13)

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:
X1 ++XT = F [fX fX ] = (F [fX ])T = (X ())T ,

(3.14)

which is again (3.12).


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:


fX1 ++XT = F 1 (X ())T .

(3.15)

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:


fX1 ++XT = F 1 (F [fX ])T .

(3.16)

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
o
0
= E ei X1 ei XT
n 0 o
n 0 o
= E ei X1 E ei XT .

(3.17)

X1 ++XT () = (X ())T ,

(3.18)

Therefore:

where X is the common characteristic function of each generic variable Xt .

CHAPTER 3. MODELING THE MARKET

61

E 93 The square-root rule for the expectation (www.3.3)


Prove the "square-root rule" for the expectation:
E {XT, } =

E {XT,e } .
e

(3.19)

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 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)

The first derivative of the characteristic function reads:



XT ,e () e
XT , ()
=

XT ,e ()

= (XT ,e ()) e 1
.
e

(3.21)

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)

we obtain for the first raw moment:

E {XT, } = i



XT ,e (0)
XT , (0)

i
.
=

(3.23)

Using again (2.98) in (3.23) we obtain:


E {XT, } =

E {XT,e } .
e

(3.24)


E 94 The square-root rule for the covariance (www.3.3)


Prove the "square-root rule" for the covariance:
Cov {XT, } =

(Cov {XT,e }) .
e

(3.25)

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)

The second derivative of the characteristic function reads:




2 XT , ()


1 XT ,e ()

e
=
(XT ,e ())
0
e
0


XT ,e () XT ,e ()


=
1 (XT ,e ()) e 2
e e

()

XT ,e
.
+ (XT ,e ()) e 1
e
0

(3.27)

From (2.98), evaluating these derivatives at the origin and using the fact that:
n 0 o
X (0) E eiX 0 = 1 ,

(3.28)



2 XT , (0)
E XT, X0T, =
0



XT ,e (0)
XT ,e (0) XT ,e (0)
=
1

.
0
e e

e 0

(3.29)

we obtain the second raw moment:

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
e

e

XT ,e (0) XT ,e (0) XT ,e (0)
=

0
0
 

 

XT ,e (0)
XT ,e (0)
XT ,e (0)

=
i
i
+
.
e

0
0
Using again (2.98) in (3.30) we obtain:

(3.30)

CHAPTER 3. MODELING THE MARKET

63




0
E {XT,e } E {XT,e } + E XT,e X0T,e
e

= (Cov {XT,e }) .
e

Cov {XT, } =

(3.31)


E 95 Multivariate square-root rule


R
Write a MATLAB
script in which you:
Scatter-plot the differences over a time e = one day of the two-year versus the ten-year point of the
swap curve from the database DB_Swaps;
e between these two series;
Compute the sample covariance
e by means of its location dispersion ellipsoid;
Represent geometrically
Consider the empirical covariance at different horizons of = one week and = one month
respectively;
Represent all of these covariances by means of their location-dispersion ellipsoids, which we plot
in the figure as solid red lines;
e /e
Compare these ellipsoids with the suitable multiple
as in (3.76, AM 2005) of the daily
ellipsoid, which we plot as dashed ellipsoids;
See from the figure that the solid and the dashed ellipsoids are comparable and thus the swap rate
changes are approximately invariants: the volatilities increase according to the square-root rule and
the correlation is approximately constant.

Solution of E 95
R
See the MATLAB
script S_MultiVarSqrRootRule.

E 96 Projection of Cauchy invariants


Assume that the distribution of the market invariants at the estimation horizon e is multivariate Cauchy:
Xe Ca(, ) .

(3.32)

Assume that the invariants satisfy the accordion property (3.60, AM 2005). Prove that the distribution
of the market invariants at any generic investment horizon is Cauchy. Draw your conclusions on the
propagation law of risk in terms of the modal dispersion (2.212, AM 2005).
Hint. Like the normal distribution, the Cauchy distribution is stable. Use the characteristic function
(2.210, AM 2005) to represent this distribution at any horizon. Notice that the covariance is not defined.
Solution of E 96
From (3.64, AM 2005) and (2.210, AM 2005) we obtain:

() = (e ()) e
0

= (ei
=e

i0 e

) e

(3.33)

0 ( e )2

Therefore:

X Ca

2
, 2
e e


.

(3.34)

In particular, from (2.212, AM 2005) we obtain:

MDis {X} =

2
MDise {X} .
e2

(3.35)

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
E{(X X )2 } ,

(3.37)

the standard deviation (1.42, AM 2005):


X
the skewness (1.49, AM 2005):
3
skX E{(X X )3 }/X
,

(3.38)

4
kuX E{(X X )4 }/X
,

(3.39)

the kurtosis (1.51, AM 2005):

and in general n-th standardized summary statistics


(n)

n
X E{(X X )n }/X
,

n 3.

(3.40)

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)

from the first n single-period statistics for the single-period invariant X:


(5)

(n)

X , X , skX , kuX , X , . . . , X .
Hint. Use the central moments, see (1.48, AM 2005):

(3.43)

CHAPTER 3. MODELING THE MARKET

CMX
1 X ,

65

n
CMX
n E{(X E{X}) } ,

n = 2, 3, . . . ,

(3.44)

the non-central, or raw, moments, see (1.47, AM 2005):


n
RMX
n E{X },

n = 1, 2, . . . ,

(3.45)

and the cumulants:


(n)


dn ln(E{ezX })
,

dz n
z=0

n = 1, 2, . . . .

(3.46)

Then use recursively the identity:

(n)

X = RMX
n

n1
X

n1
k1

(k)

X RMX
nk ,

(3.47)

k=1

see Kendall and Stuart (1969).


Note. See Meucci (2010a).
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)

X
Step 1. We compute from (3.48) the central moments CMX
1 , . . . , CMn of Xt . To do so, notice
X
2
and that from (3.40) we obtain:
from the definition of central moments (3.44) that CM2 X
(n)

n
CMX
n = X X ,

n 3.

(3.49)

X
Step 2. We compute from the central moments the raw moments RMX
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)
zX
start from X = RMX
} E{1 + zX} =
1 : this follows from the Taylor approximations E{e
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)

(n)

X1 ++X = X1 + + X .

(3.50)

In particular, since Xt is an invariant, all the Xt s are identically distributed. Therefore the projected cumulants read:
(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)

RMYn = Y +

n1
X

n1
k1

(k)

Y RMYnk ,

(3.52)

k=1

which follows from applying (3.47) to Y and rearranging the terms.


Step 6. We compute from the raw moments of Y the central moments of Y .
Step 7. We compute from the central moments of Y the standardized summary statistics:
(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
R
MATLAB
script S_ProjectSummaryStatistics for the implementation


E 98 Explicit factors: regression factor loadings (www.3.4) *


Derive the expression for the regression factor loadings in (3.121, AM 2005):
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 E {(X BF)0 (X BF)}
X
=
E {(Xn Bnk Fk )(Xn Bnj Fj )}
n,k,j

 X
E Xn2
E {Bnk Fk Xn }

n,k

E {Xn Bnj Fj } +

n,j

E {Bnk Fk Bnj Fj }

(3.55)

n,k,j

X

E Xn2 2
Bnk E {Xn Fk }

n,k

Bnj Bnk E {Fk Fj } .

n,k,j

Therefore the first order conditions with respect to Bsl read:


0sl =

M
Bsl

X
= 2 E {Xs Fl } +
Bnj Bnk E {Fk Fj }
Bsl
n,k,j
X
= 2 E {Xs Fl } + 2
Bsk E {Fk Fl } .
k

(3.56)

CHAPTER 3. MODELING THE MARKET

67

In matrix notation these equations read:


0N K = 2 E {XF0 } + 2B E {FF0 } ,

(3.57)

whose solution is:


1

Br = E {XF0 } E {FF0 }

(3.58)


E 99 Explicit factors: expected value and correlation of residuals (www.3.4)


Show that in general the residuals of the general regression do not have zero expected values and are
correlated.
Solution of E 99
The residuals read:
U X Br F
1

= X E {XF0 } E {FF0 }

(3.59)

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
= E {X} E {XF0 } E {FF0 }

(3.60)
E {F} .

Furthermore, in general the residuals are correlated:


Cov {U, F} = E {UF0 } E {U} E {F0 }
n
o
1
= E (X E {XF0 } E {FF0 } F)F0
n
o
1
E X E {XF0 } E {FF0 } F E {F0 }
= E {XF0 } E {XF0 } E {FF0 }

E {X} E {F0 } + E {XF0 } E {FF0 }


1

= E {XF0 } E {FF0 }

(3.61)

E {FF0 }
E {F} E {F0 }

E {F} E {F0 } E {X} E {F0 } .

This expression is zero if E {F} = 0.

E 100 Explicit factors: covariance of residuals (www.3.4)


Show that the covariance of the residuals of the general regression with the factors can be expressed as:
Cov {U, F} = Cov {X, F} Br Cov {F} ,
where Br is given by (3.121, AM 2005).

(3.62)

Solution of E 100
Using (3.121, AM 2005), we can also express the covariance of the residuals with the factor as follows:
Cov {U, F} = E {UF0 } E {U} E {F0 }
o
n
1
= E (X E {XF0 } E {FF0 } F)F0
n
o
1
E X E {XF0 } E {FF0 } F E {F0 }
(3.63)

= E {XF0 } E {X} E {F0 }


+ E {XF0 } E {FF0 }

(E {F} E {F0 } E {FF0 })


1

= Cov {X, F} E {XF0 } E {FF0 }

Cov {F}

= Cov {X, F} Br Cov {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):
e r E {X} + Cov {X, F} Cov {F}1 (F E {F}) .
X

(3.64)

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}
0

(3.66)

+ 2a G E {F} 2a E {X} 2 E {X GF} .


We re-write (3.66) emphasizing the terms containing a:
M = +

X
X
X
(aj )2 + 2
aj Gjk E {Fk } 2
aj E {Xj } .
j

(3.67)

j,k

Setting to zero the first order derivative with respect to aj we obtain:


aj = E {Xj }

X
k

Gjk E {Fk } ,

(3.68)

CHAPTER 3. MODELING THE MARKET

69

which in matrix notation yields:


ar = E {X} Gr E {F} .

(3.69)

Now we re-write (3.66) emphasizing the terms containing G:


M = +

E {Fj Gkj Gkl Fl } + 2

jkl

aj Gjk E {Fk } 2

jk

E {Fk Gjk Gjl Fl } + 2

jkl

E {Xj Gjk Fk }

jk

aj Gjk E {Fk } 2

jk

(3.70)

E {Xj Gjk Fk } .

jk

Setting to zero the first order derivative with respect to Gjk and using (3.68) we obtain:
0=

E {Fk Gjl Fl } + aj E {Fk } E {Xj Fk }

!
=

E {Fk Gjl Fl } +

E {Xj }

Gjl E {Fl } E {Fk } E {Xj Fk }

!
=

E {Fk Gjl Fl }

E {Gjl Fl } E {Fk }

(3.71)

(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 } .
In matrix notation this expression reads:
G Cov {F} = Cov {X, F} ,

(3.72)

which implies:
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 E {X} + Cov {X, F} Cov {F}1 (F E {F}) .
X

(3.74)


E 102 Explicit factors (with a constant among the factors): expected value of
residuals (www.3.4) *
e r in (3.119, AM 2005) and (3.126, AM 2005) and show that:
Define the residuals as Ur X X
E{Ur } = 0 ,

Corr{F, U} = 0KN .

(3.75)

Solution of E 102
The residuals read:
e r = X Gr F ,
Ur X X

(3.76)

where:
X X E {X} ,

F F E {F} .

(3.77)

Therefore the residuals have zero expected value. The covariance of the residuals with the factors reads:
n
 0o
X Gr F F
o
n 0o
n
0
= E XF Gr E FF

Cov {Ur , F} = E

(3.78)

= Cov {X, F} Gr Cov {F} .


Therefore using (3.73) we obtain:
1

Cov {Ur , F} = Cov {X, F} Cov {X, F} Cov {F}

Cov {F} = 0KN .

(3.79)


E 103 Explicit factors (with a constant among the factors): covariance of residuals (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:

0 o
X Gr F X Gr F
n
o
n
o
n 0o
0
0
= E XX 2 E XF G0r + Gr E FF G0r

Cov {Ur } = E

n

(3.81)

= Cov {X} 2 Cov {X, F} G0r + Gr Cov {F} G0r .


Therefore using (3.73) we obtain:
1

Cov {Ur } = Cov {X} Cov {X, F} Cov {F}

Cov {F, X} .

(3.82)


E 104 Explicit factors: generalized r-square (www.3.4) *


Show that the generalized r-square (3.116, AM 2005) of the explicit factor model can be expressed as an
average correlation (3.140, AM 2005):

CHAPTER 3. MODELING THE MARKET

71

n
o
e r = 1 tr(Corr {X, E0 F} Corr {E0 F, X}) ,
R2 X, X
N

(3.83)

where E is the (N K) matrix of eigenvalues of , see (3.135, AM 2005).


Solution of E 104
First of all we consider a scale independent model. We recall from (1.35, AM 2005) that the z-scores of
the variables are defined as follows:
ZX D1
X (X E {X}) ,

(3.84)

DX diag(Sd {X1 } , . . . , Sd {XN }) .

(3.85)

where:

1
Left-multiplying (3.127, AM 2005) by DX
we obtain the recovered z-score of the original variable X:

e X D1 (X
e r E {X})
Z
X
1

= D1
(F E {F})
X Cov {X, F} Cov {F}
 1

1
= Cov DX X, F Cov {F} (F E {F}) .

(3.86)

Consider the spectral decomposition (2.76, AM 2005) of the covariance of the factors:
Cov {F} EE0 ,

(3.87)

where E is the juxtaposition of the eigenvectors:


E (e(1) , . . . , e(K) ) ,

(3.88)

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:
Cov {E0 F} = E0 Cov {F} E = E0 EE0 E = ,

(3.90)

which is diagonal. Now consider the z-scores of the rotated factors:


1

ZF 2 E0 (F E {F}) ,
which are uncorrelated and have unit standard deviation:

(3.91)

Cov {ZF } = 2 E0 EE0 E 2 = IK .

(3.92)

From (3.86) the recovered z-score of the original variable X reads:




e X = Cov D1 X, F E1 E0 (F E {F})
Z
X
oh
i
n
1
12 0
E (F E {F}) 2 E0 (F E {F})
= Cov D1
X X,
h
i
1
= Corr {X, E0 F} 2 E0 (F E {F}) .

(3.93)

On the other hand, the generalized r-square defined in (3.116, AM 2005) reads in this context:
n
o
n
o
eX
e r R2 ZX , Z
R2 X, X
n
o
e X )0 (ZX Z
eX )
E (ZX Z
1
tr {Cov {ZX }}
a
=1
.
N
The term in the numerator can be written as follows:
n
o
e X )0 (ZX Z
eX )
a E (ZX Z
h

i0
1
1
e
e
= E DX (X X) DX (X X)
n
o
e 0 D1 D1 (X X)
e
= E (X X)
X
X

n
o
1 1
e
e 0
= tr DX DX E (X X)(X
X)
,

(3.94)

(3.95)

using (3.129, AM 2005) this becomes:


1

1
a tr(D1
X DX [Cov {X} Cov {X, F} Cov {F}

=
=

Cov {F, X}])

1
1
Cov {X}) tr(D1
Cov {F, X})
X DX Cov {X, F} Cov {F}
1
1 1
tr(Corr {X}) tr(DX DX Cov {X, F} Cov {F} Cov {F, X})
1
tr(D1
X DX

o
n
o
n
1
1
1 0
2
= N tr(Cov D1
E Cov E 2 ZF , D1
X X )
X X, E ZF E




1
= N tr(Cov D1
X X, ZF Cov ZF , DX X )

(3.96)

= N tr(Corr {X, E0 F} Corr {E0 F, X}) .


Therefore the r-square (3.94) reads:
n
o
0
0
e X = 1 N tr(Corr {X, E F} Corr {E F, X})
R2 ZX , Z
N
1
0
=
tr(Corr {X, E F} Corr {E0 F, X}) .
N

(3.97)

CHAPTER 3. MODELING THE MARKET

73

E 105 Spectral decomposition: symmetry


Consider a N N matrix of the form:
EE0 ,

(3.98)

where is diagonal and E is invertible. Prove that is symmetric, see definition (A.51, AM 2005).
Solution of E 105
0 (EE0 )0 = E0 E0 = EE0 = .

(3.99)


E 106 Spectral decomposition: positivity


Consider a N N matrix of the form:
EE0 ,

(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:

v0 v v0 EE0 v = w0 w =

N
X

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 107 Hidden factors: recovered invariants as projection (www.3.5) *


Show that the the expression of the PCA-recovered invariants (3.160, AM 2005) represents the orthogonal
projection of the original invariants onto the hyperplane spanned by the K longest principal axes.
Solution of E 107
From (3.160, AM 2005), the PCA-recovered invariants can be expressed as:
e p a + GX ,
X

(3.102)

a (IN EK E0K ) E {X}

(3.103)

where:

EK E0K

(3.104)

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:

x E {X} +

N
X
n=1

n e(n) ,

(3.105)

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:

a + Gx = E {X} +

K
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:

a + Gx (IN EK E0K ) E {X} + EK E0K

E {X} +

N
X

!
n e(n)

n=1

= E {X} +

N
X

n EK E0K e(n)

(3.107)

n=1

Therefore in order prove our statement it suffices to prove that if n K then the following holds:
EK E0K e(n) = e(n) ,

(3.108)

EK E0K e(n) = 0 .

(3.109)

and 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)

..

,
.
 (K) 0 (n)
e
e



EK E0K e(n) e(1 e(K)

(3.110)

and the fact that E is orthonormal:


EE0 = IN ,
where IN is the identity matrix of order N .

(3.111)


E 108 Hidden factors: generalized r-square (www.3.5)


Show that the generalized r-square (3.116, AM 2005) of the PCA dimension reduction can be expressed
in terms of the eigenvalues (3.150, AM 2005) of the covariance matrix as follows:
n
o PK
e p = Pn=1 n .
R2 X, X
N
n=1 n

(3.112)

CHAPTER 3. MODELING THE MARKET

75

Solution of E 108
The residual of the PCA dimension reduction reads:
e p (IN EK E0 )(X E {X})
Up X X
K
= RK R0K (X E {X}) ,

(3.113)

where RK is the juxtaposition of the last (N K) eigenvectors:


RK (e(K+1) e(N ) ) .

(3.114)

RK R0K RK R0K = RK R0K .

(3.115)

This matrix satisfies:

Indeed, from (3.111) and the definition of RK we obtain:

RK R0K e(n)

 (K+1) 0 (n)
e
e

.
(K+1)
(N )
..
(e
e )
.
 (N ) 0 (n)
e
e

(3.116)

Therefore, if n > K then:


RK R0K e(n) = e(n) ,

(3.117)

RK R0K e(n) = 0 .

(3.118)

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
e p)
M E (X X
= E {(X E {X})0 RK R0K RK R0K (X E {X})}
= E {(X E {X})0 RK R0K (X E {X})}

(3.119)

= tr(Cov {R0K X}) .


On the other hand from the definition (3.114) of RK we obtain:
E0 RK = ( (K+1) (N ) ) ,
where (n) is the n-th element of the canonical basis (A.15, AM 2005). Therefore:

(3.120)

Cov {R0K X} = R0K Cov {X} RK


= R0K EE0 RK

(3.121)

= diag(K+1 , . . . , N ) .
Substituting (3.121) in (3.119) we obtain:
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 eigenvalues. This follows from (3.149, AM 2005) and (A.67, AM 2005). Therefore, the generalize r-square
reads:
PN
PK
n
o

e p = 1 Pn=K+1 n = P n=1 n .
R2 X, X
N
N
n=1 n .
n=1 n .

(3.123)

The residual (3.113) clearly has zero expected value. Similarly, the factors:
Fp E0K (X E {X})

(3.124)

have zero expected value. From (3.117) and (3.118) we obtain:


RK R0K E = (0 0 e(K+1) e(N ) ) .

(3.125)

(E0 EK ) = (e(1) e(K) ) .

(3.126)

Similarly:

Therefore the covariance of the residuals with the factors reads:




Cov {Up , Fp } = E Up F0p
= E {RK R0K (X E {X})(X E {X})0 EK }
= RK R0K Cov {X} EK
= (RK R0K E)(E0 EK )

(3.127)

= (0 0 e(K+1) e(N ) )(1 e(1) K e(K) )


= 0N K ,
where the last equality follows from EE0 = IN .

E 109 Hidden factors: derivation, correlations and r-square


Consider the approximation Y provided to the market X by a given model:

CHAPTER 3. MODELING THE MARKET

77

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):

2
Rw
{Y, X} 1

tr(Cov {w(Y X)})


.
tr(Cov {WX})

(3.129)

Consider now a linear factor model:


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:
Cov {WX} EE0 .

(3.132)

In this expression is the diagonal matrix of the decreasing, positive eigenvalues of the covariance:
diag(21 , . . . , 2N ) ,

(3.133)

and E is the juxtaposition of the respective eigenvectors, which are orthogonal and of length 1 and thus
EE0 = IN :
E (e(1) , . . . , e(N ) ) .

(3.134)

Next, we define a N K matrix as the juxtaposition of the first K eigenvectors:


EK (e(1) , . . . , e(K) ) .

(3.135)

Then optimal B and G read:


B = w1 EK ,

G E0K w .

(3.136)

The r-square (3.185) provided by the principal component solution (3.136) reads:
PK
2
2
k=1 k
.
Rw
= PN
2
n=1 n

(3.137)

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).


E 110 Hidden factors: principal component analysis of a two-point swap curve


R
Write a MATLAB
script in which you:
Upload the database DB_Swap2y4y of the 2yr and 4yr daily par swap rates;
Plot the "current curve" i.e. the rates at the last observation date as functions of the respective
maturities ("points on the curve");
Find the two invariants for the two rate series for a weekly estimation horizon (one week = five
R
days). Use the MATLAB
function PerformIidAnalysis test;
Scatter plot the time series of one invariant against the time series of the other invariant;
Superimpose the two-dimensional location-dispersion ellipsoid determined by sample mean and
sample covariance of the invariants (set the scale factor equal to 2): you should see a highly elongated ellipsoid;
Perform the spectral decomposition of the sample covariance of the invariants.
Plot the two entries of the first eigenvector (first factor loadings) as a function of the respective
points on the curve;
Superimpose the plot of the two entries of the second eigenvector (second factor loadings) as a
function of the respective points on the curve;
Compute and plot a one-standard-deviation effect and a minus-one-standard-deviation effect of the
first factor on the current curve as in the case study in the textbook;
Compute and plot a one-standard-deviation effect and a minus-one-standard-deviation effect of the
second factor on the current curve, as in the case study in the textbook;
Compute the generalized R2 provided by the first factor;
Compute the generalized R2 provided by both factors.

Solution of E 110
R
See the MATLAB
script S_SwapPca2Dim.

E 111 Hidden factors: puzzle


Consider a N -dimensional market that is normally distributed:
X N(, ) .

(3.138)

R
Write a MATLAB
script in which you:
Choose an arbitrary dimension N and generate arbitrarily;
Generate as follows:

BB0 + 2 ,

(3.139)

where B is an arbitrary matrix N K, with K < N and 2 is an arbitrary diagonal matrix;


Generate a large number of scenarios {Xj }j=1,...,J from the distribution (3.138) with matching
b
b and ;
sample first and second moment

CHAPTER 3. MODELING THE MARKET

79

R
b and
b as
Run the built-in MATLAB
function factoran, which outputs the estimated values of B
well as the hidden factors {fj }j=1,...,J ;
Verify that the factor analysis routine works well, i.e.:

b B
bB
b0 +
b2;

(3.140)

Compute the residuals uj Xj BFj and their sample covariance;


Verify that the residuals are not idiosyncratic, in contradiction with the very principles of factor
analysis.
Note. See Meucci (2010e).
Solution of E 111
R
See the MATLAB
script S_FactorAnalysisNotOK.

E 112 Pure residual models: duration/curve attribution


Consider as market Xt the weekly linear returns of N 3 bonds, net of the "carry", or "roll-down",
i.e. the deterministic component as in (3.108, AM 2005) and comments thereafter in Meucci (2005).
Consider as exogenous factors Ft the weekly changes in K 9 key rates of the government curve: 6
months, one year, 2, 3, 5, 7 10, 20 and 30 years. Consider as exogenous loadings Bt the key rate durations
of these bonds, where Bt is a N K = 3 9 matrix. Consider the pure residual factor model:
Xt Bt Ft + Ut .

(3.141)

R
Write a MATLAB
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:

fFT +! ,UT +!

T
1 X (ft ,ut )

,
T t=1

(3.142)

see (4.35, AM 2005);


Compute the correlation among residuals and between factors and residuals according to the empirical distribution (3.142) and verify that (3.141) is not a systematic-plus-idiosyncratic model.
Hint. See Meucci (2010e).
Solution of E 112
R
See the MATLAB
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
Rw
{Y, X} 1

tr(Cov {w(Y X)})


.
tr(Cov {WX})

(3.144)

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 compute 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 correlations with each other are not null. The r-square provided by the model with loadings (3.146) is:
1

2
Rw
=

tr(Cov {WX, F} Cov {F} Cov {F, WX})


.
tr(Cov {WX})

(3.147)


See all the solutions in Meucci (2010e).

E 114 Time series factors: unconstrained time series industry factors


Consider the n = 1, . . . , N 500 stocks in the S&P 500 and the k = 1, . . . , K 10 industry indices.
We intend to build a factor model:
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 randomness of the factors into the randomness of the risk drivers; and U (U1 , . . . , UN )0 are defined as the N
R
residuals that make (3.148) an identity. Write a MATLAB
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:

fX,F

T
1 X (Xt ,ft )

,
T t=1

(3.149)

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 arbitrary):
2
B argmax Rw
{BF, X} ;

(3.150)

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.
Note. See Meucci (2010e).
Solution of E 114
R
See the MATLAB
script S_TimeSeriesIndustries.

E 115 Time series factors: generalized time-series industry factors (see E 114)
R
Consider the same setup than in E 114. Write a MATLAB
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):

2
B argmax Rw
{BF, X} .

(3.151)

BC

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
X

n = 1, . . . , N , k = 1, . . . , K
(3.152)

Mn Bn,k 1 .

n=1

Proxy the market capitalization as 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.
Solution of E 115
R
See the MATLAB
script S_TimeSeriesConstrainedIndustries.

E 116 Time series factors: analysis of residuals I


Consider a market of N stocks, where each stock n = 1, . . . , N trades at time t at the price Pt,n . Consider
as interpretation factors the linear returns on a set of K indices, such as GICS sectors, where each index
k = 1, . . . , K quotes at time t at the price St,k . As in Black-Scholes, assume that stocks and indices
follow a geometric Brownian motion, i.e.:


X
F

 
 
X
X
N
,
F
0XF

XF
F


,

(3.153)

where:



PT +,n
Xn ln
PT,n


ST +,k
Fk ln
.
ST,k

(3.154)

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)

in terms of the explanatory factors:

by means of a linear model:

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:
B E {RZ0 } (E {ZZ0 })1 .

(3.158)

Also from (2.219, AM 2005)-(2.220, AM 2005) in general for a log-normal variable:


Y LogN(, ) .

(3.159)

then:
1

E {Y} = e+ 2 diag()
0

E {YY } = (e

+ 12 diag()

(3.160)
(e

+ 12 diag() 0

))e ,

(3.161)

where denotes the term-by-term Hadamard product. Since:



1+

R
Z

 
 
X
X
LogN
,
F
0XF

XF
F


,

(3.162)

using (3.160), (3.161) and the property:


E {(Y 1)} = E {Y} 1
E {(Y 1)(Y 1)0 } = E {YY0 } + 110 E {Y10 } E {1Y0 } ,

(3.163)

CHAPTER 3. MODELING THE MARKET

83

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:
Z = E {ZZ0 } E {Z} E {Z0 } ,

(3.164)

and similarly the covariance of the returns follows from:


R = E {RR0 } E {R} E {R0 } .

(3.165)


E 117 Time series factors: analysis of residuals II (see E 116)


R
Consider the same setup than in E 116. Write a MATLAB
script in which you:
Generate randomly the parameters of the distribution (3.154);
Generate a large number of Monte Carlo scenarios from (3.154) and verify that the sample covariances of explanatory factors and linear returns match with (3.164) and (3.165);
Estimate the loadings by OLS of the Monte Carlo simulations i.e. the sample counterpart of (3.158);
b R and verify that
b R is not diagonal and that:
Compute the residuals and their sample covariance

b R 6= B
b
b ZB
b0 +
bU .

Solution of E 117
R
See the MATLAB
script S_ResidualAnalysisTheory.

(3.166)

E 118 Time series factors: analysis of residuals III (see E 116)


Consider the same setup than in E 116. Assume now that one of the factor is non-random, by setting the
respective volatility to zero in (3.154) and verify that:
bR B
b
b ZB
b0 +
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)

a E{R} B E{Z} .

(3.170)

where the OLS loadings are:

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
b ZB
b0 +
bU .

(3.171)

b U diagonal. See Meucci


Note. Notice that under no circumstance is the residual covariance matrix
(2010e).
Solution of E 119
R
See the MATLAB
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):
2
Rw
{Y, X} 1

tr(Cov {w(Y X)})


.
tr(Cov {WX})

(3.173)

Consider now a linear factor model:


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:
G = (B0 B)1 B0 ,

(3.176)

where w0 w. Then r-square provided by this solution reads:


2
Rw
=

see the solution in Meucci (2010e).

tr(Cov {WBF})
,
tr(Cov {WX})

(3.177)


CHAPTER 3. MODELING THE MARKET

85

E 121 Cross-section factors: unconstrained cross-section correlations and r-square


II (see E 120)
Consider the same setup than in E 120. Compute the factors F, the explained market Y and the residual
U. Is the market Y explained by the factors orthogonal to the residual U? Is the explained market Y
correlated with the residual U? Are the residual idiosyncratic?
Solution of E 121
With (3.176) the factors (3.175) read:
F (B0 B)1 B0 X ,

(3.178)

Y PX ,

(3.179)

P B(B0 B)1 B0

(3.180)

and the model-recovered market is:

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)

P I B(B0 B)1 B0 ,

(3.182)

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).


E 122 Cross-section factors: unconstrained cross-section industry factors


Consider the n = 1, . . . , N 500 stocks in the S&P 500 and the k = 1, . . . , K 10 industry indices.
We intend to build a factor model:
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 randomness of the risk drivers and that is imposed exogenously, and U (U1 , . . . , UN )0 are defined as the
R
N residuals that make (3.148) an identity. Write a MATLAB
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:

fX

T
1 X (Xt )

,
T t=1

(3.184)

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):
2
G argmax Rw
{BGX, X} ,

(3.185)

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.
Note. See Meucci (2010e).
Solution of E 122
R
See the MATLAB
script S_CrossSectionIndustries.

E 123 Cross-section factors: generalized cross-section industry factors (see E 122)


R
script in which you:
Consider the same setup than in E 122. Write a MATLAB
Compute similarly to (3.185) the optimal coefficients G that give the cross-sectional industry
factors the highest generalized multivariate distributional r-square defined in Meucci (2010e), but,
unlike in E 122 add a set of constraints C:

2
G argmax Rw
{BGX, X} .

(3.186)

BC

In this expression, assume that the constraints C are that the factors F GX be uncorrelated with
the overall market:
C : G Cov {X} m 0 ,

(3.187)

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
R
See the MATLAB
script S_CrossSectionConstrainedIndustries.

CHAPTER 3. MODELING THE MARKET

87

E 124 Cross-section factors: comparison cross-section with time-series industry


factors (see E 114 and E 122)
Consider the same setups than in E 114 and E 122. Verify that the time series factors are highly correlated
with their cross-sectional counterparts.
Note. See Meucci (2010e).
Solution of E 124
R
See the MATLAB
script S_TimeSeriesVsCrossSectionIndustries.

E 125 Correlation factors-residual: normal example


Consider an N -dimensional normal market:
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
R
script in which you:
that make (3.189) hold. Write a MATLAB
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)

Hint. See Meucci (2010e).


Solution of E 125
R
See the MATLAB
script S_FactorResidualCorrelation.

E 126 Factors on demand: horizon effect (see E 116)


Consider as in E 116 a market of N stocks, where each stock n = 1, . . . , N trades at time t at the price
Pt,n . Consider as interpretation factors the linear returns on a set of K indices, such as GICS sectors,
where each index k = 1, . . . , K quotes at time t at the price St,k . As in Black-Scholes, assume that
stocks and indices follow a geometric Brownian motion, i.e.:


X
F

 
 
X
X
N
,
F
0XF

XF
F


,

(3.191)

where:

PT +,n
Xn ln
PT,n


ST +,k
Fk ln
.
ST,k


(3.192)
(3.193)

In particular, assume that the compounded returns are generated by the linear model:
X X + DF +  ,

(3.194)

where D is a constant matrix of loadings:




F



N

0
0

 
F
,
0

0



,

(3.195)

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)

in terms of the explanatory factors:

by means of a linear model:

The specification (3.198) is the interpretation side of the model, i.e. the model that would be used for
R
portfolio management applications, such as hedging or style analysis. Write a MATLAB
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)

RP
(t)
RS

 
 
2
X
X
LogN t
,t
F
X,F X F

X,F X F
F2


1.

(3.199)

We recall from (2.219, AM 2005)-(2.220, AM 2005) in that in general if:


Y LogN(, ) .
then:

(3.200)

CHAPTER 3. MODELING THE MARKET

89

E {Y} = e+ 2 diag() .
1

E {YY0 } = (e+ 2 diag() (e+ 2 diag() )0 ) e .

(3.201)

Also:
Cov {Y} = E {YY0 } E {Y} E {Y0 } .

(3.202)

From (3.127, AM 2005) the beta in (3.198) simplifies as:


n
o
(t)
(t)
Cov RP , RS
n
o .

(t)
Var RS

(3.203)

Therefore:
2

(eeX t+eX t/2+eF t+eF t/2 )(eeX,F eX eF t 1)


=
.
2
2
e2eF t+eF t (eeF t 1)

(3.204)

R
Finally, U is not idiosyncratic, and the longer the horizon, the more pronounced this effect. See MATLAB
script S_HorizonEffect for the implementation.


E 127 Factors on demand: no-Greek hedging (see E 143)


R
script in which you:
Consider the same market of call options than in E 143. Write a MATLAB
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 underlying and the residuals from a vector autoregression of order one in the log-changes in the implied
volatilities surface t :

ln St+ ln St
ln t+ ln t


N( , ) ;

(3.205)

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 BlackScholes 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):
O S Crt ,

(3.207)

where O is the option price; S is the underlying value; r is the risk-free rate; is the "delta":

O
,
S

(3.208)

and C is the cash amount:


C O S .

(3.209)

C
S
O
rt + S
,
O
O
O S

(3.210)

RO a + bR ,

(3.211)

C
rt,
O

(3.212)

Then:

or:

where:

S.
O

R
See the MATLAB
script S_HedgeOptions for the implementation.

E 128 Factors on demand: selection heuristics


Consider the linear return R from the current date to the investment horizon of a portfolio and a pool of
N generic risk factors {Zn }n=1,...,N , such as the returns of hedging instruments for hedging purposes or
the returns of style indices for style analysis. As prescribed by the Factors on Demand approach, we want
to express the portfolio return in a dominant-plus-residual way as a linear combination of only the best
K out of the N factors
R=

dk Zk + ,

(3.213)

kCK

where CK is a subset of {1, . . . , N } of cardinality K. Define the optimal exposures d in (3.213) to


maximize the r-square (3.116, AM 2005). Generate arbitrarily the parameters of the joint distribution
fR,Z of the portfolio return and the factors necessary to maximize the r-square of the fit and write a
R
MATLAB
script that compares three approaches:
A naive approach that ranks the r-square provided by each single factor and collects the K with the
most explanatory power;

CHAPTER 3. MODELING THE MARKET

91

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.
Note. See Meucci (2010c).
Solution of E 128
R
See the MATLAB
script S_SelectionHeuristics.

E 129 Spectral basis in the continuum (www.3.6) **


Show that the generic eigenfunction of a Toepliz covariance matrix must be an oscillating function with
frequency , modulo a multiplicative factor, and determine the explicit form of the eigenvalues.
Hint. In order to better capture the analogies between the continuum and the discrete case, we advise the
reader to refer to Appendix B of (Meucci, 2005) and in particular to the (rationale behind) Tables B.4,
B.11 and B.20.
Solution of E 129
First of all, we consider a generic Toeplitz operator S defined on L2 (R), i.e. an operator whose kernel
representation S(x, y) vanishes fast enough at infinity and satisfies:
S(x + z, y) = S(x, y z) .

(3.214)

Suppose that the operator admits a one-dimensional eigenvalue/eigenfunction pair, i.e. there exist a number 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)

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
e() (x + dx) =

S(x + dx, y)e() (y)dy

Z
=

S(x, y dx)e() (y)dy

(3.217)

Z
=

[S(x, y) y S(x, y)dx] e() (y)dy .

On the other hand from another Taylor expansion we obtain:




de()
e() (x + dx) = e() (x) +
dx .
dx

(3.218)

Therefore, integrating by parts and using the assumption that the matrix S vanishes at infinity, we obtain
the following identity:

de()
=
dx

(y S(x, y))e() (y)dy

Z
h
i
()
y S(x, y)e (y) dy + S(x, y)y e() (y)dy

=
Z R
=
S(x, y)y e() (y)dy ,

(3.219)

or, in terms of the (one-dimensional) derivative operator (B.25, AM 2005):


h
i
h
i
S De() = De() ,

(3.220)

Therefore De() is an eigenvector relative to the same eigenvalue as e() .


Now assume that the Toeplitz operator S is symmetric and positive. Similarly to (A.51, AM 2005) the
operator is symmetric if its kernel is symmetric across the diagonal, i.e.:
S(x, y) = S(y, x) .

(3.221)

Similarly to (A.52, AM 2005) the operator is positive if for any function v in its domain the following is
true:
Z

hv, S [v]i

S(x, y)v(y)dydx 0 .

v(x)
R

(3.222)

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)

where we chose a slightly more convenient normalization constant. Consider the operator E represented
by the following kernel:
E(y, ) e() (y) .

(3.224)

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
()
kEgk = ( e (x)g()d)( e() (x)g()d)dx
R
ZR Z R Z
()
=
( e (x)e() (x)dx)g()g()dd
R R R
Z Z
= 2
() ()g()g()dd
R R
Z
2
= 2 g()g()d = 2 kgk .
2

(3.225)

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) ,
dx

(3.226)

for some constant g that might depend on . The general solution to this equation is:
e() (x) = A eg x .

(3.227)

To determine this constant, we compare the normalization condition (3.223) with (B.41, AM 2005) obtaining:
e() (x) = eix .

(3.228)

To compute the eigenvalues of S we substitute (3.228) in (3.216) and we re-write the spectral equation:

ix

Z
=

S(x, x + z)e

i(x+z)

dz = e

ix

S(x, x + z)eiz dz .

(3.229)

Now recall that S is Toeplitz and thus it is fully determined by its cross-diagonal section:
S(x, x + z) = S(0, z) h(z) ,

(3.230)

where h is symmetric around the origin. Therefore we only need to evaluate (3.229) at x = 0, which
yields:
Z
=

h(z)eiz dz .

(3.231)

In other words, the eigenvalues as a function of the frequency are the Fourier transform of the crossdiagonal section of the kernel representation (3.230) of the operator:
= F[h]() .

(3.232)

In particular, if:
h(z) 2 e|z| ,

(3.233)

then:

Z
e

|z|

cos(z)dz + i

= 2

e|z| sin(z)dz

R
+

ez cos(z)dz + 0

(3.234)

2 2
.
2 + 2


E 130 Eigenvectors for Toeplitz structure


R
script that generates a N N Toeplitz matrix with structure as in (3.209, AM 2005),
Write a MATLAB
(3.214, AM 2005) and (3.222, AM 2005), i.e.:

Sj,j+k r|k| ,

(3.235)

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
R
See the MATLAB
script S_Toeplitz.

E 131 Numerical market projection *


Show how to perform the operations (3.65, AM 2005) by means of the fast Fourier transform in the
standard case where analytical results are not available. More precisely, describe the following steps:
Approximating the pdf;
Approximating the characteristic function;
The discrete Fourier transform.
Hint. The idea draws on Albanese et al. (2004), the solution relies heavily on Xi Chens contribution.
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:

fX (x)

N
X

fn 1n (x) ,

(3.236)

n=1

where bins 1 , . . . , N are defined as follows. First of all, we define the bins width:

2a
,
N

(3.237)

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 :

n


h
h
, n +
.
2
2

(3.239)


 
h
h
a ,a .
2
2

(3.240)

For n = N we define the interval as follows:



N

a, a +

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:
fn

1
h

Z
f (x)dx .

(3.241)

We collect the discretized pdf values fn into a vector fX .


Approximating the characteristic function:
We need to compute the characteristic function:
Z
X ()

eix fX (x)dx .

(3.242)

Using (3.236) and:


1
h

Z
g(x)1n (x)dx g(a + nh) ,

(3.243)

we can approximate the characteristic function as follows:

X ()

N
X
n=1

N
X
n=1

eix 1n (x)dx

fn
R

i(a+nh)

fn he

N
X
n=1

(3.244)
2i
N

fn he

a N
( 2

n)

In particular, we can evaluate the approximate characteristic function at the points:

,
a

r (r 1)

(3.245)

obtaining:

X (r )

N
X

fn he

N
2i
N (r1)(n 2

fn he

2i
N (r1)n

n=1

N
X

ei(r1)

n=1
i(r1)

=e

2i
N (r1)

he

N
X

(3.246)
fn e

2i
N (r1)n

2i
N (r1)

n=1
2

= ei(r1)(1 N ) h

N
X

fn e

2i
N (r1)(n1)

n=1

Finally, since N is supposed to be very large we can finally write:

X (r ) ei(r1) h

N
X

fn e

2i
N (r1)(n1)

(3.247)

n=1

The discrete Fourier transform


Consider now the discrete Fourier transform (DFT), an invertible matrix operation f 7 p which is
defined component-wise as follows:

pr (f )

N
X

fn e

2i
N (r1)(n1)

(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:

fn (p)

N
2i
1 X
pr e N (r1)(n1) .
N r=1

(3.249)

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 :
X (r ) ei(r1) hpr (fX ) .

(3.250)

Now consider the random variable:


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:
Y (r ) ei(r1)T hT (pr (fX ))T .

(3.252)

On the other hand, from (3.250), the relation between the cf Y and the discrete pdf fY is:
Y (r ) ei(r1) h pr (fY ) ,

(3.253)

pr (fY ) ei(r1)(T 1) hT 1 (pr (fX ))T .

(3.254)

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).


E 132 Simulation of a jump-diffusion process


R
Write a MATLAB
script in which you simulate a Merton jump-diffusion process Xt at discrete times
with arbitrary parameters. What are the invariants in this process?

Hint. See Merton (1976).


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. However, these invariants are directly observable and their distribution can be estimated with the techniques
R
discussed in the course. See the MATLAB
script S_JumpDiffusionMerton.


E 133 Simulation of a Ornstein-Uhlenbeck process


R
script in which you simulate an Ornstein-Uhlenbeck process. Prove analytically/empirically
Write a MATLAB
that for small time intervals and/or low reversion parameters the Ornstein-Uhlenbeck process is a Brownian motion.
Solution of E 133
Consider the solution of the Ornstein-Uhlenbeck process:

XT + = m(1 e ) + e XT + T, ,

(3.255)



2
T, N 0, (1 e2 ) .
2

(3.256)

XT + XT + m + T, ,

(3.257)

where:

If 0 we can write:

where:
T, N(0, 2 ) ,
R
which is the standard arithmetic Brownian motion. See the MATLAB
script
for the implementation.

(3.258)
S_AutocorrelatedProcess

E 134 Simulation of a GARCH process


R
Write a MATLAB
script in which you simulate a GARCH(1,1) process with arbitrary parameters. What
are the invariants of this process?

Solution of E 134
The invariants are the shocks in the volatility, which also directly drive the randomness of the process. NoR
tice that these invariants are not directly measurable. See the MATLAB
script S_VolatilityClustering.


E 135 Equity market: quest for invariance


R
Write a MATLAB
script in which you:
Upload the daily time series of stock prices Pt in the database DB_Equities;
Define the following variables:

Pt
Pt1
Yt Pt Pt1

2
Pt
Zt
Pt1

Xt

(3.259)
(3.260)
(3.261)

Wt Pt+1 2Pt + Pt1 ;

(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 locationdispersion ellipsoid of a variable with its lagged value.
Solution of E 135
R
The Wt s are clearly not invariants. See the MATLAB
script S_EquitiesInvariants.

E 136 Equity market: multivariate GARCH process


R
script in which you:
Write a MATLAB
Upload the daily prices time series of a set of stocks from the database DB_Equities;
Define the k-period compounded return:

(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)

Xt

=+

p
U

Ht t .

(3.264)

In this expression S denotes the upper triangular Cholesky decomposition of the generic symmetric and positive matrix S, t are normal invariants:

CHAPTER 3. MODELING THE MARKET

99

t N(0, I) ,

(3.265)

and the scatter matrix Ht has the following dynamics:


Ht = C + a t1 + B Ht1 ,

(3.266)

where is the element-by-element Hadamard product and


(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 )

X0

T
X

(1)

Xt

= T +

t=1

T p
X
U
Ht  t .

(3.268)

t=1

We use Monte Carlo scenarios to represent this distribution, proceeding as follows.


First, we generate J independent scenarios for 1 from the multivariate distribution (3.265). For each
(1)
scenario we generate a return scenario for the first period return X1 according to (3.264), i.e.:
(1)

X1 = +

p
U

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
R
MATLAB
script S_ProjectNPriceMvGarch for the implementation.


E 137 Equity market: linear vs. compounded returns projection I


Assume that the compounded returns (3.11, AM 2005) of a given stock are market invariants, i.e. they
are i.i.d. across time. Consider an estimation interval of one week e 1/52 (time is measured in years).
Assume that the distribution of the returns is normal:

Ct,e N(0, 2 e) ,

(3.270)

where 2 0.4. Assume that the stock currently trades at the price PT 1. Fix a generic horizon .
R
Write a MATLAB
script in which you compute and plot the analytical pdf of the price PT + .
Solution of E 137
As in (3.74, AM 2005):
Ct, N(0, 2 ) .

(3.271)

Therefore, as in (3.87, AM 2005), (3.3.88, AM 2005) and (3.92, AM 2005).


PT + LogN(ln(PT ), 2 ) .

(3.272)

R
The pdf follows from (1.95, AM 2005). See the MATLAB
script S_LinVsLogReturn for the implementation.


E 138 Equity market: linear vs. compounded returns projection II


R
Write a MATLAB
script in which you:
Simulate the compounded return at the investment horizon and map these simulations into simulations of the price PT + at the generic horizon ;
Superimpose the rescaled histogram from the simulations of PT + to show that they coincide;
Compute analytically the distribution of the first-order Taylor approximation of the pricing function
around zero and superimpose this pdf to the above plots. Notice how the approximation is good for
short horizons and bad for long horizons.

Solution of E 138
The first order Taylor approximation reads:
PT + = PT eCT +, PT (1 + CT +, ) = PT + PT CT +, .

(3.273)

Therefore from (3.271) we obtain:


PT + N(PT , PT2 2 ) .

(3.274)

R
See the MATLAB
script S_EquityProjectionPricing for the implementation.

E 139 Fixed-income market: quest for invariance


R
script in which you:
Write a MATLAB
Upload the time series of realizations of the yield curve in DB_FixedIncome;
Check whether the changes in the yield curve for a given time to maturity are invariants using the
R
MATLAB
function PerformIidAnalysis;
Check whether the changes in the logarithm of the yield curve for a given time to maturity are
invariants using the same function.

Solution of E 139
Changes in the yield curve and changes in the logarithm of the yield curve are approximately invariants,
R
script
whereas the changes in the yield to maturity of a specific bond are not. See the MATLAB
S_FixedIncomeInvariants.


E 140 Fixed-income market: projection of normal invariants


Assume that the weekly changes in yield to maturity are fully codependent, i.e. co-monotonic. In other
words, assume that the copula of any pairs of weekly yield changes is (2.106, AM 2005). Also, assume
that they have the following marginal distribution:
()
Yt

()
Yt


N 0,

20 + 1.25
10, 000

2 !
,

(3.275)

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
R
curve, as defined in (3.30, AM 2005) is flat at 4%. Write a MATLAB
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 investment 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 +)

ZT +

(T + )

= 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):
Y () N(0, 2 ) ,

(3.279)

where:

20 + 1.25
10, 000

2
.

(3.280)

Therefore:
(T + )

X N(ln(ZT
which with (3.277) implies:

2
), ( )2
),

(3.281)

(T +)

ZT +

(T + )

LogN(ln(ZT

2
), ( )2
).

(3.282)

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 +)

LT +,

ZT +

(T +)

1.

(3.283)

ZT

Proceeding as above:
LT +, = eY 1 ,

(3.284)

where:
(T + )

Y ln(ZT

(T +)

) ln(ZT

) ( ) Y ( ) ,

(3.285)

and thus:
(T +)

(T + )

1 + LT +, LogN(ln(ZT

(T +)

) ln(ZT

2
), ( )2
),

(3.286)

(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.
R
script S_BondProjectionPricingNormal for the implementation.

See the MATLAB

E 141 Fixed-income market: projection of Student t invariants


Consider a fixed-income market, where the changes in yield-to-maturity, or rate changes, are the market
invariants. Assume that the weekly changes in yield for all maturities are fully codependent, i.e. comonotonic. In other words, assume that the copula of any pairs of weekly yield changes is (2.106, AM
2005). Assume that the marginal distributions of the weekly changes in yield for all maturities are:
e Y () St(, , 2 ) .

(3.287)

In this expression denotes the time to maturity (in years) and:

8,

0,


2


5
20 + 104 .
4

(3.288)

Consider bonds with current times to maturity 4, 5, 10, 52 and 520 weeks, and assume that the current
R
yield curve, as defined in (3.30, AM 2005) in is flat at 4% (measuring time in years). Write a MATLAB
script in which you:
R
Use the MATLAB
function ProjectionStudentT that takes as inputs the estimation parameters
of the t-distributed invariants and the horizon-to-estimation ratio /e
to compute the cdf of the
invariants at the investment horizon . You do not need to know how this function works. Make
sure you properly compute the necessary inputs (see hints below).

CHAPTER 3. MODELING THE MARKET

103

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)

Lt,

Zt

(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)
Y
)
52 12/1/2006
6
= e 52 0.041 0.99528 .

Z12/1/2006 = exp(

(3.290)

To summarize, in order to price the 10-week bond at the 4-week investment horizon we need the distribution 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
X2

(6/52)
Y11/15/2006

X3

(6/52)
Y11/22/2006

X4

(6/52)
Y12/1/2006

(3.291)

(6/52)
Y11/08/2006

(3.292)

(6/52)
Y11/15/2006

(3.293)

(6/52)
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)

Substituting this in (3.290) we obtain:


1/15/2007

(6/52)

Z12/1/2006 = e 52 (Y11/1/2006 +X1 +X2 +X3 +X4 )


12/15/2006

= Z11/1/2006 e6/52(X1 +X2 +X3 +X4 ) ,

(3.296)

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:
12/15/2006

(6/52)

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 e6/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

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)

4
L12/1/2006, 52

Z12/1/2006

(1/15/2007)

1.

(3.299)

Z11/1/2006

Solution of E 141
R
See the MATLAB
script S_BondProjectionPricingStudentT.

E 142 Derivatives market: quest for invariance


R
Write a MATLAB
script in which you:
Upload the time series of daily realizations of the implied volatility surface in DB_Derivatives;
Check whether the weekly changes in implied volatility for a given level of moneyness and time to
R
maturity are invariants using the MATLAB
function PerformIidAnalysis;
Check whether the weekly changes in the logarithm of the implied volatility for a given level of
moneyness and time to maturity are invariants using the same function;
Define the vector Zt as the juxtaposition of all the entries of the logarithm of the implied volatility
surface at time t;
Fit the implied volatility data to a multivariate autoregressive process of order one:

b t +b
b + BZ
Zt+1 a
t+1 ,

(3.300)

where time is measured in weeks;


R
Check whether the weekly residuals b
t are invariants using the MATLAB
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 e
t are invariants. See the
R
MATLAB
script S_DerivativesInvariants.


E 143 Derivatives market: projection of invariants


Consider a market of call options on the S&P 500, with current time to maturity of 100, 150, 200, 250,
and 300 days and strikes equal 850, 880, 910, 940, and 970 respectively. Assume that the investment
R
horizon is 8 weeks. Write a MATLAB
script in which you:

CHAPTER 3. MODELING THE MARKET

105

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 underlying and the residuals from a vector autoregression of order one in the log-changes in the implied
volatilities surface t :


ln St+ ln St
ln t+ ln t


N( , ) ;

(3.301)

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, assuming a constant risk-free rate at 4%;
Compute the joint distribution of the linear returns of the call options, as represented by the simulations: 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
R
See the MATLAB
script S_CallsProjectionPricing.

E 144 Statistical arbitrage: co-integration trading *


R
Write a MATLAB
file in which you:
Upload the database DB_SwapParRates of the daily series of a set of par swap rates;
Determine the (in-sample) decreasingly most co-integrated combination of the above par swap rates
using principal component analysis;
Fit an AR(1) process to these combinations and compute the unconditional (long term, equilibrium)
expectation and standard deviation;
Plot the 1-z-score bands around the long-term mean to generate signals to enter or exit a trade.

Hint. See Meucci (2009).


Solution of E 144
R
See the MATLAB
script S_StatArbSwaps.

Chapter 4

Estimating the distribution of the


market invariants
E 145 Smallest ellipsoid (www.4.1) *
Show that the sample mean and sample covariance represent the choices of location and scatter parameters, respectively, that give rise to the smallest ellipsoid among all those that pass through the cloud of
observations. Formally, prove that:
b N Cov)
d = argmin[Vol{E, }] ,
(E,

(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 argmin ln || ,
(b
, )

(4.2)

(,)C

where the constraints read:

C1 :

T
1X
(xt )0 (xt ) = 1
T t=1

C2 :

(4.3)

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 .
T t=1
The first order condition with respect to is:
106

(4.4)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

0N 1 =

T
L
2X
=
(xt ) ,

T t=1

107

(4.5)

b is the sample mean:


from which we see that the optimal

T
1X
b.
xt E
T t=1

(4.6)

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|
= A1 .
A

(4.7)

Therefore:

0N N =

T
X
L
= 1
(xt )(xt )0 ,

T t=1

(4.8)

b satisfies:
from which we see that the optimal

b =

T
X
(xt )(xt )0
T t=1

!1

1 d 1
Cov .

(4.9)

To compute the Lagrange multiplier we re-write the constraint (4.3) as follows:




1
N
b
d
1 = tr[Cov] = tr
IN =
,

from which = N .

(4.10)


E 146 Ordinary least squares estimator of the regression factor loadings (www.4.1)
b in (4.52, AM 2005) provides the best fit to
Show that the ordinary least squares (OLS) estimator B
the observations, in the sense that it minimizes the sum of the square distances between the original
b t:
observations ft and the recovered values Bf
X
2
b = argmin
B
kxt Bft k ,
(4.11)
B

where kk is the standard norm (A.6, AM 2005).


Solution of E 146
We simply write the first order conditions, which read:
0N K =

T
X

b t )f 0 .
(xt Bf
t

(4.12)

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
X
b = 1
b ) (xt
b )0 ,

wt (xt
T t=1

(4.13)

where wt is given by:



g 0 Mt2
wt 2
,
g (Mt2 )

(4.14)

and:
0

Mt2 (xt ) (xt ) ,

(4.15)

with 1 .
Hint.
Mt2
= 2 (xt )

Mt2
0
= (xt ) (xt ) .

(4.16)
(4.17)

Solution of E 147
b we have to maximize the likelihood function (4.66, AM 2005)
b and
To compute the ML estimators
over the following parameters set:
RN {symmetric, positive N N matrices} .

(4.18)

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:

ln (f (iT )) =

T
X

ln f (xt ) =

t=1

The first order conditions with respect to read:

T
X


T
ln || +
ln g Mt2 .
2
t=1

(4.19)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

0N 1

" T
#

T
T
X
X

g 0 Mt2 Mt2
X 
2
=
ln g Mt
=
=
wt (xt ) ,
t=1
g (Mt2 )
t=1
t=1

109

(4.20)

where we used (4.16). The solution to this equations is:


PT
wt xt
b = Pt=1
.

T
s=1 ws

(4.21)

The first order conditions with respect to reads:

0N N


T
T ln || X g 0 Mt2 Mt2
+
=
2
g (Mt2 )
t=1
T

(4.22)

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)

T
X
b
b 1 = 1
b ) (xt
b )0 .
wt (xt

T t=1

(4.24)

Thus the solution to (4.22) reads:

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 functional form of g. Compute the maximum likelihood (ML) estimators
b and
b2 of and 2 respectively.
Hint. Define:
Mt2 2 (xt )2 ,

(4.25)

and use:
Mt2
= 2 2 (xt )

Mt2
= (xt )2 .
2

(4.26)
(4.27)

Solution of E 148
To compute the ML estimators
b and
b2 we have to maximize the likelihood function as in (4.66, AM
2005), which after (4.74, AM 2005) reads:

(b
,
b ) argmax

T
X


ln

, 2 t=1

1
g
2

(xt )2
2


,

(4.28)

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:

ln(f (iT )) =

T

T 2 X 
ln g(Mt2 ) .
ln +
2
t=1

(4.29)

The first order conditions with respect to read:


" T
#
" T
#


X
X 
2
0=
[ln(f (iT ))] =
ln f (xt ) =
ln g(Mt )

t=1
t=1
=

T
X
g 0 (M 2 ) M 2
t

t=1

g(Mt2 )

T
X

(4.30)

wt 2 (xt ) ,

t=1

where we used (4.26) and we defined:


g 0 (Mt2 )
.
g(Mt2 )

(4.31)

PT
wt xt

b = Pt=1
.
T
s=1 ws

(4.32)

wt 2
The solution to this equations is:

The first order conditions with respect to 2 read


PT
t=1 ln f (xt )
ln(f (iT ))
0=
=
2
2
T
2
0
T ln( ) X g (Mt2 ) Mt2
=
+
2 2
g(Mt2 ) 2
t=1
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:

(4.33)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

b2

T
1
1X
=
wt (xt
b)2 .
c2 )
T t=1
(

This number is positive and thus the unconstrained optimization is correct.

111

(4.34)


E 149 Maximum likelihood estimator of explicit factors under conditional elliptical distribution (www.4.2)
Show that the maximum likelihood (ML) estimator of B and of the explicit factor model (4.86, AM
2005) under the assumption that the conditional distribution of the perturbations is elliptical:
Ut |ft El(0, , g) .

(4.35)

are given by the following set of joint implicit equations:

b =
B

" T
X

wt xt ft0

#" T
X

t=1

#1
wt ft ft0

(4.36)

t=1

T
X
b )(xt Bf
b )0 .
b = 1
wt (xt Bf

T t=1

(4.37)

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:
Xt |ft El (Bft , , g) .

(4.38)

b and ,
b we define 1 and we maximize
To compute the maximum likelihood (ML) estimators B
the log-likelihood function:

ln (f (iT ))

T
X


T
ln g Mt2 ,
ln || +
2
t=1

(4.39)

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
X
g 0 Mt2 M 2
t

t=1

T
X
t=1

g (Mt2 ) B
wt (xt Bft ) ft0 ,

(4.41)

where:

g 0 Mt2
wt 2
.
g (Mt2 )

(4.42)

The solution to (4.41) reads:

B=

" T
X

wt xt ft0

#" T
X

t=1

#1
wt ft ft0

(4.43)

t=1

The first order conditions with respect to reads:

0N N


T
T ln || X g 0 Mt2 Mt2
=
+
2
g (Mt2 )
t=1

(4.44)

1X
T
0
wt (xt ) (xt ) ,
= 1
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)

T
X
b
b 1 = 1
b ) (xt
b )0 .

wt (xt
T t=1

(4.46)

The solution to (4.22) reads:

This matrix is symmetric and positive definite, and thus the unconstrained optimization is correct.

E 150 Explicit factors: t-test of factor loadings


Consider two jointly normal invariants:


Xt
Ft


N

X
F

 
,

2
X
X F

X F
F2


.

(4.47)

Consider a conditional model of the kind (4.88, AM 2005):


Xt = + ft + Ut ,

(4.48)

Ut |ft N(0, 2 ) .

(4.49)

where:

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

113

What is the conditional model (4.48)-(4.49) ensuing from (4.47)? Consider the conditional model (4.48)b given the observations
(4.49) for the invariants. Compute the ML estimators of the factor loadings (b
, )
iT {x1 , f1 , . . . , xT , fT }.
Hint. Consider ft0 (1, ft ) and:
T
X
b XF 1
xt ft0 ,

T t=1

T
X
bF 1

ft f 0 .
T t=1 t

(4.50)

Solution of E 150
See (2.173, AM 2005) and/or (3.130, AM 2005)-(3.131, AM 2005) to derive:
X

X
F
F

(4.51)

X
F
2
2
X (1 2 ) .

(4.52)
(4.53)

Follow the proof of (4.126, AM 2005) to derive:


b =
b XF
b 1 .
(b
, )
F

(4.54)


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
b under the conditional model (4.48)-(4.49).
loadings (b
, )
Solution of E 151
Follow the proof of (4.129, AM 2005) to derive in terms of a (degenerate) matrix-valued normal distribution:


2
b N (, ), ,
b 1 .
(b
, )
F
T

(4.55)

From (2.180, AM 2005) we then obtain:




b
b


N


,

2 b 1

T F


.

(4.56)


E 152 Explicit factors: maximum likelihood estimator of the dispersion parameter (see E 150)
Consider the same setup than in E 150. Compute the distribution of the ML estimator
b2 of the dispersion
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:
T
b2 Ga(T 2, 2 ) .

(4.57)


E 153 Explicit factors: t-test of factor loadings (see E 150)


Consider the same setup than in E 150. Compute the distribution of the t-statistic for
b:
b
t

(b
)
T 2p
,

b2
b2

(4.58)

b
and the distribution of the t-statistic for :

b
t

(b )
T 2q
,

b2
b2

(4.59)

b 1 and
b2 is its south-east entry.
where
b2 is the north-west entry of
F
Solution of E 153
From (4.57), (1.106, AM 2005) and (1.109, AM 2005) it follows:

(T 2)

T
b2
T 2 2

2T 2 .

(4.60)

From (4.56) we obtain:


s

T
(b
) N(0, 1) ,

b2 2

(4.61)

b and
and similarly for . Furthermore, from E 155 we derive that (b
, )
b2 are independent. Using
(4.100), we obtain:

b
t

q
(b
)
T 2p
=

b2
b2

2 2 (b

T
b2
T 2 2

(4.62)

Then from (4.100) we derive:


Y1
d
b
t = q
St(T 2, 0, 1) .
ZT2 2

(4.63)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

115

E 154 Explicit factors: hypothesis testing (see E 150)


Consider the same setup than in E 150. You would like to ascertain whether it is possible that:
= 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
First, compute the distribution of (4.58) under (4.64). Then compute the realization e
t0 of (4.58). In the
notation (1.87, AM 2005) we obtain:


St
t0 e
t0 = F,0,1
(e
t0 )
P b


St
P b
t0 e
t0 = 1 F,0,1 (e
t0 ) .

(4.65)
(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

b
U1 X 1
..
.
b.
UT X T

(4.67)

b } reads:
The joint characteristic function of {U1 , . . . , UT ,
U1 ,...,UT ,b ( 1 , . . . , T , )
n PT
o
0
0
= E ei( t=1 t Ut + b )
n PT
o
PT
0
0 1 PT
1
= E ei[ t=1 t (Xt T s=1 Xs )+ ( T t=1 Xt )]
n PT
o
PT
0

1
= E ei( t=1 (t + T T s=1 s ) Xt ) .

(4.68)

From the independence of the invariants we can factor the characteristic function as follows:

T
Y
t=1

n
1

E ei(t + T T

PT

s=1 s ) Xt

T
Y
t=1

Xt

T
1X

t
s +
T s=1
T

!
.

(4.69)

Since Xt is normal, from (2.157, AM 2005) we have


0

Xt () = ei 2 .

(4.70)

Therefore:
= ei

PT

t=1

0 ( t T1

PT

t=1

PT

s=1

12 ( t T1

s + T
)

PT

s=1

s + T
) (t T1

PT

s=1

s + T
)

(4.71)
.

A few terms simplify:


!
T

1X
= 0
s +
t
T
T
s=1
t=1
!0
T
T
X
1X

t
s = 0 .
T
T
t=1
s=1

T
X

(4.72)

(4.73)

Therefore the joint characteristic function factors into the following product:
U1 ,...,UT ,b ( 1 , . . . , T , ) = ( 1 , . . . , T ) ( ) ,

(4.74)

where
( 1 , . . . , T ) e

21 ( t T1

( ) ei

1
2T

PT

s=1

s ) ( t T1

PT

s=1

s )

(4.75)
(4.76)

b are independent. In particular the sample covariance


This proves the variables {U1 , . . . , UT } and
matrix:
T
1X
b

Ut U0t ,
T t=1

b.
is independent of

(4.77)


E 156 Distribution of the sample mean (www.4.3) (see E 155)


Consider the same setup than in E 155. Show that the sample mean (4.100, AM 2005) has the following
distribution:



b N ,

.
T

(4.78)

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

Xt () E{eiXt } = ei 2 .
b
Now, using the definition of the sample mean
1 PT

E{ei T

t=1

Xt

} = E{ei

Xt
t=1 T

PT

PT

t=1

(4.79)

Xt , we have:

} = eiT

1
0
0
T 2 T T2

= ei 2

(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 .


E 157 Testing of the sample mean


Consider a time series of independent and identically distributed normal random variables:
Xt N(, 2 ), t = 1, . . . , T .

(4.81)

T
1X

b
Xt .
T t=1

(4.82)

Consider the sample mean:

Compute the distribution of


b and determine what is the probability that
b exceed a given value
e.
Solution of E 157
We can write:

X1

..
. N

XT

.. ,

. 0
..

0
..
.

(4.83)

X N(, ) a + BX N(a + B, BB0 ) ,

(4.84)

From (2.163, AM 2005):

for any conformable vector and matrix a and B respectively, it follows:




2

b N ,
.
T

(4.85)

Regarding P {b
>
e} we have:
(
P {b
>
e} = 1 P {b

e} = 1 P

e
p
p
2 /T
2 /T

)
.

(4.86)

From (4.84) and (4.85) it follows:

b
p
N(0, 1) ,
2 /T

(4.87)

therefore:

P {b
>
e} = 1

e
p
2 /T

!
,

(4.88)

where denotes the cdf of the standard normal distribution.

E 158 p-value of the sample mean


Consider a normal invariant:
Xt N(, 2 ) ,

(4.89)

in a time series of length T . Consider the ML estimator


b of the location parameter . Suppose that you
observe a value
e for the estimator. Assume that you believe that:
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 ,
.
T

(4.92)

Therefore in the notation of (1.68, AM 2005) we obtain:


p P {b

e} = FN0 ,2 /T (e
)

(4.93)

or
p P {b

e} = 1 P {b

e} = 1 FN0 ,2 /T (e
) .
0

(4.94)


CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

119

E 159 t-test of the sample mean


Consider a normal invariant:
Xt N(, 2 ) ,

(4.95)

in a time series of length T . Consider the ML estimators


b and
b2 of the location and scatter parameters
2
and respectively. The t-statistic for
b is defined as:

b 0
b
.
t0 p

b2 /(T 1)

(4.96)

Compute the distribution of b


t . You would like to ascertain whether it is possible that
= 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 Y2 and Z are independent and such that
Y2 N(0, 2 )

(4.98)

Z2

(4.99)

then:
Y 2
X,2 p St(, 0, 2 ) .
Z2

(4.100)

Solution of E 159
From (4.103, AM 2005), (1.106, AM 2005) and (1.109, AM 2005) it follows:

(T 1)

T
b2
T 1 2

2T 1 .

(4.101)

From (4.92) we obtain:


r

T
(b
) N(0, 1) .
2

(4.102)

Furthermore, from E 155 we derive that


b and
b2 are independent. From (4.100), we obtain:

b
b
t p
=
2

b /(T 1)
Therefore:

1
T
(b
) q
2
T
b2

(T 1) 2

=q

Y1
ZT2 1

(4.103)

b
t St(T 1, 0, 1) .

(4.104)

Finally, to test = 0 , first, compute the distribution of (4.96) under (4.97). Then compute the realization
e
t0 of (4.96). In the notation (1.87, AM 2005) we obtain:


P b
t0 e
t0 = FTSt1,0,1 (e
t0 )


St
P b
t0 e
t0 = 1 FT 1,0,1 (e
t0 ) .

(4.105)
(4.106)

Therefore, if t is so small or so large that either probabilities are too small, then (4.97) is very unlikely.


E 160 Distribution of the sample covariance (www.4.3) (see E 155)


Consider the same setup than in E 155. Show that the sample covariance (4.101, AM 2005) has the
following distribution:
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
Yt ,
T t=1

(4.108)

we easily verify that:


b=
b b,

b
where

1
T

PT

t=1

(4.109)

Xt and thus:
T
X
bY 1
b )(Yt
b )0

(Yt
T t=1

T
1X
(Xt + b (b
+ b))(Xt + b (b
+ b))0
T t=1

1
T

T
X

(4.110)

b )(Xt
b )0
(Xt

t=1

bX .

Therefore we can assume here that 0. Now consider:

b + T
b
b0 =
W T

T
X
t=1

Xt X0t ,

(4.111)

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 indepenb and
b (see E 155) the characteristic function of W must be the product of the characteristic
dence of
b and the characteristic function of T
b
b 0 . Therefore:
function of T
T
b () =

W ()
.
T b b 0 ()

(4.112)

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)

and thus from (2.226, AM 2005) its characteristic function reads:

W () =

1
T /2

|I 2i|

(4.114)

b
b 0 reads:
On the other hand, the characteristic function of T
n
o
0
T b b 0 () E ei tr([T b b ])
n
o
0
= E ei tr(b b [T ])
= b b 0 (T ) =

(4.115)
1

|I 2i|

1/2

Substituting (4.114) and (4.115) in (4.112) we obtain:

T
b () =

1
(T 1)/2

|I 2i|

(4.116)

which from (2.226, AM 2005) shows that:


b W(T 1, ) .
T

(4.117)


E 161 Estimation error of the sample mean (www.4.3, see E 155)


b
Consider
the same setup than in E 155. Determine the estimation error of the sample mean
PT
1
X
.
t
t=1
T
Solution of E 161
From (4.102, AM 2005) we have:



b N 0,

,
T

(4.118)

and thus from (2.222, AM 2005) and (2.223, AM 2005):





(b
)(b
)0 W 1,
.
T

(4.119)

Therefore from (2.227, AM 2005) the estimation error reads:


Err {b
, } E {(b
)0 (b
)}
= tr(E {(b
)(b
)0 })
1
= tr() .
T

(4.120)

E 162 Estimation error of the sample covariance (www.4.3) (see E 155) *


Consider the same setup than in E 155. Show that the estimation error (4.23, AM 2005) relative to the
loss (4.118, AM 2005) reads:
b )
Err2, (,

1
=
T

1
tr( ) + 1
T
2

[tr()]


.

(4.121)

Solution of E 162
From (4.103, AM 2005) we have:
n o
n
o
b = 1 E T
b = T 1 = 1 .
E
T
T
T

(4.122)

Therefore the bias reads:


n n o
o

b ) tr (E
b )2 = 1 tr 2 .
Bias2 (,
2
T

(4.123)

As for the error, from its definition we obtain:


n h
io
b ) E tr (
b )2
Err2, (,
(
i
i h
Xh
b
b

=E

m,n

mn

nm

i2 
X h
b
=
E
mn

m,n

n
o
b mn mn )2
E (

Xh

m,n

b mn , mn )
Err2, (

m,n

m,n

i
b mn , mn ) + Inef2 (
b mn ) ,
Bias2, (
,

(4.124)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

123

using (4.106, AM 2005) and (4.107, AM 2005) this becomes:


b ) =
Err2, (,


X 1
T 1
T 1 2
2

mm nn
mn
T 2 mn
T2
T2
m,n

1X 2
T 1X
mn +
mm nn
T m,n
T 2 m,n




1
1
2
=
tr(2 ) + 1
[tr()]
.
T
T
=

(4.125)

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 distributed:
Xt |ft i.i.d. N(Bft , ) .

(4.126)

Show that estimator of the factor loading (4.126, AM 2005) and covariance matrix (4.127, AM 2005)
have the following distributions:


b 1
b N B, ,
B
F
T
b W(T K, ) ,
T

(4.127)
(4.128)

b and
b are independent to each other.
and that B
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 XF
b 1 ,
B
F

(4.129)

where:
T
1X
b
XF
xt ft0 ,
T t=1

T
1X 0
b
F
ft f ,
T t=1 t

(4.130)

and the sample covariance:


T
X
b 1
b t )(xt Bf
b t )0 .

(xt Bf
T t=1

(4.131)

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

f (iT ) = 1 || 2 e 2

0
t=1 (xt Bft ) (xt Bft )

PT

= 1 || 2 e 2 tr{

PT

t=1 (xt Bft )(xt Bft )

}.

(4.132)

The term in curly brackets can be written as:


{ } = A ,

(4.133)

where:

T
X
(xt Bft )(xt Bft )0
t=1

T h
ih
i0
X
b t ) + (Bf
b t Bft ) (xt Bf
b t ) + (Bf
b t Bft )
(xt Bf
t=1

T
T
X
X
0
b
b
b
(xt Bft )(xt Bft ) + (B B)
ft ft
=
t=1

!
b B)0
(B

(4.134)

t=1

T
T
X
X
b t )(Bf
b t Bft )0 +
b t Bft )(xt Bf
b t )0
+
(xt Bf
(Bf
t=1

t=1

b + (B
b B)T
b F (B
b B)0 + 0 + 0 .
= T
In this expression the last terms vanish since:
T
T
T
X
X
X
b t )(Bf
b t Bft )0 =
b0 +
b t f 0 B0
Bf
(xt Bf
xt ft0 B
t
t=1

t=1

t=1

T
X

xt ft0 B0

t=1

T
X

b tf 0B
b0
Bf
t

t=1

b XF B
b 0 + BT
b
b F B0 T
b XF B0 T B
b
bFB
b0
= T

(4.135)

b XF
b 1
b0 + T
b XF B0
= T
F
XF
b XF B0 T
b XF
b 1
b0
T
F
XF
= 0.
Substituting (4.134) in the curly brackets (4.133) in (4.132) we obtain:
T

f (iT ) = 1 || 2 e 2 tr{T [+(BB)F (BB) ]} .


We can factor the above expression as follows:

(4.136)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

125

b T )f
b (B,
b T )
b ,
f (iT ) = f (iT |B,

(4.137)

1
T KN
2
b T )
b 2
b
f (iT |B,
,

(4.138)

b T )
b = f (B)f
b (T )
b ,
f (B,

(4.139)

N2
K
0
b
b F (BB)
b

}
b 3 |T | 2
b F e 12 tr{(T )(BB)
f (B)

(4.140)

where:

b T )
b factors as follows:
and f (B,

where:

and:

b 4 ||
f (T )

T K
2

1

T KN
1
2
b
b
e 2 tr(T ) .
T

(4.141)

Expression (4.140) is of the form (2.182, AM 2005). Therefore the OLS factor loadings have a matrixvalued normal distribution:


b N B, (T )1 ,
b 1 .
B
F

(4.142)



b 1
b
B N B, , F
.
T

(4.143)

Since 1 this means:

Also, expression (4.141) is the pdf (2.224, AM 2005) of a Wishart distribution, and thus:
b W(T K, ) .
T
b and thus ,
b is independent of B.
b
Finally, from the factorization (4.139) we see that T ,

(4.144)


E 164 Steins lemma (www.4.5) *


Consider an N -dimensional normal variable:
X N(, IN ) ,

(4.145)

where IN is the N -dimensional identity matrix. Consider a smooth function g of N variables. Prove
Steins lemma in this context, that is:


E {g(X)(Xn n )} = E

g(X)
xn


.

(4.146)

Hint. Use:
Z
G(x)

g(x1 , . . . , x, . . . , xN )

(4.147)

RN 1

(2)

N 1
2

e 2

2
k6=n (xk k )

dx1 dxn1 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

(2) 2 e 2 k (xk k ) dx
(xn n )2
Z +
2
e
dxn ,
=
(xn n )G(xn )
2

(4.148)

where we defined G as follows:


Z
G(x)

g(x1 , . . . , x, . . . , xN )

(4.149)

RN 1

(2)

N 1
2

e 2

2
k6=n (xk k )

dx1 dxn1 dxn+1 dxN .

Notice that:
Z
dG(x)
RN 1

P
2
N 1
1
g(x)
(2) 2 e 2 k6=n (xk k ) dx1 dxn1 dxn+1 dxN .
xn

(4.150)

Replacing the variables in the integral (4.148) as follows:


u G(xn )
2
n)
(xn
2

v e

(4.151)
,

(4.152)

we get:
1
E {g(X)(Xn n )} =
2

1
udv =
2

uv|


vdu .

(4.153)

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 +
(xn n )2
1
2

E {g(X)(Xn n )} =
e
2
Z
P
2
N 1
1
g(x)

(2) 2 e 2 k6=n (xk k ) dx1 dxn1 dxn+1 dxN


x
N
1
n
Z R
P
2
1
N
g(x)
=
(2) 2 e 2 k (xk k ) dx
x
N
n
R


g(X)
.
= E
xn
(4.154)


E 165 Shrinkage estimator of location (www.4.5) *


Consider a set of T i.i.d. multivariate normal random variables Xt N(, ), where the dimension of
each random variable is N > 2. Prove that the shrinkage estimator (4.138, AM 2005)-(4.139, AM 2005)
performs better than the sample mean, i.e. it satisfies (4.137, AM 2005).
Solution of E 165
Rewrite estimator (4.138, AM 2005)-(4.139, AM 2005) as:


1

a
(b
b)0 (b
b)


b+

a
b,
(b
b)0 (b
b)

(4.155)

b is the sample mean:


where


1X

,
Xt N ,
T t
T

(4.156)

where b is any constant vector and where a is any scalar such that:
0<a<

2
(tr() 21 ) ,
T

(4.157)

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)
a(b
b)
b
b
=E

(b
b)0 (b
b)
(b
b)0 (b
b)




(b
b)0 (b
)
1
2

2a
E
.
= [Err(b
, )] + a2 E
(b
b)0 (b
b)
(b
b)0 (b
b)

(4.158)

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):
EE0 ,

(4.159)

and define the following vector of independent normal variables:


Y

b N(, I) ,
T 2 E0

(4.160)

together with:

T 2 E0 ,

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
T

E
(b

b)
T

E
(b

(b
b) (b
)
= h
i0 h
i
1
1
(b
b)0 (b
b)
T 2 E0 (b
b) T 2 E0 (b
b)
0

=
=

(Y c)0 (Y )
(Y c)0 (Y c)
N
X

(4.162)

gj (Y)(Yj j ) ,

j=1

where:
gj (y)

(yj cj )j
.
(y c)0 (y c)

(4.163)

Applying the rules of calculus we compute:


gj (y)
d
j
1
+ (yj cj )j
=
0
0
yj
(y c) (y c)
dyj (y c) (y c)
=

(y

j
c)0 (y

c)

22j (yj cj )2

(4.164)

[(y c)0 (y c)]


0
j (y c) (y c) 22j (yj cj )2
=
.
2
[(y c)0 (y c)]

Therefore, using Steins lemma (see E 164), we obtain for the last expectation in (4.158):

E

(b
b)0 (b
)
(b
b)0 (b
b)


=

N
X

E {gj (Y)(Yj j )}

j=1

N
X

gj (Y)
yj

j (Y c)0 (Y c) 22j (Yj cj )2

j=1

N
X

j=1

(
=E


(4.165)

[(Y c)0 (Y c)]

tr()
(Y c)0 (Y c)
2
2
0
(Y c) (Y c)
[(Y c)0 (Y c)]

)
.

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

129

Since from the definitions (4.160)-(4.161) we obtain:


Yc=

T 2 E0 (b
b) ,

(4.166)

we can simplify (4.165) as follows:



E

(b
b)0 (b
)
(b
b)0 (b
b)

b)
tr()
1
1 (b
b)E 2 2 E0 (b
=E

2
0
T (b
b) (b
b) T
[(b
b)0 (b
b)]



2
N
2 (b
b)(b
b)
=E

,
(b
b)0 (b
b)
T
T (b
b)0 (b
b)

)
(4.167)

where:

tr()
N

(4.168)

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)
1 .
0
(b
b) (b
b)

(4.169)

Therefore, substituting (4.167) in (4.158), using (4.169) and recalling (4.157) we obtain the following
relation for the error:
2

N
4 (b
b)(b
b)
a2 +
T
T (b
b)0 (b
b)
)
(
a(a T2 (N 21 ))
2
[Err(b
, )] + E
(b
b)0 (b
b)
2

[Err(, )] = [Err(b
, )] + E

a
(b
b)0 (b
b)



(4.170)

[Err(b
, )] .
In particular, the lowest upper bound is reached at:
a

2
(N 21 ) .
T

(4.171)


E 166 Shrinkage estimator of location


Fix N 5 and generate a N -dimensional location vector and a N N scatter matrix . Consider a
normal random variable:
X N(, ) .

(4.172)

R
Write a MATLAB
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
R
See the MATLAB
script S_ShrinkageEstimators.

E 167 Singular covariance matrix (www.4.6)


The sample covariance is inefficient because the estimation process tends to scatter the sample eigenvalues
away from the mean value of the true unknown eigenvalues. Show that in the extreme case where the
number of observations T is lower than the number of invariants N , the some eigenvalues become null
and thus the covariance matrix becomes singular.
Solution of E 167
b is its rank. Thus we want to prove:
The number of non-zero eigenvalues of the sample covariance
b <T.
rank()

(4.173)

We re-write the definition of the sample covariance as follows:


b = 1 X0

T T N

1
IT 1T 10T
T


XT N ,

(4.174)

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
1
0
0
b
rank() min rank IT 1T 1T , rank(XT N ) rank IT 1T 1T = T 1 < T .
T
T
(4.175)
b < N , and therefore N T eigenvalues are null.
If T N , we have that rank()

E 168 Sample covariance and eigenvalue dispersion


R
Fix N 50, 0N , IN . Write a MATLAB
script in which you reproduce the surface in Figure
4.15 of Meucci (2005, p.207).

Note. You do not need to superimpose the true spectrum as in the figure.
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
b) Compute the sample covariance ;
b and store the sample eigenvalues (i.e. the sample spectrum);
c) Perform the PC decomposition of
d) Perform a)-c) a large enough number of times ( 100 times);
e) Compute the average sample spectrum.
Solution of E 168
R
See the MATLAB
script S_EigenvalueDispersion.

E 169 Shrinkage estimator of dispersion (www.4.6)


Show that the shrinkage estimator (4.160, AM 2005) is better conditioned than the sample covariance.
Solution of E 169
We denote as n (S) the n-th eigenvalue of the symmetric and positive matrix S. We want to prove:

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

 S
b
N
b
N ()
 S >
.
b
b
1 ()
1

131

(4.176)

First we notice that the highest eigenvalue of the shrinkage estimator satisfies:
 S
b
b .
1
< 1 ()

(4.177)

To show this, we first prove that for arbitrary positive symmetric matrices A and B and positive number
and we have:
1 (A + B) 1 (A) + 1 (B) .

(4.178)

This is true because from (A.68, AM 2005) the largest eigenvalue of a matrix A satisfies:
1 (A + B) = max
v0 (A + B)v
0
v v=1

max
v0 Av + max
v0 Bv
0
0
v v=1

v v=1

(4.179)

= 1 (A) + 1 (B) .
Therefore, from (4.160, AM 2005):
 S


b
b + C
b
1
1 (1 )
b + 1 (C)
b
(1 )1 ()
h
i
b 1 ()
b 1 (C)
b < 1 ()
b ,
= 1 ()

(4.180)

where the last inequality follows from:


N
X
b .
b > 1 (C)
b 1
n ()
1 ()
N n=1

(4.181)

Similarly for the lowest eigenvalue we have:


 S
b
b ,
N
> N ()

(4.182)

which follows from the above argument and the reverse identities (A.69, AM 2005) and
N
X
b < N (C)
b 1
b .
N ()
n ()
N n=1

(4.183)


E 170 Shrinkage estimator of scatter


R
Write a MATLAB
function which computes the shrinkage estimator of the scatter (4.160, AM 2005).

Solution of E 170
R
See the MATLAB
script S_ShrinkageEstimators.

E 171 Maximum likelihood estimator as implicit functional (www.4.7)


b of the parameter of the distribution fX of the market invariants,
Given the maximum likelihood (ML)
prove (4.194, AM 2005)-(4.195, AM 2005).
Solution of E 171
e [fi ], which is an implicit functional of the empirical pdf fi defined by the
Consider the estimator
T
T
following equation:
Z
0=

e [h])h(x)dx ,
(x,

(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
h
i
d
e [h ]) (1 )fX (x) +  (y) (x) dx
(x,

0=
d =0 RN


Z
Z
h
i
e [h ]
(x, )
d
e [fX ]) fX (x) + (y) (x) dx
=
f
(x)dx
+
(x,


X
(4.185)
[f
d
e X]
RN
RN
=0


Z
e [h ]
(x, )
d
e [fX ]) .
=
f
(x)dx
+ (y,

[f
d
e X]
RN
=0

On the other hand, from the definition (4.185, AM 2005) of the influence function we have:


e [h ]
1 e
d
b
e
IF(y, fX , ) lim
[h ] [h0 ] =

0 
d

(4.186)

=0

Therefore:
"Z
b =
IF(y, fX , )
RN

#1

(x, )
e [fX ]) .
f (x)dx
(y,
[f
e X]

(4.187)


E 172 Influence function of the sample mean I (www.4.7)


Compute the influence function (4.185, AM 2005) of the sample mean (4.196, AM 2005).
Solution of E 172
Sample estimators of the unknown quantity G[fX ] are by definition explicit functionals of the empirical
pdf:
e [fi ] G [fi ] .
G
T
T

(4.188)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

133

Therefore from its definition (4.185, AM 2005) the influence function reads:
i

1 h
G (1 )fX +  (y) G [fX ] ,
0 

b lim
IF(y, fX , G)

(4.189)

where y is an arbitrary point. Now consider the function h (1 )fX +  (y) . The influence function
can be written:

1
dG [h ]
.
(G [h ] G [h0 ]) =
0 
d =0

b lim
IF(y, fX , G)

(4.190)

b , which reads:
Consider the functional associated with the sample mean
Z
e [h]

xh(x)dx .

(4.191)

RN

From (4.190) the influence function reads:



de
[h ]
b)
IF(y, f,
.
d =0

(4.192)

First we compute:
Z
e [h ]

xh (x)dx
N

ZR



x (1 )fX (x) +  (y) (x) dx
RN
Z
= (1 )
xfX (x)dx + y

(4.193)

RN

= E {X} + ( E {X} + y) .
From this and (4.192) we derive:
b ) = E {X} + y .
IF(y, fX ,

(4.194)


E 173 Influence function of the sample mean II (see E 172)


Adapt the solution of E 172 to the univariate case to compute the influence function of the sample mean.
Solution of E 173
Sample estimators of the unknown quantity G [fX ] are by definition explicit functionals of the empirical
pdf:
e [fi ] G [fi ] .
G
T
T
Therefore from its definition (4.185, AM 2005) the influence function reads:

(4.195)

i

1 h
G (1 )fX +  (y) G [fX ] ,
0 

b lim
IF(y, fX , G)

(4.196)

where y is an arbitrary point. Now consider the function:


h (1 )fX +  (y) .

(4.197)


1
dG [h ]
b
.
IF(y, fX , G) lim (G [h ] G [h0 ]) =
0 
d =0

(4.198)

The influence function can be written:

Consider the functional associated with the sample mean


b, which reads:
Z

e [h]

xh(x)dx .

(4.199)

From (4.198) the influence function reads:



de
[h ]
IF(y, f,
b)
.
d =0

(4.200)

First we compute:
Z

e [h ]

xh (x)dx
ZR 

=
x (1 )f (x) +  (y) (x) dx
R
Z
= (1 ) xf (x)dx + y

(4.201)

= E {X} + ( E {X} + y) .
From this and (4.200) we derive:
IF(y, f,
b) = E {X} + y .

(4.202)


E 174 Influence function of the sample covariance (www.4.7)


Compute the influence function (4.185, AM 2005) of the sample covariance (4.197, AM 2005).
Solution of E 174
Sample estimators of the unknown quantity G[fX ] are by definition explicit functionals of the empirical
pdf:
e [fi ] G [fi ] .
G
T
T

(4.203)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

135

Therefore from its definition (4.185, AM 2005) the influence function reads:
i

 h
b lim 1 G (1 )fX +  (y) G [fX ] ,
IF(y, fX , G)
0 

(4.204)

where y is an arbitrary point. Now consider the function h (1 )fX +  (y) . The influence function
can be written:

1
dG [h ]
b
IF(y, fX , G) lim (G [h ] G [h0 ]) =
.
0 
d =0

(4.205)

b which reads:
Consider now the functional associated with the sample covariance ,
Z
e [h]

RN

e [h])(x
e [h])0 h(x)dx .
(x

(4.206)

From (4.198) the influence function reads:



e [h ]
d

1
e [h ]
e [h0 ]) =
b lim (
IF(y, fX , )

0 
d

(4.207)

=0

First we compute:
Z
e [h ]

RN

e [h ])(x
e [h ])0 h (x)dx
(x



e [h ])(x
e [h ])0 (1 )fX (x) +  (y) (x) dx
(x
RN
Z
e [h ])(x
e [h ])0 fX (x)dx + (y
e [h ])(y
e [h ])0 .
= (1 )
(x

(4.208)

RN

Deriving this expression with respect to  we obtain:



e [h ]
d
b
IF(y, f, ) =

d
=0
Z
e [h0 ])(x
e [h0 ])0 fX (x)dx
=
(x
RN

Z
d
e [h ])(x
e [h ])0 fX (x)dx
+ (1 0)
(x

RN d =0
e [h0 ])(y
e [h0 ])0
+ (y

d
e [h ])(y
e [h ])0 .
+0
(y
d
=0

e [h0 ] = E {X} this means:


Using

(4.209)

Z
b = Cov {X}
IF(y, fX , )

2
RN


de
[h ]
(x E {X})fX (x)dx
d =0

(4.210)

+ (y E {X})(y E {X}) .
Now using (4.194) we obtain:
Z

(y E {X})(x E {X})0 fX (x)dx

b = Cov {X} 2
IF(y, fX , )
RN

+ (y E {X})(y E {X})

(4.211)

The term in the middle is null:


Z

(y E {X})(x E {X})0 fX (x)dx = y

(x E {X})0 fX (x)dx
Z
E {X}
(x E {X})0 fX (x)dx

RN

RN

(4.212)

RN

=0
Therefore:
b = Cov {X} + (y E {X})(y E {X})0 .
IF(y, fX , )

(4.213)


E 175 Influence function of the sample variance (see E 174)


Adapt the solution of E 174 to the univariate case to compute the influence function of the sample variance.
Solution of E 175
Consider the functional associated with the sample variance
b2 , which reads:
Z

e [h]

(x
e [h])2 h(x)dx .

(4.214)

From (4.198) the influence function reads:



1 2
de
2 [h ]
2
IF(y, fX ,
b ) lim (e
[h ]
e [h0 ]) =
.
0 
d =0
2

(4.215)

First we compute:
Z

e [h ]

(x
e [h ])2 h (x)dx

(x
e [h ])2 ((1 )fX (x) +  (y) (x))dx
R
Z
= (1 ) (x
e [h ])2 fX (x)dx + (y
e [h ])2 .
=

(4.216)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

137

Deriving this expression with respect to  we obtain:



de
2 [h ]
IF(y, fX ,
b )=
d =0
Z
= (x
e [h0 ])2 fX (x)dx
R

Z
d
(x
e [h ])2 fX (x)dx
+ (1 0)

R d =0

d
2
+ (y
e [h0 ]) + 0
(y
e [h ])2 .
d =0
2

(4.217)

Using
e [h0 ] = E {X} this means:
IF(y, fX ,
b2 ) = Var {X}

Z
2
R
2


de
[h ]
(x E {X})fX (x)dx
d =0

+ (y E {X}) .

(4.218)
(4.219)

Now using (4.202) we obtain:


Z

IF(y, fX ,
b ) = Var {X} 2

(y E {X})(x E {X})fX (x)dx


R

(4.220)

+ (y E {X})2 .
The term in the middle is null. Therefore:
IF(y, f,
b2 ) = Var {X} + (y E {X})2 .

(4.221)


E 176 Influence function of the ordinary least squares estimator (www.4.7)


Derive the expression (4.212, AM 2005) of the influence function (4.185, AM 2005) of the ordinary least
squares (OLS) estimator (4.211, AM 2005).
Solution of E 176
b define z (x, f ) the set of invariants and factors. We have:
For the OLS factor loadings B
Z
G [fZ ] =

xf 0 fZ (z)dz

 Z

ff 0 fZ (z)dz

1
.

(4.222)

Consider a point w (e
x, e
f ). We have:
h
i
G fZ + ( (w) fZ ) = (A + B)(C + D)1 ,
where:

(4.223)

Z
A
Z
B
Z
C
Z
D

xf 0 fZ dz = E {XF0 }

(4.224)

ee
xf 0 ( (w) fZ )dz = x
f 0 E {XF0 }

(4.225)

ff 0 fZ dz = E {FF0 }

(4.226)

ff 0 ( (w) fZ )dz = e
fe
f 0 E {FF0 } .

(4.227)

Since:
(C + D)1 = (C(I + C1 D))1
= (I + C1 D)1 C1
(I C

D)C

(4.228)

we have:
h
i
G fZ + ( (w) fZ ) (A + B)(C1 C1 DC1 )
AC1 + (BC1 AC1 DC1 ) .

(4.229)

Therefore:
 h
i

b = lim 1 G fZ + ( (w) fZ ) G [fZ ]
IF(y, fX , B)
0 
= (BC1 AC1 DC1 )
h
i
1
ee
= x
f 0 E {XF0 } E {FF0 }
h
i
1 ee0
1
E {XF0 } E {FF0 }
f f E {FF0 } E {FF0 }

(4.230)

1
= (e
xe
f 0 Be
fe
f 0 ) E {FF0 } .

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:
Xt N((u) , (u) ) .
Consider the first non-central moment of Xt conditional on the observations:

(4.231)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

n
o
(u)
t,n E Xt,n |xt,obs(t) , (u) , (u) .

139

(4.232)

From (2.65, AM 2005), for the observed values we have:


(u)

t,obs(t) = xt,obs(t)

(4.233)

and for the missing values we have:


(u)

(u)

(u)

(u)

(u)

t,mis(t) = mis(t) + mis(t),obs(t) (obs(t),obs(t) )1 (xt,obs(t) obs(t) ) .

(4.234)

Consider now the second non-central conditional moment:


(u)

St

n
o
E Xt X0t |xt,obs(t) , (u) , (u)

(4.235)

This matrix consists of three sub-components:


n
o
(u)
St,obs(t),obs(t) E Xt,obs(t) X0t,obs(t) |xt,obs(t) , (u) , (u)
h
ih
i0
(u)
(u)
= xt,obs(t) x0t,obs(t) = t,obs(t) t,obs(t) ,

(4.236)

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)
h
ih
i0
(u)
(u)
(u)
= t,mis(t) x0t,obs(t) = t,mis(t) t,obs(t) ,

(4.237)

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)
In other words, defining the matrix C as:
(u)

Ct,obs(t),mis(t) 0 ,
and otherwise:

(u)

Ct,obs(t),obs(t) 0 ,

(4.239)

(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:
(u)

St

h
ih
i0
(u)
(u)
(u)
= 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:

(u+1)

T
1 X (u)
x .

T t=1 t

(4.242)

Similarly we can update the estimate of the unconditional second moment as the sample mean of the
conditional second moments:

S(u+1)

T
1 X (u)
S .
T t=1 t

(4.243)

The estimate of the covariance then follows from (2.92, AM 2005):


h
ih
i0
h
ih
i0
(u+1) S(u+1) (u+1) (u+1) S(u+1) (u) (u) .

(4.244)

From the definition (4.242) and (4.243) this is equivalent to

(u+1)

T
i
1 X h (u)
(u)
(u)
Ct + (xt (u) )(xt (u) )0 .
T t=1

(4.245)


E 178 Expectation-Maximization algorithm for missing data: example


R
Write a MATLAB
script in which you:
Upload the database DB_HighYieldIndices of the daily time series of high-yield bond indices. As
you will see, some observations are missing;
Compute the time series of the daily compounded returns, replacing NaN for the missing observations;
Assume that the distribution of the daily compounded returns is normal:

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:
(u+1)

T
i
1 X h (u)
(u)
(u)
Ct + (xt (u) )(xt (u) )0 .
T t=1

(4.247)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS


Solution of E 178
R
See the MATLAB
script S_ExpectationMaximizationHighYield.

141

E 179 Mixture distribution


Assume that the invariants Xt are distributed as a two-component mixture. In other words, the pdf reads:
fX fY + (1 )fZ ,

(4.248)

where (0, 1) and:


fY N(Y , Y2 )

(4.249)

2
LogN(Z , Z
).

(4.250)

V Y + (1 )Z ,

(4.251)

Y N(Y , Y2 )

(4.252)

fZ
Consider the variable:

where Y and Z are independent and:

2
LogN(Z , Z
).

(4.253)

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:

E X2

u2 fX (u)du
Z
Z
2
= u fY (u)du + (1 ) u2 fZ (u)du

(4.255)

= s2Y + (1 )s2Z .
On the other hand:



E V 2 E (Y + (1 )Z)2


= E 2 Y 2 + 2(1 )Y Z + (1 )2 Z 2


= 2 E Y 2 + 2(1 ) E {Y } E {Z} + (1 )2 E Z 2
2

= 2 s2Y + Y + eZ +Z /2 + (1 )2 s2Z .

(4.256)

Therefore (4.248) is not the pdf of (4.251). However, (4.248) is the pdf of a random variable, defined in
distribution as follows:
d

X BY + (1 B)Z ,

(4.257)

B Ber() ,

(4.258)

where in B is a Bernoulli variable:

a discrete random variable that can only assume two values:



B

1
0

with probability
with probability 1 .

(4.259)

Therefore, the pdf of B reads:


fB = (1) + (1 ) (0) ,

(4.260)

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:
fX|B (x|B = 0) = fZ (x) ,

fX|B (x|B = 1) = fY (x) .

(4.261)

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:
fX,B (x, b) = fX|B (x|b)fB (b) .

(4.263)

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
(1)
= fX|B (x|b) (b)db + (1 ) fX|B (x|b) (0) (b)db
=

= fX|B (x|B = 1) + (1 )fX|B (x|B = 0)


= fY (x) + (1 )fZ (x) .

(4.264)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

143

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:


1
(x/ Y )2
p
exp

2Y2
2Y2


1
(ln(x/(1 )) Z )2
f(1)Z (x) = p
exp
.
2
2
2Z
x 2Z
fY (x) =

(4.265)
(4.266)

Then we compute the characteristic functions of Y and (1 )Z as in (1.14, AM 2005) as the Fourier
transform of the respective pdfs:


(1)Z = F f(1)Z .

Y = F [fY ] ,

(4.267)

Then we compute the characteristic function of V :




V () E eiV
n
o
= E ei[Y +(1)Z]
o

n
= E eiY E ei(1)Z

(4.268)

= Y ()(1)Z ()


= F [fY ] ()F f(1)Z () .
Using (B.45, AM 2005) we can express the characteristic function of V in terms of the convolution (B.43,
AM 2005) of the pdfs and the Fourier transform:


V () = F fY 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:


 

fV = F 1 F fY f(1)Z = fY f(1)Z .

(4.271)


E 180 Moment-based functional of a mixture I (see E 179)


Consider the same setup than in E 179. Assume that we are interested in the following moment-based
functional:
Z
G[fX ]

(x2 x)fX (x)dx .

Compute (4.272) analytically as a function of the inputs , Y , Y , Z and Z .

(4.272)

Solution of E 180
Z
G[fX ] (x2 x)fX (x)dx
R
Z
Z
2
= (x x)fY (x)dx + (1 ) (x2 x)fZ (x)dx
R

(4.273)

= (Var {Y } + (E {Y })2 E {Y }) + (1 )(Var {Z} + (E {Z})2 E {Z}) .


Using (1.71, AM 2005)-(1.72, AM 2005) and (1.98, AM 2005)(1.99, AM 2005) we have:


2
Z
2
G[fX ] = (2Y + Y2 Y ) + (1 ) e2Z +2Z eZ + 2
.

(4.274)


E 181 Moment-based functional of a mixture II (see E 179 and E 180)


Consider the same setup than in E 179 and E 180. Consider the following estimators:
b a (x1 xT )x22
G

(4.275)

T
X
bb 1
G
xt
T t=1

(4.276)

bc 5 .
G

(4.277)

R
script in which you evaluate the performance of the three estimators above with
Write a MATLAB
R
respect to (4.272) as in the MATLAB
script S_Estimator by assuming:

0.8,

Y 0.2 ,

Z 0,

Z 0.15 ,

(4.278)

and by stress-testing the parameter Y in the range [0, 0.2].


Solution of E 181
R
See the MATLAB
script S_EstimateMomentsComboEvaluation.

E 182 Moment-based functional of a mixture III (see E 179 and E 180)


Consider the same setup than in E 179 and E 180. Determine analytically the non-parametric estimator
R
b d of (4.272) defined by (4.36, AM 2005). Write a MATLAB
script in which you assume:
G
0.8,

Y 0.2 ,

Z 0,

Z 0.15 ,

(4.279)

R
b d with respect to (4.272) as in the MATLAB
and evaluate the performance of G
script S_EstimateExpectedValueEvaluation
by stress-testing the parameter Y in the range [0, 0.2].

Solution of E 182
The non-parametric estimator of:
Z
G[fX ]
R

(x2 x)fX (x)dx

(4.280)

CHAPTER 4. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

145

follows from (4.36, AM 2005):


Z
bd
G

(x2 x)fiT (x)dx =

x2 fiT (x)dx

xfiT (x)dx .

(4.281)

The second term is the sample mean (1.126, AM 2005):


Z
m
b

xfiT (x)dx =
R

T
1X
xt .
T t=1

(4.282)

The first term is the sample non-central second moment:


T
1X 2
n
cs
x fiT (x)dx =
x .
T t=1 t
R

(4.283)

By applying (1.48) to (1.126, AM 2005) and (1.127, AM 2005) we obtain


n
cs = sb2 + m
b2 ,

(4.284)

where sb2 is the sample variance (1.127, AM 2005):


sb2

T
1X
(xt m)
b 2.
T t=1

(4.285)

Therefore:
bd = n
G
cs m
b = sb2 + m
b2 m
b.
R
script S_EstimateMomentsComboEvaluation for the implementation.
See the MATLAB

(4.286)


E 183 Moment-based functional of a mixture IV (see E 179)


R
Consider the same setup than in E 179. Write a MATLAB
script in which you evaluate the performance
of the estimator (4.276) with respect to (4.288) as in the script S_Estimator by stress-testing the parameter
Y in the range [0, 0.2].
R
Hint. Use the MATLAB
function QuantileMixture.

Solution of E 183
R
See the MATLAB
script S_EstimateQuantileEvaluation.

E 184 Estimation of a quantile of a mixture I (see E 179)


R
Consider the same setup than in E 179. Write a MATLAB
function QuantileMixture that computes
the quantile of (4.248) by linear interpolation/extrapolation of the respective cdf on a fine set of equally
spaced points for generic values of , Y , Y , Z , Z . In order to use this function in the sequel, make
sure the function can accept a vector of values u in (0, 1) as input, not just one value, thereby outputting
the respective vector of values x QX (u) in the domain of X.

Hint. Use the built-in cdfs that correspond to (4.249) and (4.250).

Then, assume knowledge of the following parameters:


0.8,

Y 0.2 ,

Z 0,

Z 0.15 .

(4.287)

Set Y 0.1 and generate a sample of T 52 i.i.d. observations from the distribution (4.248).
R
Hint. Feed a uniform sample into the MATLAB
function QuantileMixture.

Solution of E 184
R
See the MATLAB
function QuantileMixture and the script S_GenerateMixtureSample.

E 185 Estimation of a quantile of a mixture II (see E 179)


Consider the same setup than in E 179. Assume that we are interested in this functional:
G[fX ] (I [fX ])1 (p) ,

(4.288)

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):
G[fX ] QX (p) .

(4.289)

Compute the non-parametric estimator qbp of (4.288) defined by (4.36, AM 2005) in Meucci (2005). Write
R
script in which you assume:
a MATLAB
0.8,

Y 0.2 ,

Z 0,

Z 0.15 .

and evaluate the performance of qbp with respect to (4.288) as in the script
the parameter Y in the range [0, 0.2].

S_Estimator

(4.290)
by stress-testing

R
function QuantileMixture.
Hint. Use the MATLAB

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
R
See the MATLAB
script S_EstimateQuantileEvaluation for the implementation.

(4.291)


E 186 Maximum likelihood estimation


R
Write a MATLAB
script in which you:
Upload the time series of realizations of a random variable X in the database DB_TimeSeries;
R
Check that the provided series represents the realizations of an invariant using the MATLAB
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

(
fX f

Ca
f,
2
LogN
f,(0.01)2

for [0.04, 0.01]


for {0.02} {0.03} .

147

(4.292)

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
R
See the MATLAB
script S_MaximumLikelihood.

E 187 Quantile estimation: maximum likelihood vs. non-parametric (see E 186)


Consider the same setup than in E 186. Assume now that you are interested in the p-quantile of X for
p 1%, as defined in (1.17, AM 2005). Use the result in E 186 to compute the ML estimator qbpM L and
compare this ML estimate with the non-parametric estimate of the quantile for the same confidence level.
Hint. As in (4.38, AM 2005), the true quantile is a functional of the unknown distribution of X:
Qp (X) qp [fX ] .

(4.293)

Therefore, the ML estimator of the quantile is the functional applied to the ML-estimated distribution:
h
i
qbpM L qp fbM 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:
qbpN P qp [fiT ] .

Solution of E 187
R
See the MATLAB
script S_MaximumLikelihood.

(4.295)

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
R
2005). Write a MATLAB
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 assumption 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:

g(z)

( +N
2 )
N

( 2 )() 2

1+

z 

+N
2

(4.296)

Hence the weighting function (4.79, AM 2005) reads:


w(z) 2

g 0 (z)
+N
=
.
g(z)
+z

(4.297)

Therefore the weights (4.80, AM 2005) read:


wt

+N
.
b 1 (x
b )0
b)
+ (xt

(4.298)

R
For the implementation, see the MATLAB
function MleRecursionForStudentT and the script S_FitSwapToStudentT.


E 189 Random matrix theory: semi-circular law


Consider a N N matrix X where for all m, n = 1, . . . , N the entries are i.i.d. Xmn fX , where fX
is a univariate distribution with expectation zero and standard deviation one. Consider the symmetrized
and rescaled matrix:
1
(X + X0 ) .
8N
of Y and the density that they define:
Y

Consider the eigenvalues 1 , . . . , N

N
1 X (n )
h

,
N n=1

(4.299)

(4.300)

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)

where g is the rescaled upper semicircle function, defined for 0 as follows


2p
1 2 .
(4.302)

R
Write a MATLAB
script that shows (4.301) when the distribution fX is standard normal, shifted/rescaled
normal, and shifted/rescaled exponential.
g()

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


Solution of E 189
R
See the MATLAB
script S_SemiCircular.

149

E 190 Random matrix theory: Marchenko-Pastur limit


Consider a T N matrix X where for all m = 1, . . . , T , n = 1, . . . , N the entries are i.i.d. Xmn fX ,
where fX is a univariate distribution with expectation zero and standard deviation one. Consider the
sample covariance estimator (4.42, AM 2005):

1 0
X X.
T

(4.303)

Consider the eigenvalues 1 , . . . , N of Y and the density that they define:

N
1 X (n )

,
N n=1

(4.304)

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

N qT

h = gq ,

(4.305)

where the function gq is defined as:

gq ()

1
2q

q
(q )( q ) ,

(4.306)

for min max where:


q (1

q)2 ,

q (1 +

q)2 .

(4.307)

R
Write a MATLAB
script that shows (4.306) when the distribution fX is standard normal, shifted/rescaled
normal, and shifted/rescaled exponential.

Solution of E 190
R
See the MATLAB
script S_PasturMarchenko.

E 191 Non-parametric estimators of regression parameters


Consider a joint model for the invariants. For t = 1, . . . , T . The marginals are:
2
Xt LogN(X , X
)

Ft Ga(F , F2 ) ,

(4.308)

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 of the regression coefficients.


Compute the non-parametric estimators (b
, )
Solution of E 191
From (4.52, AM 2005) they read as in (4.54).

E 192 Maximum likelihood vs. non-parametric estimators of regression parameters (see E 191)
b the maximum-likelihood estimators of the regression
Consider the same setup than in E 191. Are (b
, )
coefficients?
Solution of E 192
No, because the regression model ensuing from (4.308)-(4.309) is not conditionally normal as in (4.48)(4.49).


E 193 Simulation of the distribution of statistics of regression parameters (see E 191)


R
Consider the same setup than in E 191. Write a MATLAB
script in which you:
Generate arbitrary values for the parameters in (4.308)-(4.309) and for the number of observations
T;
Compute in simulation the distribution of the statistic:

b
G

(b
)
T 2p
,

b2
b2

(4.311)

and the distribution of the statistic:

b
G

(b )
T 2q
;

b2
b2

(4.312)

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
R
See the MATLAB
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
E 194 Gamma approximation of the investors objective (www.5.1) **
Determine the characteristic function of the approximate objective (5.25, AM 2005).
Solution of E 194
Consider the generic second-order approximation (3.108, AM 2005) for the N prices of the securities in
terms of the underlying K-dimensional market invariants X, which we report here:


(n)
PT + g (n) (0) + X0 x g (n)


1

2
+ X0 xx
g (n)
X,
2
x=0
x=0

(5.1)

where n = 1, . . . , N . From (5.11, AM 2005) the market is an invertible affine transformation of the
prices, i.e.:

(n)

an +

N
X

Bnm g

(m)

(0) +

m=1

N
X



Bnm X0 x g (m)

m=1

x=0

(5.2)

N

1 X

2
Bnm X0 xx
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 an +

n=1

N
X
n=1

N
X

n=1

N
X

N
X

Bnm g (m) (0)

m=1

Bnm



X0 x g (m)

m=1

(5.3)
i
x=0

N
N

h
i
X
1X

2
n
Bnm X0 xx
g (m)
X ... .
2 n=1
x=0
m=1

151

In other words:
1
+ 0 X + X0 X ,
2

(5.4)

where:

N
X

n an +

n=1

N
X

n Bnm g (m) (0)

N
X



n Bnm x g (m)

n,m=1

(5.5)

n,m=1

N
X

(5.6)

x=0



2
n Bnm xx
g (m)

x=0

n,m=1

(5.7)

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
1
1
0
0
= + + Z + 0 + 0 Z + Z0 Z
2
2
1 0
0
= b + w Z + Z Z ,
2

(5.9)

from (5.4) we have:

where:
1
b + 0 + 0
2
w + .

(5.10)
(5.11)

We perform the Cholesky decomposition of the covariance:


BB0 ,

(5.12)

and the principal component decomposition of the following symmetric matrix:


B0 B = EE0 ,
where EE0 = I and is the diagonal matrix of the eigenvalues. We define:

(5.13)

CHAPTER 5. EVALUATING ALLOCATIONS

153

C BE ,

(5.14)

and we introduce the multivariate standard normal variable:



Y C1 Z N 0, E0 B1 (B0 )1 E = N(0, IK ) .

(5.15)

C0 w .

(5.16)

Finally we define:

In these terms and dropping the dependence on from the notation, (5.9) becomes:
1
= b + w0 CC1 Z + Z0 (C0 )1 C0 CC1 Z
2
1
0
0 0
= b + Y + YE B BEY
2
1
0
= b + Y + YE0 EE0 EY
2
K
X
1
=b+
(k Yk + k Yk2 ) .
2

(5.17)

k=1

As in Feuerverger and Wong (2000), we compute analytically the characteristic function of :

() E e

h P
i
k 2
i b+ K
k=1 (k yk + 2 yk )

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

f (y) =

2e 2 yk .

(5.19)

k=1

Therefore the characteristic function (5.18) becomes:

() = eib

K
Y

G(k , k ) ,

(5.20)

k=1

where:
1
G(, )
2
Since:

y
2
ei[y+ 2 y ] e 2 dy .

(5.21)

1 i 2
1 i
iy
y =
2
2

y2

i
1i
2

"
#2
1 i
i
=
y 1i
2
2 2
!2
1 i
i
+
2
2 1i
2

2
()2
i
1 i

y
,
=
2
1 i
2(1 i)

(5.22)

we obtain:
1
G(, ) =
2
r

1i
2

i
[y 1i
]

dy

()2
1
e 2(1i)
1 i

()
2(1i)

1
q

1i
2

i
[y 1i
] dy

2
1i

(5.23)

2 2
1
e 2(1i) .
1 i

Substituting this back into (5.20) we finally obtain the expression of the characteristic function:

() = qQ
K

eib

k=1 (1

21

2 2
k
k=1 (1ik )

PK

ik )

= |IK i|

12

(5.24)
12 0 (Ii)1 2

eib e

Notice that substituting (5.13) and (5.12) we obtain:


|IK i| = |E(IK i)E0 | = |IK iB0 B|


= (B0 )1 (IK iB0 B)B0

(5.25)

= |IK i| .
On the other hand, substituting (5.16) and (5.14) we obtain:
0 (IK i)1 = w0 C(IK i)1 C0 w
= w0 BE(IK i)1 E0 B0 w
0

0 1

= w B(E(IK i)E )
Substituting again (5.13) and (5.12) this reads:

B w.

(5.26)

CHAPTER 5. EVALUATING ALLOCATIONS

155

0 (IK i)1 = w0 B(IK iB0 B)1 B0 w


= w0 BB0 (B0 )1 (IK iB0 B)1 B0 w
= w0 ((IK iB0 B)B0 )1 B0 w

(5.27)

= w0 (B0 iB0 )1 B0 w
= w0 (IK i)1 (B0 )1 B0 w
= w0 (IK i)1 w .

Therefore, substituting (5.25) and (5.27) in (5.24) we obtain the characteristic function of the approximate
objective:
21

() = |IK i|

eib e 2 w (IK i)

w 2

(5.28)

Finally, substituting (5.10) and (5.11) we obtain:


() = |IK i|
1

21

ei(+ + 2 )

e 2 (+) (IK i)

(+) 2

(5.29)
.


E 195 Moments of the approximation of the investors objective (www.5.1)


Compute the moments of the approximate objective in (5.25, AM 2005).
Solution of E 195
To compute the moments of the approximate objective we use (1.44). In order to do this, we write the
characteristic function as follows:
1

() = v 2 eu ,

(5.30)

1
u() ib w0 (I iV)1 w
2
v() |I iV| ,

(5.31)

where:

and:
w +
V .

(5.32)

To show how this works we explicitly compute the first three derivatives. It is easy to implement this
R
approach systematically up to any order with by programming a software package such as Mathematica
.
The first three derivatives of the characteristic function read:

1
1 3
0 () = v 2 v 0 eu + v 2 eu u0
2
3
1
1
3 5
1 3
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
4
2
2
3
3
3
3 5 0 2 u 0
+ 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
1
1 3
v 2 v 0 eu (u0 )2 + v 2 eu (u0 )3 + 2v 2 eu u0 u00
2
1
1
1 3
v 2 v 0 eu u00 + v 2 eu u0 u00 + v 2 eu u000 .
2

(5.33)

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:
dM() 1
dM1 ()
= M1
M
d
d
d(AM()B)
d(M())
=A
B
d
d


d |A + B|
= |A + B| tr (A + B)1 B ,
d

(5.34)
(5.35)
(5.36)

where (5.34) follows from (A.126, AM 2005), (5.35) follows from a term by term expression of the
product AMB and (5.36) follows from (A.124, AM 2005). Using these formulas in (5.31) we obtain:
1
u() ib w0 (I iV)1 w
2
1
u0 () = ib w0 (I iV)1 [iV] (I iV)1 w
2
00
0
u () = w (I iV)1 [iV] (I iV)1 [iV] (I iV)1 w
u000 () = 3w0 (I iV)1 [iV] (I iV)1 [iV] (I iV)1 [iV] (I iV)1 w ,
(5.37)
and:

CHAPTER 5. EVALUATING ALLOCATIONS

157

v() |I iV|


v()0 = |I + iV| tr (I + iV)1 (iV)

 

v 00 () = |I + iV| tr (I + iV)1 (iV) tr (I + iV)1 (iV)


+ |I + iV| tr (I iV)1 (iV)(I iV)1 (iV)


v 000 () = |I + iV| (tr (I + iV)1 (iV) )3


+ 3 |I + iV| tr (I + iV)1 (iV)


tr (I iV)1 (iV)(I iV)1 (iV)

+ |I + iV| tr (I iV)1 [iV] (I iV)1 (iV)(I iV)1 (iV)

+ (I iV)1 (iV)(I iV)1 [iV] (I iV)1 (iV) .

(5.38)

Evaluating these derivatives in = 0 we obtain:


1
u w0 w
2
1
0
u = i(b + w0 Vw)
2
u00 = w0 V2 w

(5.39)

u000 = i3w0 V3 w ,
and:
v1
v 0 = i tr(V)
(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
1 3
E { } =
=i
v 2 v 0 eu + v 2 eu u0
2


0
1
1
1
0
2 w w
=e
(b + w Vw) tr(V) .
2
2

i1 0 (0)


(5.41)

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)

We want to prove that if S is estimable and sensible, then:


S() S() .

(5.43)

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:
S() = G [F ] .

(5.44)

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)

R.

(5.46)

Therefore both variables share the same cdf:


F () = FX (),
Thus:
S() = G [F ] = G [FX ] .

(5.47)

A similar result holds for the second allocation:






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)

This and (5.47)-(5.48) in turn imply the desired result:




S() = G [FX ] G FX = S() .

(5.50)


E 197 Translation invariance and positive homogeneity imply constancy (www.5.2)


Show that if an index of satisfaction is translation invariant (5.72, AM 2005) and positive homogeneous
(5.64, AM 2005), it is a constant index of satisfaction (5.62, AM 2005).

CHAPTER 5. EVALUATING ALLOCATIONS

159

Solution of E 197
Assume that an index of satisfaction is translation invariant:
g 1 S( + g) = S() + ,

(5.51)

and positive homogeneous:


S() = S() ,

for all 0 .

(5.52)

Then it displays the constancy feature. Indeed assume that B is a deterministic allocation B B then:



b

= b S
+
+
S( + b) = S b
b
b
b
b
  




= b S
+ = S b
+ b = S() + b .
b
b

(5.53)

S(b) = S(0 + b) = S(0) + b = b .

(5.54)

In particular:

From the homogeneity S(0) 0. Therefore, setting 1 we obtain:


S(b) = b ,

(5.55)


which is the constancy property (5.62, AM 2005).

E 198 Consistence with weak dominance (www.5.3)


Show that the certainty-equivalent (5.93, AM 2005) is a sensible index of satisfaction for increasing utility
functions. This also implies that the certainty-equivalent is consistent with weak dominance.
Solution of E 198
With a change of variable we write expected utility as follows:
Z

E {u()} =

u()f ()d =

u(Q (s))ds .

(5.56)

Now, assume that the following inequality holds:


Q (s) Q (s),

for all s (0, 1) .

(5.57)

Then:
E {u( )} E {u( )} .

(5.58)

Due to (5.99, AM 2005) this also implies that:


CE() CE() ,
which shows that (5.109, AM 2005) holds true.

(5.59)


E 199 Positive homogeneity of the certainty-equivalent and utility functions (www.5.3)


Show that the class of utility functions that give rise to a positive homogeneous certainty-equivalent is the
power class.
Solution of E 199
From its definition:
CE() u1 (E {u( )}) ,

(5.60)

the certainty-equivalent is positive homogeneous if it satisfies:


u1 (E {u( )}) = u1 (E {u( )}) .

(5.61)

Since from (5.16, AM 2005) the objective is positive homogeneous:


= ,

(5.62)

we obtain an align that does not depend on the allocation:


u1 (E {u()}) = u1 (E {u()}) .

(5.63)

Assume the utility function is of the power type:


u() .

(5.64)

Then, using 1.13 and the change of variable y , we obtain:


Z
E {u()} =

y f (y)dy =

1 y
y f
dy =

f ()d = E {u()} . (5.65)

Since the inverse of the power utility function (5.64) reads:


1

u1 (z) = z ,

(5.66)

from (5.65) we obtain:



1
1
1
u1 (E {u()}) = [E {u()}] = E {u()} = [E {u()}] = u1 (E {u()}) . (5.67)


E 200 Translation invariance of the certainty-equivalent and utility functions (www.5.3)


Show that the certainty-equivalent index of satisfaction (5.93, AM 2005) is translation invariant for exponential utility functions.

CHAPTER 5. EVALUATING ALLOCATIONS

161

Solution of E 200
From its definition:
CE() u1 (E {u( )}) ,

(5.68)

the certainty-equivalent is translation invariant if it satisfies:


b 1 u1 (E {u(+b )}) = u1 (E {u( )}) + .

(5.69)

Since from (5.17, AM 2005) the objective is additive:


+b = + ,

(5.70)

we obtain an align that does not depend on the allocation:


u1 (E {u( + )}) = u1 (E {u()}) + .

(5.71)

Assume the utility function is exponential:


u = e .

(5.72)

Then, using 1.13 and the change of variable y + we obtain:


Z

Z
ey f+ (y)dy = ey f (y )dy
Z
= e e f ()d = e E {u()} .

E {u( + )} =

(5.73)

On the other hand the inverse of the exponential utility function reads:

u1 (z) =

ln(z)
.

(5.74)

Therefore:
1
ln( [E {u( + )}])

1
= ln(e [ E {u()}])

1
= [ln([ E {u()}])]

= + u1 (E {u()}) .

u1 (E {u( + )}) =

(5.75)

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:
b = b ,

E {f } = 0 E {u(b )} E {u(b+f )} .

(5.76)

On the one hand, we have the following chain of identity:


E {u(b )} = u(b ) = u(E {b }) = u(E {b + f }) = u(E {b+f }) .

(5.77)

On the other hand, Jensens inequality states that for any random variable the following is true if and
only if u is concave:
u(E {}) E {u()} .

(5.78)

Therefore if and only if u is concave we obtain the following result:


E {u(b )} E {u(b+f )} .

(5.79)

Note. A similar solution links convexity of the utility function with risk propensity and linearity of the
utility function with risk neutrality.


E 202 Risk premium in the case of small bets (www.5.3)


Show that if an allocation gives rise to an objective function which is not too volatile, we have (5.122,
AM 2005).
Solution of E 202
From a second-order Taylor expansion and using the assumptions
b = b ,

E {f } = 0 ,

(5.80)

we obtain:

u(CE(b + f )) E {u(b+f )} = E {u(b + f )} u(b ) +

Var {f } 00
u (b ) .
2

(5.81)

On the other hand from the definition of risk premium (5.85, AM 2005), which we report here:
RP(b, f ) CE(b) CE(b + f ) .
and the constancy of the certainty-equivalent:

(5.82)

CHAPTER 5. EVALUATING ALLOCATIONS

163

CE(b) = b ,

(5.83)

CE(b + f ) = b RP(b, f ) ,

(5.84)

we obtain:

where RP(b, f ) is a small quantity. Therefore:


u(CE(b + f )) = u(b RP(b, f )) u(b ) u0 (b ) RP(b, f ) .

(5.85)

Thus from (5.81) and (5.85) we obtain:

RP(b, f )

u00 (b ) Var {f }
.
u0 (b )
2

(5.86)


E 203 Dependence on allocation: approximation in terms of the moments of the


objective (www.5.3)
Derive the expression (5.146, AM 2005) of the Arrow-Pratt approximation.
Solution of E 203
e
We first expand the utility function around an arbitrary value :
e + u0 ()(
e
e + 1 u00 ()(
e
e 2 + 1 u000 ()(
e
e 3 + .
u() = u()
)
)
)
2
3!

(5.87)

Taking expectations and pivoting the expansion around the objectives expected value
e E {} ,

(5.88)

we obtain:

E {u()} u(E {}) +

u00 (E {})
Var {} ,
2

(5.89)

where the term in the first derivative cancels out. On the other hand, another Taylor expansion yields:
u1 (z + ) u1 (z) +

1
.
u0 (u1 (z))

(5.90)

Substituting (5.89) in (5.90) we obtain:


u1 (E {u()}) u1 (u(E {})) +

u00 (E {})
Var {}
2u0 (u1 (u(E {})))

u00
= E {} + 0 (E {}) Var {} ,
2u

(5.91)

so that the first-order approximation reads:

CE() E { }

A(E { })
Var { } .
2

(5.92)


E 204 First-order sensitivity analysis of the certainty-equivalent I (www.5.3)


Derive the expression (5.148, AM 2005) of the first-order derivative of the certainty-equivalent index of
satisfaction.
Solution of E 204
First we derive the following result using the chain rule of calculus:
Z

E {u( )} =
u( )fM (m)dm
RN
Z
=
( )u0 ( )fM (m)dm

(5.93)

RN

= E { ( )u0 ( )} .
From this and the chain rule we obtain:


CE() = u1 (E {u( )})
du1
(E {u( )}) E {u( )}
dz
1
= 0 1
E {u( )}
u (u (E {u( )}))
E {u0 ( ) ( )}
=
.
u0 (CE())

(5.94)

For example consider the case where the objective are the net gains:
0 (PT + pT ) .

(5.95)

Then the market vector (5.10, AM 2005) reads:


M PT + pT ,

(5.96)

and the partial derivative of the objective (5.95) reads:


( ) = M .

(5.97)


E 205 First-order sensitivity analysis of the certainty-equivalent II (see E 204)


Consider the same setup than in E 204. Assume that the markets are normally distributed. Prove the
expression of the sensitivity of the certainty-equivalent in (5.151, AM 2005).

CHAPTER 5. EVALUATING ALLOCATIONS

165

Solution of E 205
We have:
PT + N(, ) .

(5.98)

Then the market vector (5.10, AM 2005) is normally distributed:


M N(, ) ,

pT .

(5.99)

Also, assume that the utility is the error function:



u() erf


.

(5.100)

Then the first derivative reads:

u0 () =

1
2 2
2
e
.

(5.101)

Thus the numerator in (5.94) reads:


r

o
1
2 n ( 2
(0 M)2 )
E e
M

r
1 Z
0 0
0 1
1
1
2 || 2
me 2 m ( )m e 2 (m) (m) dm
=
N
(2) 2 RN
r
1 Z
1
2 || 2
=
me 2 D(m) dm ,
N
(2) 2 RN

E {u0 ( ) ( )} =

(5.102)

where:

D(m) m

m + (m )0 1 (m )

(5.103)

= (m )0 1 (m ) + 0 1 0 1 ,
with:


0
+ 1

Therefore from (5.94) we obtain:

1

1 ,

0
+ 1

1
.

(5.104)

E {u0 ( ) ( )}
u0 (CE())
Z
1
1
|| 2 CE()2
2
=
me 2 D(m) dm
N e
N
2
(2)
R

CE() =

12

||

(2)

N
2

N
2

CE()2 12 [ 0 1 0 1 ] (2)
e
21

||

m
RN

||

12

(2)

N
2

e 2 (m)

(m)

dm

= () ,
(5.105)
where from (5.104) we obtain:
12

()

||

12

e 2 CE() e 2 [
1

1 0 1 ]

||

12

||

CE()
=
e
12 e 2
1

1
0
+

h
i
1
21 0 (1 1 [ 1 0 +1 ] 1 )

(5.106)
.

Using again (5.104) and (5.99) we finally obtain:



CE() = ()

1
0 + 1

1

1 ( pT ) .

(5.107)


E 206 Second-order sensitivity analysis of the certainty-equivalent (www.5.3) (see E 204)


Compute the second-order derivative of the certainty-equivalent and discuss its convexity.
Solution of E 206
First we derive the following result:

Z

{u ( )0 ( )} =
u ( )0 ( )fM (m)dm
RN
Z

2
00
=
fM (m) u0 ( )
0 ( ) + u ( ) ( )0 ( )] dm
N
R


2
00
= E u0 ( )
.
0 ( ) + u ( ) ( )0 ( )
From this, (5.94) and the chain rule of calculus we obtain:

(5.108)

CHAPTER 5. EVALUATING ALLOCATIONS

167


E {u0 ( )0 ( )}
CE() =
u0 (CE())


1
E {u0 ( )0 ( )}
= 0
u (CE())
1
E {u0 ( )0 ( )}
+ 0
u (CE())
#
"
u00 (CE()) E {u0 ( ) ( )}
E {u0 ( )0 ( )}
=
2
u0 (CE())
[u0 (CE())]


2
00
E u0 ( )
0 ( ) + u ( ) ( )0 ( )
.
+
u0 (CE())


(5.109)

Since the market is linear in the allocation:


= 0 M ,

(5.110)

we obtain:

0 CE() =

E {u00 (0 M)MM0 } u00 (CE())ww0


,
u0 (CE())

(5.111)

where:

wE


u0 (0 M)
M
.
u0 (CE())

(5.112)

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.


E 207 Interpretation of the certainty-equivalent


Express the meaning/intuition of the certainty-equivalent of an allocation.
Hint. See Meucci (2005, p.262).
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.


E 208 Certainty-equivalent computation I (see E 236)


Consider the copula in E 236, but replace the marginal distributions as follows:
P1 N 1 , 12

2 , 22

P2 N

(5.113)
.

Consider the case where the objective is final wealth. Consider an exponential utility function:

(5.114)

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
= a b
,
E {u ( )} a b E e

(5.116)

where denotes the characteristic function (1.12, AM 2005) of the objective. The inverse of (5.115) is:
u1 (e
u) = ln

au
e
b


.

(5.117)

Therefore the certainty equivalent reads:



 
i
,
CE () u1 (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:


1
2


,

12
1 2

1 2
22


.

(5.120)

Therefore as in (5.144, AM 2005) we obtain:


CE () = 0

1 0
.
2

(5.121)


E 209 Certainty-equivalent computation II (see E 208)


Consider the same setup than in E 208. Is the certainty equivalent corresponding to (5.115) positive
homogeneous? If so, compute the contribution to the certainty equivalent from the two securities as
defined by Eulers formula.
Solution of E 209
The certainty equivalent corresponding to (5.115) is not positive homogeneous. Indeed the class of utility
functions that give rise to positive homogeneous certainty equivalents is the power class, see (5.114, AM
2005).


CHAPTER 5. EVALUATING ALLOCATIONS

169

E 210 Constancy of the quantile-based index of satisfaction (www.5.4)


Prove that the quantile-based index of satisfaction (5.159, AM 2005) satisfies the constancy requirement.
Hint. Smooth the quantile-based index of satisfaction.
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:
fb ; () ( (b ) (0) )() =

(b )2
1
e 22 .
2

(5.122)

The respective regularized cdf reads:

Fb ; () =

1
2

1
=
2
1
=
2

(xb )2
22

dx

2

!
e

y 2

(5.123)

dy


1 + erf

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:
Qb ; (s) F1
(s) = b +
b ;

2 erf 1 (2s 1) .

(5.124)

For small  the regularized quantile satisfies:


Qb ; (s) b ,

for all s (0, 1) ,

(5.125)

and the approximation becomes exact in the limit  0. Thus the quantile (5.159, AM 2005) satisfies:
b = b Qc (b) Qb (1 c) = b ,
which is the constancy property (5.62, AM 2005) in this context.

(5.126)


E 211 Homogeneity of the quantile-based index of satisfaction (www.5.4)


Show that the quantile-based index of satisfaction is positive homogeneous (5.65, AM 2005).
Solution of E 211
Consider the s-quantile of the variable X, defined implicitly as in (1.18, AM 2005) by
P {X QX } = s .

(5.127)

If h is an increasing function then (5.127) is equivalent to the following identity:


P {h(X) h(QX )} = s .

(5.128)

On the other hand, the s-quantile Qh(X) (s) of the variable h(X) is defined implicitly by:


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:
Qh(X) (s) = h(QX (s)) .

(5.130)

As special cases, consider h(X) X, where > 0. Then (5.130) implies:


QX (s) = QX (s) .

(5.131)

Expression (5.131) and the positive homogeneity of the objective (5.16, AM 2005) prove the positive
homogeneity of the quantile-based index of satisfaction:
Qc () Q (1 c) = Q (1 c) = Q (1 c) Qc () .

(5.132)


E 212 Translation invariance of the quantile-based index of satisfaction (www.5.4)


(see E 211)
Consider the same setup than in E 211. Show that the quantile-based index of satisfaction is positive
translation invariant (5.72, AM 2005).
Solution of E 212
Consider h(X) X + . Then (5.130) implies:
QX+ (s) = QX (s) + .

(5.133)

Expression (5.133) and the additivity of the objective (5.17, AM 2005) prove the translation-invariance
of the quantile-based index of satisfaction:
Qc ( + b) Q+b (1 c) = Q + (1 c) = Q (1 c) + Qc () + .

(5.134)


E 213 Example of strong dominance


Consider a bivariate market M. Define a market distribution and two portfolios such that one portfolio
strongly dominates the other.
Solution of E 213
Consider the market M1 1 and:

M2 =

2
3

with probability 0.3


with probability 0.7 .

The allocation (0, 1) strongly dominates the allocation (1, 0).

(5.135)


CHAPTER 5. EVALUATING ALLOCATIONS

171

E 214 Example of weak dominance (see E 213)


Consider a bivariate market M. Define a market distribution and two portfolios such that one portfolio
weakly dominates the other.
Solution of E 214
Since strong dominance implies weak dominance, see E 213.

E 215 Additive co-monotonicity of the quantile-based index of satisfaction (www.5.4)


(see E 211)
Consider the same setup than in E 211. Show that the quantile-based index of satisfaction is additive
co-monotonicity.
Solution of E 215
Consider h(X) X + g(X) where g is an increasing function. Then (5.130) implies:
QX+g(X) (s) = QX (s) + g(QX (s)) = QX (s) + Qg(X) (s) .

(5.136)

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:
Qc ( + ) Q+ (1 c) = Q + (1 c)
= Q (1 c) + Q (1 c)

(5.137)

Qc () + Qc () .


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) ,
6 Var { }
6 Var { }

(5.138)

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:
Qc () Q (1 c) A() + B()z(1 c) + C()z 2 (1 c) ,
where:

(5.139)

A E { }
B
C



3
E 3 3 E 2 E { } + 2 E { }
2

6(E {2 } E { } )

E {2 } E { }
 3

3
E 3 E 2 E { } + 2 E { }
2

6(E {2 } E { } )

(5.140)
(5.141)

(5.142)

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.


E 217 First-order sensitivity analysis the quantile-based index of satisfaction (www.5.4)


Prove the expression (5.188, AM 2005) of the first-order derivatives of the quantile-based index of satisfaction:
Q()
= E {M|0 M = Q()} .

(5.143)

Hint. See Gourieroux et al. (2000).


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:
1 c = P { Qc ()} = P {0 M Qc ()} .

(5.144)

(5.145)

Defining:
Xn

j Mj ,

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:

g(a)

1
a0 a

dg
g(a)+ da
a

f (x)dx = lim

f (x)dx = f (g(a))
g(a)

dg(a)
,
da

(5.147)

differentiating both sides of (5.146) with respect to n we obtain:




Z
0=

f (Q n Mn , mn )


Q
mn dmn ,
n

(5.148)

CHAPTER 5. EVALUATING ALLOCATIONS

173

or:
Q
=
n

m f (Q n Mn , mn )dmn
R n
= E {Mn |Xn = Q() n Mn } .
f (Q n Mn , mn )dmn

(5.149)

Therefore, substituting back the definition (5.145) we obtain:


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)

We derive the second derivatives from the definition:

2
ij
Q() lim

0

1
[i Q() i Q()] .


(5.152)

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}
In other words, defining the variables:
Z 0 M Q() ,

Y Mj E {Mj |Z = 0} ,

X Mi ,

(5.154)

we can write:
i Q() E {X|Z + Y = 0} .

(5.155)

i Q() = E {X|Z = 0} .

(5.156)

Also notice that in this notation:

Consider the joint pdf f of (X, Y, Z). The conditional expectation in (5.155) can be computed in terms
of the conditional pdf, which reads:

f (x, y|Z + Y = 0) = f (x, y|z = y) = R

f (x, y, y)
.
f (x, y, y)dxdy

(5.157)

Therefore (5.155) becomes:


RR
xf (x, y, y)dxdy
i Q() R R
f (x, y, y)dxdy
RR
RR
xf (x, y, 0)dxdy 
xyz f (x, y, 0)dxdy
RR
RR
f (x, y, 0)dxdy 
yz f (x, y, 0)dxdy
Z Z

Z Z
=
xf (x, y, 0)dxdy 
xyz f (x, y, 0)dxdy
RR

1
yz 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 
xyz [ln f (x, y, 0)] f (x, y, 0)dxdy
Z Z

Z Z

(5.158)

1

f (x, y, 0)dxdy
RR


yz [ln f (x, y, 0)] f (x, y, 0)dxdy
RR
1+
f (x, y, 0)dxdy
RR
RR
xf (x, y, 0)dxdy
xyz [ln f (x, y, 0)] f (x, y, 0)dxdy
RR
RR

f (x, y, 0)dxdy
f (x, y, 0)dxdy
RR
RR
xf (x, y, 0)dxdy
yz [ln f (x, y, 0)] f (x, y, 0)dxdy
RR
RR
+
.
f (x, y, 0)dxdy
f (x, y, 0)dxdy
Thus:
i Q() E {X|Z = 0}  [E {XY z [ln f (X, Y, 0)] |Z = 0}
E {X|Z = 0} E {Y z [ln f (X, Y, 0)] |Z = 0}]
= E {X|Z = 0}  [Cov {X, Y z [ln f (X, Y, 0)] |Z = 0}]
= E {X|Z = 0}  [Cov {X, Y z [ln f (X, Y |0) + ln fZ (0)] |Z = 0}]
= E {X|Z = 0}  [Cov {X, Y z [ln f (X, Y |0)] |Z = 0}
+ z [ln fZ (0)] Cov {X, Y |Z = 0}] .
On the other hand:

(5.159)

CHAPTER 5. EVALUATING ALLOCATIONS

175

z [Cov {X, Y |Z = z}] = z [E {XY |Z = z} E {X|Z = z} E {Y |Z = z}]


Z Z
= z
xyf (x, y|z)dxdy

Z Z
Z Z

xf (x, y|z)dxdy
yf (x, y|z)dxdy
Z Z
=
xyz f (x, y|z)dxdy
E {Y |Z = z} z [E {X|Z = z}]
Z Z
E {X|Z = z}
yz f (x, y|z)dxdy
Z Z
=
xyz [ln f (x, y|z)] f (x, y|z)dxdy

(5.160)

E {Y |Z = z} z [E {X|Z = z}]
Z Z
E {X|Z = z}
yz [ln f (x, y|z)] f (x, y|z)dxdy
= E {XY z [ln f (X, Y |z)] |Z = z}
E {X|Z = z} E {Y z [ln f (X, Y |z)] |Z = z}
E {Y |Z = z} z [E {X|Z = z}]
= Cov {X, Y z [ln f (X, Y |z)] |Z = z}
E {Y |Z = z} z [E {X|Z = z}] ,
which shows that:
Cov {X, Y z [ln f (X, Y |z)] |Z = z} = z [Cov {X, Y |Z = z}]
+ E {Y |Z = z} z [E {X|Z = z}] .

(5.161)

Therefore (5.159) becomes:


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}] .


In this expression, from (5.154):
E {Y |Z = 0} = E {Mj E {Mj |Z = 0} |Z = 0} = 0 .

(5.163)

Therefore:
i Q() E {X|Z = 0}  [z [Cov {X, Y |z = 0}]
+ z [ln fZ (0)] Cov {X, Y |z = 0}] ,
and finally, from (5.156) we obtain:

(5.164)

2
ij
Q() z [Cov {X, Y |z = 0}]

(5.165)

z [ln fZ (0)] Cov {X, Y |z = 0} .


Substituting again the definitions (5.154) in this formula we obtain:
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}
z

Cov {M|0 M = z}
=

z

(5.166)

z=Q()

ln f0 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 .

The last row in (5.167) is true because of the Cauchy-Schwartz inequality (A.8, AM 2005).

(5.168)


E 220 Value-at-Risk in elliptical markets I


Consider an N -dimensional market that as in (2.144, AM 2005) is uniformly distributed on an ellipsoid
(surface and internal points):
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 ,
for some generator

g1U

(5.173)

induced by the N -dimensional uniform distribution. Therefore:


Qc () Q (1 c) = Q0 +0 X (1 c) .

(5.174)

Using 1.17 we obtain:


Qc () = 0 +

0 c ,

where the scalar c QX (1 c) can be evaluated numerically.

(5.175)


E 221 Value-at-Risk in elliptical markets II (see E 220)


Consider the same setup than in E 220. Factor Qc () in terms of its marginal contributions.
Hint. Compare with (5.189, AM 2005).
Solution of E 221
Deriving (5.175) we obtain:
c
Qc ()
=+
.

(5.176)

Therefore the marginal contributions C read:


C diag ()

Qc ()
c
= diag () +
diag () .

(5.177)

It is immediate to check that:

Qc ()

N
X

Cn ,

(5.178)

n=1

see (5.67, AM 2005) and (5.190, AM 2005).

E 222 Value-at-Risk in elliptical markets III (see E 220) *


R
Consider the same setup than E 220. Consider the case N 3. Write a MATLAB
script in which you:
Generate randomly the parameters and ;
Generate a sample of J 1,000 simulations of the market (5.169);
Generate a random allocation vector . Set c 0.95 and compute Qc () as the sample counterpart of (5.159, AM 2005);
Compute the marginal contributions to Qc () from each security in terms of the empirical derivative of Qc ():

Qc ()



Qc +  (n) Qc ()


(5.179)

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 distribution on the N -dimensional hypercube:
X U ([1, 1] [1, 1]) .

(5.180)

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 efficiently 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

To generate J scenarios of U, you can use:


d

U = Z/ kZk ,

(5.184)

Z N (0N 1 , IN N ) ,

(5.185)

where:

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:

fR (r) =

rN 1
.
N 1

(5.186)

From (5.186), the radial cdf reads:


FR (r) = rN .

(5.187)

Inverting the cdf, we obtain the quantile function:


QR (u) = u1/N .

(5.188)

Hence from (2.25, AM 2005)-(2.26, AM 2005) we obtain:


d

R = W 1/N ,

(5.189)

where W U ([0, 1]) is uniform on the unit interval and is independent of U.


To generate J scenarios from (5.183) it now suffices to multiply the scenarios for U by the respective
R
script S_VaRContributionsUniform for the implementation.

scenarios for R. See the MATLAB

E 223 Cornish-Fisher approximation of the Value-at-Risk


Assume that the investors objective is lognormally distributed:

2
LogN ,
,

(5.190)

R
where 0.05 and 0.05. Write a MATLAB
script in which you plot the true quantile-based
index of satisfaction Qc () against the Cornish-Fisher approximation (5.179, AM 2005) as a function of
the confidence level c (0, 1).

Solution of E 223
R
See the MATLAB
script S_CornishFisher.

E 224 Spectral representation (www.5.5)


Show that the expected shortfall can be used to generate other spectral indices of satisfaction.

Solution of E 224
We consider weighted averages of the expected shortfall for different confidence levels. From the definition (5.207, AM 2005) of expected shortfall this means:
1

Z
Spc()

1
1c

ESc ()w(c)dc =
0

1c

Z


Q (s)ds w(c)dc ,

(5.191)

where:
1

Z
w(c) 0 ,

w(c)dc = 1 .

(5.192)

Equivalently:
Z
0


w(c)
Q (s)ds
ESc ()w(c)dc =
dc
c
0
0

Z
Z 1
c
w(c)
ds dc
=
Q (s)
c
0
0
Z 1

Z 1
w(c)
=
Q (s)
dc ds
c
0
s
Z 1
=
Q (s)(s)ds ,
Z

Z

(5.193)

where:
1

Z
(s)
s

w(x)
dx .
x

(5.194)

w(s)
,
s

(5.195)

On the one hand, from:


0 (s) =
we obtain:
Z

[s(s)] ds =
0

(s)ds +
0

s0 ds =

Z
(s)ds

w(s)ds .

(5.196)

On the other hand, from (5.194) we obtain (1) = 0 and thus:


Z
0

[s(s)] ds = s(s)|0 = 0 .

(5.197)

Therefore:
Z

(s)ds = 1 .

(5.198)

Finally, from (5.195) we also obtain 0 0.

CHAPTER 5. EVALUATING ALLOCATIONS

181

E 225 Spectral indices of satisfaction and risk aversion


Consider a fair game, i.e. an allocation f such that:
E {f } = 0 .

(5.199)

Then a fortiori, for any s (0, 1) the following is true:


E {f |f Qf (s)} 0 .

(5.200)

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.


E 226 Cornish-Fisher approximation of the spectral index of satisfaction (www.5.5)


Prove the expression (5.222, AM 2005) of the Cornish-Fisher approximation of the spectral index of
satisfaction.
Note. There is a typo in (5.232, AM 2005) which should be I[](1).
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 { } 2
CM3 { }
+ Sd { } z(s) +
z (s) ,
Q (s) E { }
6 Var { }
6 Var { }

(5.201)

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:
Q (s) Q (s) A() + B()z(s) + C()z 2 (s) ,

(5.202)

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
Spc ()

(s)Q (s)ds
0

Z
A() + B()

Z
(s)z(s)ds + C()

(5.203)

1
2

(s)z (s)ds .
0

E 227 Extreme value theory I (www.5.5)


Prove the expression (5.233, AM 2005) of the expected shortfall approximation.

Solution of E 227
Define the variable:
Z Qc () .

(5.204)

From (5.182, AM 2005) we obtain:


1 LQc () (z) = 1 P { Qc () z| Qc ()}
= 1 P {Qc () z| Qc ()}
= P {Qc () z| Qc ()}

(5.205)

= P {Z z|Z 0} .
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
E {Z|Z 0}

z
0

v
dG,v (z)
dz =
,
dz
1

(5.206)

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:
ESc () = E { | Qc ()}
= Qc () + E { Qc ()| Qc ()}

(5.207)

= Qc () E {Z|Z 0} .


E 228 Extreme value theory II


R
Describe how to estimate the parameters and v of a generalized Pareto distribution in MATLAB
.

Solution of E 228
R
To estimate the parameters and v using the MATLAB
function gpfit proceed as follows. Define the
excess as the following random variable:
Z e | e .

(5.208)

Notice that the cdf of Z satisfies:


FZ (z) P {Z z}
n
o
= P e z| e
n
o
= P e z| e
n
o
= 1 P e z| e
1 Le (z) ,

(5.209)

CHAPTER 5. EVALUATING ALLOCATIONS

183

where in the last row we used (5.182, AM 2005). From (5.183, AM 2005) we obtain:
FZ (z) G,v (z) .
The function xi_v
variable (5.208).

= gpfit(Excess)

(5.210)

attempts to fit (5.210), where Excess are the realizations of the random


E 229 Extreme value theory approximation of Value-at-Risk


Assume that the objective is Student t distributed:

2
St , ,
,

(5.211)

R
2
where 7, 1,
4. Write a MATLAB
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:

e Q0.95 () ;

(5.212)

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
the realizations of the random variable:

= gpfit(Excess),

Z e | e .

where Excess are

(5.213)

Indeed the cdf of Z satisfies:


FZ (z) P {Z z}
n
o
= P e z| e
n
o
= P e z| e
n
o
= 1 P e z| e

(5.214)

1 Le (z) ,
where in the last row we used (5.182, AM 2005). From (5.184, AM 2005) we obtain:
FZ (z) G,v (z) ,

(5.215)

R
which is the expression that the MATLAB
function gpfit attempts to fit.

Solution of E 229
R
See the MATLAB
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.
Hint. Adapt from Bertsimas et al. (2004).
Solution of E 230
First we define:
Xn

j M j .

(5.216)

j6=n

From the definition (5.208, AM 2005) of expected shortfall we obtain:



Z + Z +
ESc ()
1

(x + n m)IxQc n m (x, m)
=
n
n 1 c
fXn ,Mn (x, m)dxdm]
Z +
Z Qc n m
1

=
(x + n m)fXn ,Mn (x, m)dxdm .
1 c n

(5.217)

Using (5.147) this becomes:


+


Qc ()
m Qc ()fXn ,Mn (Qc () n m, m)dm
n

Z + Z Qc n m
1
+
mfXn ,Mn (x, m)dxdm .
1 c

ESc ()
1
=
n
1c

(5.218)

On the other hand:

0=

Z + Z Qc n m

(1 c)
=
fXn ,Mn (x, m)dxdm
n
n
Z +
Qc ()

(
m)fXn ,Mn (Qc () n m, m)dm .
n

(5.219)

Therefore:
Z + Z Qc n m
ESc ()
1
=
mfXn ,Mn (x, m)dxdm
n
1 c
Z Z
1
=
mfXn ,Mn (x, m)dxdm .
1c
Qc

(5.220)

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

E 231 Second-order sensitivity analysis of the expected shortfall (www.5.5)


Compute the expression of the second derivative of the expected shortfall.
Hint. Adapt the solution from Rau-Bredow (2004).
Solution of E 231
First we define:
Xn

j M j .

(5.221)

j6=n

With this, the second derivative is:

2 ESc ()
=
E {M0 |Xn + n Mn Qc ()}
n 0
n
Z


m0 fM (m|Xn + n Mn Qc ())dm .
=
n

(5.222)

In this expression the conditional density reads:


R Qc n mn
fm (m|Xn + n Mn Qc ) = R R Qn mn
c
=R

fXn ,M (x, m)dxdm

R Qc n mn
fXn ,M (x, m)dx

xn +n mn Qc

R Qc n mn
=

fXn ,M (x, m)dx

(5.223)

fXn ,M (x, m)dxdm

fXn ,M (x, m)dx


1c

Therefore using (5.147) we obtain:


#
Z Qc n mn

m0
fXn ,M (x, m)dxdm
n
Z



1
Qc ()
=
m0
mn fXn ,m (Qc () n mn , m)dm .
1c
n

2 ESc ()
1
=
n 0
1c

"Z

(5.224)

Using Bayes rule:


fXn ,m (Q n mn , m) = fXn +n mn ,M (Q, m)
= fm|Xn +n mn (m|Xn + n mn = Q)fXn +n mn (Q)
and recalling that Xn + n mn = , the above expression becomes:

(5.225)

1
2 ESc ()
=
0
n
1c

Z

Qc ()
mn
n

fM| (m| = Qc ())f (Qc ())dm


=

f (Qc ()) Qc ()
E {M0 | = Qc ()}
1c
n
f (Q ())
c
E {Mn M0 | = Qc ()} .
1c

(5.226)

Recalling (5.188, AM 2005) and using vector notation we obtain:


f (Qc ())
2 ESc ()
=
E {M|0 M = Qc ()} E {M0 |0 M = Qc ()}
0

1c
f (Q ())
c
E {MM0 |0 M = Qc ()}
1c
f (Q ())
= c
Cov {M|0 M = Qc ()} .
1c

(5.227)

E 232 Expected shortfall in elliptical markets I


Assume that the market is multivariate Student t distributed:
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:
0 M St (, 0 , 0 ) ,

(5.229)

or:
d

= 0 +

0 X ,

(5.230)

where:
X St (, 0, 1) .

(5.231)

From (5.207, AM 2005) we obtain:


1
ESc () =
1c
and thus:

Z
0

1c

1
Q (s) ds =
1c

Z
0

1c

i
h

0 + 0 QX (s) ds .

(5.232)

CHAPTER 5. EVALUATING ALLOCATIONS

187

ESc () = 0 +

0 c ,

(5.233)

QX (s) ds .

(5.234)

where:
1
c
1c

1c

This scalar can be evaluated as the numerical integral of the quantile function of the standard univariate t
distribution.


E 233 Expected shortfall in elliptical markets II (see E 232)


Consider the same setup than in E 232. Factor ESc () in terms of its marginal contributions.
Hint. Compare with (5.236, AM 2005).
Solution of E 233
Deriving (5.233) we obtain:
ESc ()
c
=+
.

(5.235)

Therefore the marginal contributions C read:

C diag ()

ESc ()
c
= diag () +
diag () .

(5.236)

It is immediate to check that:

ESc ()

N
X

Cn ,

(5.237)

n=1

see (5.67, AM 2005).

E 234 Expected shortfall in elliptical markets III (see E 232)


R
Consider the same setup than in E 232. Assume N 40 and 5. Write a MATLAB
script in which
you:
Generate randomly the parameters (, ) and the allocation ;
Generate J 10,000 Monte Carlo scenarios from the market distribution (5.228);
Set c 0.95 and compute ESc () as the sample counterpart of (5.208, AM 2005);
Compute the marginal contributions to ESc () from each security as the sample counterpart of
(5.238, AM 2005);
Display the result in a subplot using the built-in plotting function bar;
Use the previous results to compute ESc () in a different way, i.e. semi-analytically. Never at any
stage use simulations;
Compute the marginal contributions to ESc () from each security using previous results. Never at
any stage use simulations. Display the result in a second subplot using the built-in plotting function
bar.

R
Hint. Use the built-in MATLAB
numerical integration function
tinv.

quad

Solution of E 234
R
See the MATLAB
script S_ESContributionsStudentT.

applied to the quantile function

E 235 Expected shortfall and linear factor models


Assume a linear factor model for the market:
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
ln (U + a)


St (, , ) ,

(5.239)

where 0, a is such that E {U} 0 and:




f
0

0
2 u


,

(5.240)

with f a correlation matrix and u a Toepliz correlation matrix:


un,m e|nm| ,

(5.241)

R
with   1 and arbitrary. Assume N 30, K 10 and 10. Write a MATLAB
script in which
you:
Generate randomly the parameters in and the allocation ;
Generate J 10,000 Monte Carlo scenarios from the market distribution (5.238);
Set c 0.95 and compute ESc () as the sample counterpart of (5.208, AM 2005);
Compute the K marginal contributions to ESc () from each factor and the one aggregate contribution from all the residuals, as the sample counterpart of (5.238, AM 2005) adapted to the factors;
Display the result in a subplot using the built-in plotting function bar.

Hint. Represent the objective as a linear function:


F + u .

Solution of E 235
R
See the MATLAB
script S_ESContributionsFactors.

(5.242)

E 236 Simulation of the investors objectives


Assume a bivariate market, where the prices at the investment horizon (P1 , P2 ) have the following
marginal distributions:

CHAPTER 5. EVALUATING ALLOCATIONS

189

P1 Ga(1 , 12 )
P2

(5.243)

LogN(2 , 22 ) .

(5.244)

Assume that the copula is lognormal, i.e. the grades (U1 , U2 ) of (P1 , P2 ) have the following joint distribution (not a typo, why?):


1 (U1 )
1 (U2 )


N

 

1
,
,
1

0
0

(5.245)

where denotes the cdf of the standard normal distribution. Assume that the current prices are p1
E {P1 } and p2 E {P2 }.
R
Write a MATLAB
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
R
See the MATLAB
script S_InvestorsObjective.

E 237 Arrow-Pratt aversion and prospect theory


Consider the prospect-theory utility function:

u () a + b erf


,

(5.246)

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:
2
d
2
erf (x) = ex .
dx

(5.247)

Hence:

u0 () b

2
e

2

2

(5.248)

and:

u00 ()

2b 1
e


.

(5.249)

Therefore:

A ()

u00 ()
0
=
.
0
u ()

For the interpretation of this result see (5.124, AM 2005) and comments thereafter.

(5.250)


Chapter 6

Optimizing allocations
E 238 Feasible set of the mean-variance efficient frontier (www.6.1) *
Show that in the plane (6.29, AM 2005), the budget constraint (6.24, AM 2005) is satisfied by all the
points in the region to the right of the hyperbola (6.30, AM 2005)-(6.31, AM 2005)
Solution of E 238
See E 242.

E 239 Maximum achievable certainty-equivalent with exponential utility I (www.6.1)


Prove the expression (6.39, AM 2005) of the optimal allocation leading to the maximum achievable
certainty-equivalent index of satisfaction with exponential utility.
Solution of E 239
From the expression (6.21, AM 2005) of the satisfaction index, which we report here:
CE() 0

1 0
,
2

(6.1)

and the constraint (6.24, AM 2005) we obtain the Lagrangian:


L 0

1 0
(0 pT wT ) .
2

(6.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:
= 1 + 1 pT ,

(6.4)

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 }
,
E {SR } E {M V }

(6.5)

we rewrite (6.97, AM 2005) as follows:

wT 1
wT 1 pT
+
(1

)
.
p0T 1
p0T 1 pT

(6.6)

By comparing (6.4) with (6.6) we obtain:

0 1
p ,
wT T

(6.7)

and thus:

= (1 )

wT p0T 1
wT
=
.
1
p0T pT
p0T 1 pT

(6.8)

Substituting this expression back into (6.4) we obtain the optimal allocation:

= 1 +

wT p0T 1 1
pT .
p0T 1 pT

(6.9)

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.


E 240 Maximum achievable certainty-equivalent with exponential utility II (www.6.1)


(see E 239)
Consider the same setup than in E 239. Prove the expression (6.39, AM 2005) of the maximum level of
satisfaction.

CHAPTER 6. OPTIMIZING ALLOCATIONS

193

Solution of E 240
We replace (6.9) in (6.1):


1 0
0

CE( )
2


wT p0T 1 1
= 0 1 +

p
T
p0T 1 pT
0

1
wT p0T 1 1

1 +
T
2
p0T 1 pT


wT p0T 1 1
1
+
pT
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

(6.11)

Therefore:
1

CE( ) = 0 1 +
2
2

wT p0T 1
p0T 1 pT

0 1 pT

1 (wT p0T 1 )2
.

2
p0T 1 pT

(6.12)

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

Az = a
s.t.
z0 S(j) z + 2u0(j) z + v(j) 0 ,
for j = 1, . . . , J, can be written equivalently as follows:

(6.13)



2

1/2 0
1/2 0
1
z argmin (0) E(0) z + (0) E(0) u(0) + v(0) u(0) S(0) u(0)
z
(
Az = a
2

s.t.

1/2 0
1/2
(j) E(j) z + (j) E0(j) u(j) u(j) S1
(j) u(j) v(j) ,

(6.14)

for j = 1, . . . , J. This problem in turn is equivalent to:



2 

1/2 0
1/2 0
z argmin (0) E(0) z + (0) E(0) u(0)
z
(
Az = a
2

s.t.
1/2 0

1/2
(j) E(j) z + (j) E0(j) u(j) u(j) S1
(j) u(j) v(j) ,

(6.15)

for j = 1, . . . , J. Introducing a new variable t this problem is equivalent to:


(z , t ) argmin {t}
(z,t)

s.t.

Az = a


1/2 0

1/2
(0) E(0) z + (0) E0(0) u(0) t
q


1/2 0
1/2
(1) E(1) z + (1) E0(1) u(1) u(1) S1
(1) u(1) v(1)
..
.
q
1/2 0

1/2
(J) E(J) z + (J) E0(J) u(J) u(J) S1
(J) u(J) v(J) .

(6.16)

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}
c = 0 d .

(6.17)

In turn, this is true if we can solve the following system for an arbitrary value of e:


E {Mj }
dj

E {Mk }
dk



j
k


=

P

e n6=j,k n E {Mk }
P
.
c n6=j,k n dn

(6.18)

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(, , ) Var { } (0 d c) (E { } e)
= 0 Cov {M} (0 d c) (0 E {M} e) .

(6.19)

The first-order conditions yield:

0=

L
= 2 Cov {M} d E {M} ,

(6.20)

in addition to the two constraints:


L
= 0 d c

L
0=
= 0 E {M} e ,

0=

(6.21)

From (6.20) the solution reads:

1
1
Cov {M} d + Cov {M} E {M} .
2
2

(6.22)

The Lagrange multipliers can be obtained as follows. First, we define four scalar constants:
1

E {M}

(6.24)

(6.25)

A d0 Cov {M}
B d0 Cov {M}
0

(6.23)

C E {M} Cov {M}

E {M}

D AC B .

(6.26)

Left-multiplying the solution (6.22) by d0 and using the first constraint in (6.21) we obtain:
c = d0 =

1
1
d Cov {M} d + d0 Cov {M} E {M} = A + B .
2
2
2
2

(6.27)

Similarly, left-multiplying the solution (6.22) by E {M} and using the second constraint in (6.21) we
obtain:
0

e = E {M} =

0
1
0
1
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
,
D

2eA 2cB
.
D

(6.29)

Finally, left-multiplying (6.20) by 0 we obtain:


0 = 20 Cov {M} 0 d 0 E {M}
= 2 Var { } c e


cC eB
eA cB
= 2 Var { }
c
e .
D
D

(6.30)

This shows that the boundary v(e) Var { } exists. Collecting the terms in e we obtain its align:

v=

A 2 2cB
c2 C
e
e+
,
D
D
D

(6.31)

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:

d2 =

c2 C
A 2 2cB
e
e+
.
D
D
D

(6.32)

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
eA cB
1
1
Cov {M} d +
Cov {M} E {M}
D
D
1
1
(cC eB)A Cov {M} d
(eA cB)B Cov {M} E {M}
=
+
.
1
1
D
D
d0 Cov {M} d
d0 Cov {M} E {M}

(6.33)

If c 6= 0 we can write (6.33) as:


= (1 ())M V + ()SR ,

(6.34)

where the scalar is defined as:

()

(E { } A cB)B
,
cD

(6.35)

and (M V , SR ) are two specific portfolios defined as follows:


1

M V

c Cov {M}
d0

Cov {M}

SR

c Cov {M}
d0

Cov {M}

E {M}

(6.36)

d
E {M}

(6.37)

CHAPTER 6. OPTIMIZING ALLOCATIONS

197

As for the expression of the scalar in (6.35), since:

E {SR } E {M V } =

cC
cB
cD

=
B
A
AB

(6.38)

we can simplify it as follows:


E { } AB
B2
(E { } A cB)B
=

cD
cD
D
( cB
)
E { }
A
cD
=
E {SR } E {M V } ( AB
)

(6.39)

E { } E {M V }
,
E {SR } E {M V }

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:

v=

A 2
e ,
D

(6.40)

whereas in the space of coordinates (s, e) = (Sd { } , E { }) the boundary degenerates from the
hyperbola (6.32) into two straight lines:
r
d(e) =

A
e.
D

(6.41)

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:
= lim [M V + ()(SR M V )]
c0

= lim [()(SR M V )]
c0

Cov {M}
= E { }
(A E {M} Bd)
D
1
= () Cov {M} (A E {M} Bd) ,

(6.42)

where the scalar is defined as follows:

()

E { }
.
D

(6.43)

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:
(1 )M V + SR

> 0.

(6.44)


E 244 Least-possible variance allocation (www.6.3) (see E 242)


Consider the same setup than in E 242. Show that M V in (6.99, AM 2005) is the allocation that displays
the least possible variance.
Solution of E 244
Portfolio (6.36) corresponds to the case = 0. From the expression for in (6.35) and from the expression for the Lagrange multipliers in (6.29) we see that M V is the allocation that corresponds to the
case where the Lagrange multiplier is zero in (6.22). From the original Lagrangian (6.19), if = 0 the
ensuing allocation is the minimum-variance portfolio. From (6.31), or by direct computation we derive
the coordinates of M V in the space of moments:

vM V Var {M V } =

c2
,
A

eM V E {M V } =

cB
.
A

(6.45)


E 245 Highest-possible Sharpe ratio allocation (www.6.3) (see E 242)


Consider the same setup than in E 242. Show that SR in (6.100, AM 2005) is the allocation that displays
the highest possible Sharpe ratio.
Solution of E 245
Portfolio (6.37) corresponds to the case = 1. This is the allocation on the feasible boundary that
corresponds to the highest Sharpe ratio. Indeed, by direct computation we derive the coordinates of SR
in the space of moments:

vSR Var {SR } =

c2 C
,
B2

eSR E {SR } =

cC
,
B

(6.46)

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:
SR(e)

e
e
=q
d(e)
A 2
2cB
De D e +

(6.47)

c2 C
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

E 246 Geometry of the mean-variance efficient frontier (www.6.3) (see E 242)


Consider the same setup than in E 242. Show that in the risk/reward plane (6.101, AM 2005), the allocation SR represents the intersection of the efficient frontier with the straight line though the origin and
the minimum variance portfolio.
Solution of E 246
It is immediate to check that the ratio e/v is the same for both portfolio (6.45) and portfolio (6.46), and
thus the two allocations lie on the same radius from the origin in the (v, e) plane.


E 247 Reformulation of the efficient frontier with linear constraints (www.6.3)


(see E 242)
Consider the same setup than in E 242. Show that the solutions of (6.107, AM 2005) are more easily
parametrized as in (6.109, AM 2005)-(6.110, AM 2005).
Solution of E 247
If c = 0 the mean-variance curve (6.97, AM 2005) reads:
1

Cov {M}

(E {M} d)
1

d0 Cov {M}

sign(B) > 0 .

E {M}

(6.48)


E 248 Effect of correlation on the mean-variance efficient frontier: total correlation 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:

1 =

c
b2
2 ,
b1
b1

(6.49)

c
,
b1

(6.50)

which corresponds to the feasible set. Defining:

2 ,

e
c

eb b2 .
b1

The investors objective reads:


= 1 M1 + 2 M2 = (e
c eb)M1 + M2 = e
cM1 + (M2 ebM1 ) .

(6.51)

Its expected value reads:


e E { } = e
c E {M1 } + (E {M2 } eb E {M1 }) .
For the standard deviation we have the general expression:

(6.52)

d2 [Sd { }] = 0 Cov {M}


2
2
= (e
c eb)2 [Sd {M1 }] + 2 [Sd {M2 }] + 2(e
c eb) Sd {M1 } Sd {M2 } ,

(6.53)

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)

and a full allocation in the second asset, which corresponds to = e


c/eb:
e(2) =

e
c
E {M2 } ,
eb

d(2) =

e
c
Sd {M2 } .
eb

(6.55)

Without loss of generality, we make the assumption:


e(1) < e(2) ,

d(1) < d(2) .

(6.56)

In this notation we can more conveniently re-express the expected value (6.52) of a generic allocation as
follows:

e = e(1) +

eb (2)
(e e(1) ) .
e
c

(6.57)

As for the standard deviation (6.53) we obtain:

d =

eb
1
e
c

!2

h
i2
d(1) +

eb
e
c

!2

h
i2
eb
d(2) + 2 1
e
c

eb (1) (2)
d d ,
e
c

(6.58)

Solution of E 248
If = 1, (6.58) simplifies to:
"
2

d =

eb
1
e
c

!
(1)

eb (2)
+
d
e
c

#2
,

(6.59)

which as long as:

d(1)
e
c
,
d(2) d(1) eb

(6.60)

in turn simplifies to:

d=

eb
1
e
c

!
d(1) +

eb (2)
d .
e
c

(6.61)

CHAPTER 6. OPTIMIZING ALLOCATIONS

201

This expression coupled with (6.57) yield the allocation curve:

e = e(1) + (d d(1) )

e(2) e(1)
,
d(2) d(1)

(6.62)

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 = e(1) d(1)

e(2) e(1)
< e(1) .
d(2) d(1)

(6.63)

From (6.60) that this situation corresponds to a negative position in the second asset.

E 249 Effect of correlation on the mean-variance efficient frontier: total anticorrelation case (www.6.4) (see E 248)
Consider the same setup than in 248. Show that, in the case of a bivariate market with total anticorrelation, 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.118, AM 2005).
Solution of E 249
If = 1, (6.58) simplifies to:
"
2

d =

eb
1
e
c

!
(1)

eb (2)

d
e
c

#2
,

(6.64)

which as long as:

e
c
d(1)
,
(1)
(2)
e
d +d b

(6.65)

in turn simplifies to:

d = d(1) +

eb (1)
(d + d(2) ) .
e
c

(6.66)

This expression coupled with (6.57) yield the allocation curve in the case = 1:

e = e(1) + (d + d(1) )

e(2) e(1)
.
d(2) + d(1)

(6.67)

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 = e(1) + d(1)

e(2) e(1)
> e(1) .
d(1) + d(2)

(6.68)

Note. From (6.65) the allocation in the second asset is positive and from (6.49) so is the allocation in the
first asset:

1 = e
c 1

d(1)
d(1) + d(2)


.

(6.69)


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:

Var {e } =

2wT B
w2 C
A
2
E {e }
E {e } + T
D
D
D

(6.70)

which can be re-written as follows:





A 
Var
Var { } + 2 Cov {e , } = (E
+ E { })2
e
e
D
(6.71)

2wT B 
wT2 C

(E
+
E
{
})
+
.

e
D
D
Expanding the products and rearranging, we obtain:
2


A 
Var
= 2 Cov {e , } + E
e
e
D



2A
2wT B
+ E
E { }
e
D
D
A
2wT B
w2 C
2
+ E { }
E { } + T + Var { } .
D
D
D

(6.72)

From (6.94, AM 2005), (6.99, AM 2005) and (6.100, AM 2005) we obtain for a generic allocation :

E { } E {M V }
=
E {SR } E {M V }
=
=

E { }

wT E{PT + }0 Cov{PT + }1 pT
p0T Cov{PT + }1 pT

wT E{PT + }0 Cov{PT + }1 E{PT + }


p0T Cov{PT + }1 E{PT + }
wT B
A
wT B
A

E { }
wT C
B

wT E{PT + }0 Cov{PT + }1 pT
p0T Cov{PT + }1 pT

(E { } wTAB )BA
wT D

(E { } + E { })BA wT B 2
.
wT D
(6.73)

Using this result, from (6.175, AM 2005) and the budget constraint 0 pT = wT the covariance reads:

CHAPTER 6. OPTIMIZING ALLOCATIONS



E {e } E {M V }
Cov { , e } = Cov {PT + } M V +
(SR M V )
E {SR } E {M V }


wT 0 pT
E {e } E {M V }
wT 0 E {PT + } wT 0 pT
=
+

A
E {SR } E {M V }
B
A



2 
2
(E

+
E
{
})BA

w
B
w
E { } wT

T
e

= T +

.
A
D
B
A

203

(6.74)

Substituting (6.73) in (6.74) we obtain:


"




#
(E
+ E { })BA wT B 2 E { } wT
wT2
e
Var
= 2
+

e
A
D
B
A



2A
2
A 
2wT B
+ E
+ E
E { }
e
e
D
D
D
2
A
2wT B
w C
2
+ E { }
E { } + T + Var { }
D
D
D



2 E
BA E { } wT
2wT2
e
(6.75)

=
A
D
B
A




2 E { } BA E { } wT
2wT B 2 E { } wT

D
B
A
D
B
A


2

2A
A 
2wT B
+ E
+ E
E { }
e
e
D
D
D
2
A
2wT B
w C
2
+ E { }
E { } + T + Var { } .
D
D
D


The first-degree terms in E
cancel, and other terms simplify to yield the following expression:
e






2
A 
2
2B 2
C
2
Var
=
E

+
w

e
e

T
D
D A
DA
A
2wT B
2
E { } +
E { } + Var { } .
D
D

(6.76)

From the definition of D in (6.194, AM 2005) this simplifies further into:




2 wT2 C
A 
A
2
Var
=
E

E { }
e
e
D
D
D
2wT B
+
E { } + Var { } ,
D

(6.77)



2
A 
Var
=
E
+ ,
e
e
D

(6.78)

or:

where:

Var { }

A
2wT B
w2 C
2
E { } +
E { } T .
D
D
D

(6.79)

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:

Var { } =

A
2
E { } ,
D

(6.80)

and the linearity of the objective = we obtain:


Var { } = 2 Cov { , } Var { }
A
2
2
+ (E { } + E { } 2 E { } E { }) ,
D

(6.81)

From (6.194, AM 2005), (6.99, AM 2005) and (6.100, AM 2005) we obtain for a generic allocation :
E { } E { }
=
E {SR } E {M V }

E { } E { }
0
1
pT
wT E{PT + }0 Cov{PT + }1 E{PT + }
T + } Cov{PT + }
wT E{P
p0T Cov{PT + }1 E{PT + }
p0T Cov{PT + }1 pT

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:

Cov { , } = 0 Cov {PT + } +

E { } E { }
(SR M V )
E {SR } E {M V }

= Var { }


E { } E { }
wT 0 E {pT + } wT 0 pT

E {SR } E {M V }
B
A


(E { } E { })BA E { } wT
= Var { } +

.
D
B
A
+

Substituting this into (6.82) and simplifying we obtain:

(6.83)

CHAPTER 6. OPTIMIZING ALLOCATIONS

Var { } =

205

A
2BwT
w2 C
2
E { }
E { } + T + ,
D
D
D

where is defined in (6.79).

(6.84)


E 252 Formulation of mean-variance in terms of returns I (www.6.6)


Show that, under assumption (6.82, AM 2005)-(6.83, AM 2005), the mean-variance frontier (6.68, AM
2005) can be expressed as (6.85, AM 2005).
Solution of E 252
If the investor has a positive initial budget wT > 0, then maximizing E { } in the original meanvariance problem is equivalent to maximizing E { } /wT . On the other hand, as Var {WT + } spans
all the real numbers v, so does Var { } /wT2 . Therefore, given that initial wealth wT is not a random
variable and given the definition of linear return on wealth (6.81, AM 2005), the original mean-variance
problem is equivalent to (6.85, AM 2005)


E 253 Formulation of mean-variance in terms of returns II (www.6.6) (see E 252)


Consider the same setup than in E 252. Show that (6.85, AM 2005) can be expressed as (6.88, AM 2005).
Solution of E 253
First notice that the linear return on wealth is a function of relative weights and linear returns on securities:
PN
(n)
n PT +
WT +
= n=1
wT
wT
(n)
N
N
(n)


X n P
X
PT +
(n)
T
=
=
w
1
+
L
n
(n)
wT
pT
n=1
n=1

1 + L

(6.85)

= 1 + w0 L ,
where we have used the budget constraint 0 pT = wT and the following identity:
N
X

N
(n)
X
n pT
wn =
= 1.
0 pT
n=1
n=1

(6.86)

Therefore for the expected value we have:




E L = E {w0 L} = w0 E {L} .

(6.87)

Similarly, for the variance we obtain:




Var L = Var {w0 L} = w0 Cov {L} w .

(6.88)

Therefore, due to (6.87) and (6.88) problem (6.85, AM 2005) reads:


(v)

argmax
C
w0 () Cov{L}w()=v

w0 () E {L} ,

(6.89)

where w as a function of is obtained by inverting (6.86, AM 2005). On the other hand, it is easier to
convert the constraints C that hold for into constraints that hold for w (for ease of exposition we keep
denoting them as C) and then maximize (6.89) with respect to w:
w(v)

argmax

w0 E {L} ,

(6.90)

wC
w0 Cov{L}w=v

The original mean-variance curve is simply (v) (w(v)) obtained from (6.86, AM 2005).

E 254 Mean-variance pitfalls: two-step approach I


Assume a market of N 4 stocks and all possible zero-coupon bonds. The weekly compounded returns
of the stocks are market invariants with the following distribution:
Ct,e N(, ) .

(6.91)

R
Write a MATLAB
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
R
See the MATLAB
script S_MeanVarianceOptimization.

E 255 Mean-variance pitfalls: two-step approach II (see E 254)


Consider the same setup than in E 254. Assume that the weekly changes in yield to maturity for the
bond market are fully codependent, i.e. co-monotonic. In other words, assume that the copula of any
pairs of weekly yield changes is (2.106, AM 2005). Also, assume that they have the following marginal
distribution:

e Y

()


N 0,

20 + 1.25
10, 000

2 !
,

(6.92)

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
R
the current yield curve, as defined in (3.30, AM 2005) in Meucci (2005) is flat at 4%. Write a MATLAB
script in which you:
Produce joint simulations of the four stock and five bond prices at the investment horizon of four
weeks;
Assume that the investor considers as his market one single bond with time to maturity five
weeks and all the stocks;
Determine numerically the mean-variance inputs, namely expected prices and covariance of prices
(not returns);
Determine analytically the mean-variance inputs, namely expected prices and covariance of prices
(not returns) and compare with their numerical counterpart;
Assume that the investors objective is final wealth. Suppose that his budget is wT 100. Assume
that the investor cannot short-sell his securities, i.e. the allocation vector cannot include negative
entries. Compute the mean-variance efficient frontier as represented by a grid of 40 portfolios

CHAPTER 6. OPTIMIZING ALLOCATIONS

207

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 investors 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 framework.
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,
R
AM 2005): use the MATLAB
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
R
See the MATLAB
script S_MeanVarianceOptimization.

E 256 Mean-variance pitfalls: horizon effect (see E 255)


R
Consider the stock market described in E 255 and the investment horizon of one day. Write a MATLAB
script in which you:
Determine analytically the mean-variance inputs in terms of weights and returns, namely expected
linear returns and covariance of linear returns and compare with their numerical counterpart;
Assume that the investors objective is final wealth. Suppose that the budget is b 100. Assume
that the investor cannot short-sell the securities, i.e. the allocation vector cannot include negative
entries. Compute the mean-variance efficient frontier in terms of portfolio weights as represented
by a grid of 40 portfolios whose expected linear returns are equally spaced between the expected
value of the linear return on the minimum variance portfolio and the largest expected value among
the linear returns of all the securities;
Assume that the investors satisfaction is the certainty equivalent associated with an exponential
function:

u() e ,

(6.94)

where 10. Compute the optimal allocation according to the two-step mean-variance framework;
Repeat the above steps an the investment horizon of four years.
Solution of E 256
R
See the MATLAB
script S_MeanVarianceHorizon.

E 257 Benchmark driven allocation I (see E 255)


Consider the same market than in E 255, namely one single bond with time to maturity five weeks
R
and all the stocks. Write a MATLAB
script in which you:
Produce joint simulations of the four stock and the one bond prices at the investment horizon of
four weeks;
Determine numerically the mean-variance inputs in terms of weights and returns, namely expected
linear returns and covariance of linear returns;

Determine analytically the mean-variance inputs in terms of weights and returns, namely expected
linear returns and covariance of linear returns and compare with their numerical counterpart.
Solution of E 257
For the benchmark-driven investor, the objective is (6.170, AM 2005) or:
0 KPT + ,

(6.95)

where:

KI

pT 0
,
0 pT

(6.96)

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 +
=
1
1
0 pT
0 pT

(6.97)

= 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:
(e)

argmin
0 pT b
0
E{L L }=e

argmin
0 pT b
0
E{L L }=e

argmin
0

pT b
0
E{L L }=e

{Var{L L }}

{Var{L } + Var{L } 2 Cov{L , L }}


(6.98)
1
{ Var{L } 2 Cov{L , L }} .
2

Using 6.85 we obtain in terms of the portfolio weights w, the benchmark weights wb , and the securities
returns L:

w(e) argmin
w0 11
w0
0
w E{L}=e

1 0
w Cov{L}w wb0 Cov{L}w
2

R
This is the input for the MATLAB
script S_MeanVarianceBenchmark.


.

(6.99)

CHAPTER 6. OPTIMIZING ALLOCATIONS

209

E 258 Benchmark driven allocation II (see E 255)


R
Consider the same setup than in E 255. Write a MATLAB
script in which you:
Assume first that the investors objective is final wealth. Suppose that the budget is b 100.
Assume that the investor cannot short-sell the securities, i.e. the allocation vector cannot include
negative entries;
Compute the mean-variance efficient frontier in terms of portfolio weights as represented by a grid
of 40 portfolios whose expected linear returns are equally spaced between the expected value of the
linear return on the minimum variance portfolio and the largest expected value among the linear
returns of all the securities;
Now assume that the investors objective is wealth relative to an equal-weight benchmark, i.e. a
benchmark that invests an equal amount of money in each security in the market;
Compute the mean-variance efficient frontier in terms of portfolio weights as represented by a grid
of 40 portfolios whose expected linear returns are equally spaced between the expected value of the
linear return on the minimum variance portfolio and the largest expected value among the linear
returns of all the securities;
Project the two efficient frontiers computed above in the expected outperformance/tracking error
plane.

Solution of E 258
R
See the MATLAB
script S_MeanVarianceBenchmark.

E 259 Mean-variance for derivatives


Consider a market of at-the-money call options on the underlyings whose daily time series are provided
in the database DB (30, 91 and 182 are the time to expiry). Assume that the investment horizon is two
R
days. Write a MATLAB
script in which you:
Fit a normal distribution to the invariants, namely the log-changes in the underlying in and the
log-changes in the respective at-the-money implied volatilities;
Project this distribution analytically to the horizon;
Generate simulations for the sources of risk, namely underlying prices and implied volatilities at
the horizon;
Price the above simulations through the full Black-Scholes formula, assuming no skewness correction for the implied volatilities and a constant risk-free rate at 4%;
Compute the distribution of the linear returns, as represented by the simulations: 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;
Compute numerically the mean-variance inputs;
Compute the mean-variance efficient frontier in terms of relative weights, assuming the standard
long-only and full investment constraints;
Plot the efficient frontier in the plane of weights and standard deviation.
Solution of E 259
R
See the MATLAB
script S_MeanVarianceCalls.

E 260 Dynamic strategies


Assume there are two securities: a risk free asset whose value evolves deterministically with an exponential growth at a constant rate r:
ln Dt+t = ln Dt + rt ,

(6.100)

and a risky asset whose value Pt follows a geometric Brownian motion with drift and volatility :

2
= ln Pt +
2


ln Pt+t

t + tZt ,

(6.101)

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, ]:
(t , t )t[0, ] ,

(6.103)

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)

and the strategy must be self-financing, i.e. whenever a rebalancing occurs:


(t , t ) 7 (t+t , t+t ) ,

(6.105)

St+t t Pt+t + t Dt+t t+t Pt+t + t+t Dt+t ,

(6.106)

the following must hold true:

The strategy (6.103) determined equivalently by the weights:

wt

t Pt
,
St

ut

t Dt
,
St

(6.107)

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:

wt+t + ut+t =

t Pt+t + t Dt+t
t Pt+t + t Dt+t
=
= 1,
St+t
t Pt+t + t Dt+t

(6.109)

CHAPTER 6. OPTIMIZING ALLOCATIONS

211

and:

w
et+t + u
et+t =

t+t Pt+t + t+t Dt+t


t+t Pt+t + t+t Dt+t
=
= 1.
St+t
t+t Pt+t + t+t Dt+t

(6.110)


E 261 Buy and hold


Consider the buy & hold strategy, that invests the budget (6.102) in the two securities and never reallocates
throughout the investment period [0, ]:
t ,

t .

(6.111)

R
Write a MATLAB
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, 2t, . . . , ];
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
R
See the MATLAB
script S_BuyNHold.

E 262 Utility maximization I


Consider the constant weight strategy, that invests the budget (6.102) in the two securities and keeps the
weight of the risky security constant throughout the investment period [0, ]:
wt w .

(6.112)

Prove that this strategy maximizes the expected final utility:

w()
argmax (E {u(S )}) ,

(6.113)

S0 ,w() C

where u is the power utility function:

u(s) =

s
,

(6.114)

with < 1.
Hint. The strategy evolves as:
dSt
= (r + wt ( r))dt + wt dBt .
St

(6.115)

and the final value is lognormally distributed:


S = S0 e

Yw()

(6.116)

where Y is a normal:
Yw() N(mw() , s2w() ) ,

(6.117)

with expected value:

mw() r +
0


2 2
( r)wt
w dt
2 t

(6.118)

and variance:

s2w() =

2 wt2 dt .

(6.119)

Hint. See Meucci (2010d).


Solution of E 262
From (6.116) we obtain:

E {u(S )} =

S0
Y
E{e w() } .

(6.120)

Since Yw() is normally distributed with expected value (6.118) and variance (6.119), it follows that eY
is lognormally distributed and thus from (1.98, AM 2005) we obtain:

E{e

Yw()

}=e


mw() + 2 s2w

()

(6.121)

Therefore, substituting (6.118) and (6.119), the optimal strategy (6.113) solves:

w()
argmax
w()

Z

wt ( r) wt2

 
2
(1 ) dt .
2

(6.122)

The solution to this problem is the value that maximizes the integrand at each time. Therefore, the solution
is the constant:

w()
w

1 r
.
1 2

(6.123)


CHAPTER 6. OPTIMIZING ALLOCATIONS

213

E 263 Utility maximization II (see E 262)


R
Consider the same setup than in E 262. Write a MATLAB
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, 2t, . . . , ];
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 constant weight strategy (6.112);
Plot the (non) 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 constant weight strategy (6.112) over the payoff of the risky
asset, and verify that the profile is concave.

Solution of E 263
R
See the MATLAB
script S_UtlityMax.

E 264 Constant proportion portfolio insurance


Consider the CPPI strategy, that invests the budget (6.102) as follows. First we specify a deterministically
increasing floor Ft that satisfies the budget constraint:
F0 S0 ,

(6.124)

and grows to a guaranteed value H at the horizon:


Ft Her( t) ,

t [0, ] .

(6.125)

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 strategys weight for the risky asset:

w wt

mCt
w.
St

(6.127)

R
Write a MATLAB
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, 2t, . . . , ];
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
R
See the MATLAB
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
p Gr = 0 ,
+
r+
t
p
2 p2

(6.129)

G(, p) s(p) p > 0 ,

(6.130)

with boundary condition:

Prove that a strategy that invests an initial budget:


S0 G(0, P0 )

(6.131)

and allocates dynamically the following weight in the risky asset:

wt

Pt G(t, Pt )
,
St Pt

(6.132)

provides the desired payoff (6.128).


Hint. The strategy evolves as:
dSt
= (r + wt ( r))dt + wt dBt .
St

(6.133)

Solution of E 265
We want to prove that the following identity holds at all times, and in particular at t :
St G(t, Pt ) t [0, ] .

(6.134)

Indeed, using Itos rule on G((t, Pt ), where Pt follows the geometric Brownian motion (6.101) yields:
G
1 2G
G
dt +
dPt +
(dPt )2
t
Pt
2 Pt2
G
1 2G 2 2
G
dt +
(Pt dt + Pt dB) +
Pt dt
=
t
Pt
2 Pt2


G
G
1 2G 2 2
G
=
+
Pt +
Pt dt +
Pt dBt .
2
t
Pt
2 Pt
Pt

dGt =

(6.135)

CHAPTER 6. OPTIMIZING ALLOCATIONS

215

Also, from (6.133) and (6.132) we obtain:





dPt
dSt = St rdt + St wt
rdt
Pt


G dPt
= St rdt + Pt
rdt
Pt Pt
G
= St rdt +
(Pt dt + Pt dBt Pt rdt) .
Pt

(6.136)


G
G
1 2G 2 2
G
d(Gt St ) =
+
Pt +
Pt dt +
Pt dBt
t
Pt
2 Pt2
Pt
G
St rdt
(Pt dt + Pt dBt Pt rdt)
Pt


G
G 1 2 G 2 2
+

S
r
+
=
P
r
dt .
t
t
t
t
2 Pt2
Pt

(6.137)

Therefore:


Using (6.129) we finally obtain:


d(Gt St )
= rdt ,
(Gt St )

(6.138)

(G S ) = (G0 S0 )er .

(6.139)

Which means:

Since from (6.131) we have G0 S0 = 0, it follows that (6.134) holds true.

E 266 Option based portfolio insurance II (see E 265)


Consider the same setup than in E 265. Assume that the payoff (6.128) is that of a call option with strike
K:
s(p) max(0, p K) .

(6.140)

In this context the partial differential align (6.129) was solved in Black and Scholes (1973):
G(t, p) = p(d1 ) er( t) K(d2 ) ,

(6.141)

where is the cdf for the standard normal distribution and:



p
2
ln( ) + (r +
)( t)
K
2

d2 (t, p) d1 (t, p) t .

1
d1 (t, p)
t

(6.142)

From the explicit analytical expression (6.141) we can derive the expression for the weight (6.132) of the
risky asset:

wt =

Pt
(d1 (t, Pt )) .
St

(6.143)

R
Write a MATLAB
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, 2t, . . . , ];
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
R
See the MATLAB
script S_OptionReplication.

Chapter 7

Estimating the distribution of the


market invariants
E 267 Mahalanobis square distance of normal random variables (www.7.1) *
Show that when X N(, ), we have:
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:

p
qN

q
Q2N (p) .

(7.2)

Solution of E 267
Consider the spectral decomposition (3.149, AM 2005) of the covariance matrix:
EE0 ,

(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:
E (E(1) , . . . , E(N ) ) .

(7.5)

Now consider the new random variable:


1

Y 2 E0 (X ) .
217

(7.6)

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

On the other hand:


N
X

Yn2 = Y0 Y

n=1

i0 h
i
h
1
1
= 2 E0 (X ) 2 E0 (X )

(7.9)

= (X )0 E1 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:
Ma2 (X, , ) (X )0 1 (X ) 2N ,

(7.10)

From the definition (1.7, AM 2005) of cdf:




F2N (q) P Ma2 (X, , ) q


= P (X )0 1 (X ) q .

(7.11)

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:

p
qN

q
Q2N (p) .

(7.13)

Therefore, from the definition of the ellipsoid:




q
E,
X such that (X )0 1 (X ) q 2 ,

(7.14)

n
p o
qN
P X E,
= p.

(7.15)

we obtain:

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

219

E 268 Normal-inverse-Wishart location-dispersion: posterior distribution (www.7.2) **


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:
1 W(0 , (0 0 )1 ) ,

(7.16)

| N(0 , (T0 )1 ) .

(7.17)

and:

Thus from (2.156, AM 2005) and (2.224, AM 2005) the joint prior pdf of and is:
fpr (, ) = fpr (|)fpr ()
1

= 1 || 2 e 2 (0 ) (T0 )(0 ) |0 |

0
2

||

0 N 1
2

e 2 tr(0 0 ) .

(7.18)

As for the pdf of current information (7.13, AM 2005), from (4.102, AM 2005) the sample mean is
normally distributed:
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
b conditioned on
of current information from time series f (iT |, ) as summarized by iT (b
, T )
knowledge of the parameters (, ) reads:
1

b
b
(T )()
f (iT |, ) = 2 || 2 e 2 ()
||

T 1
2

T N2 2
1
b
b
e 2 tr(T ) .

(7.21)

Thus, after trivial regrouping and simplifications, the joint pdf of current information and the parameters
reads:
f (iT , , ) = f (iT |, )fpr (, )
T N2 2
0
T +0 N
0
1
1
b
b 0 (T )()
b } b
= 3 e 2 {(0 ) (T0 )(0 )+()
|0 | 2 || 2
e 2 tr(T +0 0 ) .

(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)

T1 T0 + T
b
T0 0 + T
1
T0 + T
T T0
(b
0 )(b
0 )0 .

T0 + T

(7.24)

where:

(7.25)
(7.26)

Therefore, defining:

b + 0 0 +
T
,
1

(7.27)

where 1 is a number yet to be defined, we can re-write the joint pdf (7.22) as follows:
T N2 2
0
T +0 N
0
1
1
b
f (iT , , ) = 3 e 2 (1 ) T1 (1 )
|0 | 2 || 2
e 2 tr(1 1 ) .

(7.28)

At this point we can perform the integration over (, ) to find the marginal pdf f (iT ):
Z
f (iT ) =

f (iT , , )dd

Z Z
1
21 (1 )0 T1 (1 )
2
= 4
5 || e
d

T N2 2
0
T +0 N 1
1
b
2
|0 | 2 ||
e 2 tr(1 1 ) d

Z T N 2
0
T +0 N 1
1
b 2
2
|0 | 2 ||
= 4
e 2 tr(1 1 ) d ,

(7.29)

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:



Z
T N2 2
0

1
1 N 1
b
21
21 tr(1 1 )
2
2
2
|0 | |1 |
7 |1 | ||
e
d
f (iT ) = 6
T N2 2
0

b
1
= 6
|0 | 2 |1 | 2 ,

(7.31)

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

fpo (, )

221

f (iT , , )
f (iT )
1
2

= 7 || e

(7.32)

12 (1 )0 T1 (1 )

|1 |

1
2

||

1 N 1
2

12 tr(1 1 )

From (2.156, AM 2005) and (2.224, AM 2005) we see that this means:
1

| N(1 , [T1 ]

),

(7.33)

W(1 , (1 1 )1 ) .

(7.34)




| N 1 ,
,
T1

(7.35)

and:

In other words:

and:

1
W 1 , 1
1



.

(7.36)


E 269 Normal-inverse-Wishart location-dispersion: mode (www.7.3) *


Compute the mode (7.6, AM 2005) of the posterior distribution of in (7.46, AM 2005).
Solution of E 269
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.32, AM 2005)(7.33, AM 2005) on the posterior, although of course the solution applies verbatim to the prior, or any
NIW distribution. Thus assume:
1 W(1 , (1 1 )1 ) .

(7.37)

and:
1

| N(1 , [T1 ]

).

(7.38)

The parameter in this context are:


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:

f () = f (|)f () = 1 ||

1 N
2

e 2 tr(1 1 ) e

T1
2

(1 )0 (1 )

(7.40)

To determine the mode of this distribution:



e

h i0 0
e
e 0 , vech
,

(7.41)

we impose the first-order conditions on the logarithm of the joint pdf (7.40):

ln f 2 +

1 N
1
ln || tr {1 1 + T1 ( 1 )( 1 )0 } .
2
2

(7.42)

Computing the first variation and using (A.124, AM 2005) we obtain:



1 
tr ((1 N )1 + 1 1 + T1 ( 1 )( 1 )0 )d
2
tr {T1 ( 1 )0 d} .

d ln f

(7.43)

Therefore:
d ln f tr {G d} + tr {G d} ,

(7.44)

where:

1
(1 N )1 1 1 T1 ( 1 )( 1 )0
2
G T1 ( 1 )0 .

(7.45)
(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)

Therefore from (A.116, AM 2005) and (A.118, AM 2005) we obtain:




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 []


1
= D0N vec (1 N )1 1 1 T1 ( 1 )( 1 )0 .
2

(7.49)

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)

and the mode of the dispersion parameter:


e 1 =

1
1 .
1 N

(7.51)


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
2
tr {T1 d0 d} tr {T1 ( 1 )0 dd}

1 N  1
=
tr (d)1 d
2
T1 d0 d 2T1 tr {( 1 )0 dd} .

d(d ln f ) =

(7.52)

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
= vec [d] (1 1 ) vec [d]
= vec [d] (1 1 ) vec [d]

(7.53)

= vech [d] D0N (1 1 )DN vech [d] .


We are interested in the Hessian evaluated in the mode, where (7.50) holds and thus the last term in (7.52)
cancels:
 1

(1 N )
e
e 1 DN vech [d]
vech [d] D0N
2
e
T1 d0 d
.

d(d ln f )|,
e =
e

Therefore from (A.117, AM 2005) and (A.121, AM 2005) and substituting back (7.51) we obtain:

(7.54)


1 N 1
2 ln f
= T1
1

0
,
1
e
e


2 ln f

= 0(N (N +1)/2)2 N 2
0
vech [] ,
e
e


2 ln f
1 12

=

D0 (1 1 )DN .
vech() vech()0 ,
2 1 N N
e
e

(7.55)
(7.56)
(7.57)

Finally the modal dispersion reads:


!1

2 ln f

MDis {}
0
(, vech())(, vech()) ,
e
e


S
0N 2 (N (N +1)/2)2
=
,
0(N (N +1)/2)2 N 2
S

(7.58)

where:
1
1
1
T1 1 N
2 1 N
1
S
[D0N (1 1 )DN ] .
1 1
S

(7.59)
(7.60)


E 271 Inverse-Wishart dispersion: mode (www.7.4) *


Prove the expression (7.38, AM 2005) for the mode of .
Solution of E 271
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 IW (inverse-Wishart) assumptions (7.33, AM 2005) on the
posterior, although of course the solution applies verbatim to the prior, or any IW distribution. Thus
assume
IW(1 , 1 1 ) .

(7.61)

From (2.233, AM 2005) the pdf of reads:

f () =

1
+N +1
1
1
1
1 2
|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).

ln f 2


1 + N + 1
1 
ln || tr 1 1 1 .
2
2

Computing the first variation and using (A.124, AM 2005) and (A.126, AM 2005):

(7.63)

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

225

1 + N + 1
tr(1 d)
2

1 
+ tr 1 1 1 (d)1
2


1
1
1
1
= tr
(1 1 (1 + N + 1) )d
2

(7.64)


1
1 1 1 1 (1 + N + 1)1 .
2

(7.65)

d ln f =

where:

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)

Therefore from (A.116, AM 2005) and (A.118, AM 2005) we obtain:




1
ln f
= D0N vec [G0 ] = D0N vec 1 1 1 1 (1 + N + 1)1 .
vech []
2

(7.67)

Applying the first-order conditions to (7.67) we obtain the mode:


vech [ModiT ,eC ] =

1
vech [1 ] .
1 + N + 1

(7.68)


E 272 Inverse-Wishart dispersion: modal dispersion (www.7.4) (see E 271) *


Consider the same setup than in E 271. Prove the expression (7.39, AM 2005) for the modal dispersion
of vech[].
Solution of E 272
To compute the modal dispersion we differentiate (7.64). Using (A.126, AM 2005) we obtain:
1
tr(1 1 (d)1 1 1 d)
2
1
tr(1 1 1 1 (d)1 d)
2
1
+ 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

d(d ln f ) =

(7.69)

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

= vec [d] (1 1 ) vec [d]

(7.70)

= 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:
b tr((d)1 (d)1 1 1 )


0
= vec [d] vec 1 (d)1 1 1
0

= vec [d] ((1 1 1 ) 1 ) vec [d]

(7.71)

= vech [d] D0N ((1 1 1 ) 1 )DN vech [d] .


Therefore, substituting (7.70) and (7.71) in (7.69) we obtain:

d(d ln f ) = 1 b +

1 + N + 1
0
a = vech [d] H vech [d] ,
2

(7.72)

where:
H 1 D0N ((1 1 1 ) 1 )DN +

1 + N + 1 0
DN (1 1 )DN .
2

(7.73)

We are interested in the Hessian evaluated in the mode, where (7.68) holds, i.e. in the point

1
1 .
1 + N + 1

(7.74)

In this point:
0

d(d ln f )|Mod = vech [d] H|Mod vech [d] ,

(7.75)

where:
3
1 + N + 1
1
D0N (1
1 1 )DN
1

2
1 + N + 1 1 + N + 1
1
+
D0N (1
1 1 )DN
2
1
1 (1 + N + 1)3 0
1
=
DN (1
1 1 )DN .
2
12


H|Mod 1

Therefore:

(7.76)

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

227



1 (1 + N + 1)3 0
2 ln f []
1

=

DN (1
1 1 )DN .
0
2
12
vech [] vech [] Mod

(7.77)

From the definition of modal dispersion (2.65, AM 2005):



MDis


1

2 ln f []

0
vech [] vech [] Mod

(7.78)

212
1
=
.
(D0 (1 1
1 )DN )
(1 + N + 1)3 N 1

E 273 Normal-inverse-Wishart location-dispersion: marginal distribution of location (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:
1 W(0 , (0 0 )1 ) ,

(7.79)

| N(0 , (T0 )1 ) ,

(7.80)

and:

From (2.156, AM 2005) and (2.224, AM 2005) the joint prior pdf of and is:
f (, ) = f (|)f ()
1

= 1 || 2 e 2 (0 ) (T0 )(0 ) |0 |

0
2

||

0 N 1
2

e 2 tr(0 0 ) .

(7.81)

To determine the unconditional pdf of we have to compute the marginal in (1.101, AM 2005). Defining:
2 0 0 + T0 ( 0 )( 0 )0 ,

(7.82)

we obtain:
Z
f ()

f (, )d
Z

1 |0 |

= 2 |0 |
= 2 |0 |

0
2

0
2

0
2

||

0 N
2

|2 |

0 +1
2

|2 |

0 +1
2

e 2 tr(2 ) d
Z

0 +1
0 N
1
3 |2 | 2 || 2 e 2 tr(2 ) d
,

(7.83)

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:
f () = 2 |0 |

0
2

|0 0 + T0 ( 0 )( 0 )0 |

0 +1
2

(7.84)

 02+1


|| I + 1 vv0
0 +1
1
= || 2 I + 1 vv0 2

(7.85)

From (A.91, AM 2005) we obtain the following identity:


||

0
2

| + vv0 |

0 +1
2

= ||

0
2

12

= ||

+1
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

0 2


f () = 4
T0


02+1


1 + 1 ( 0 )0 ( 0 )1 ( 0 )
.


0
T0

(7.88)

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 ,
T0


.

(7.89)


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:
1 W(0 , (0 0 )1 ) ,

(7.90)




B| N B0 , , 1
,
T0 F,0

(7.91)

and:

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

229

or, in terms of 1 :


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:
fpr (B, ) = fpr (B|)fpr ()
K

= 1 || 2 |F,0 | 2 e 2 tr{(T0 )(BB0 )F,0 (BB0 ) } |0 |


1

0
2

||

0 N 1
2

e 2 tr(0 0 ) .
(7.93)

The current information conditioned on the parameters B and is summarized by the OLS factor loadings and sample covariance:
n
o
b
b .
iT B,

(7.94)

b is distributed as follows:
In (4.129, AM 2005) we show that B


b 1
b
,
B N B, , F
T

(7.95)

b is distributed as follows:
and in (4.130, AM 2005) we show that T
b W(T K, ) .
T

(7.96)

b and T
b are independent. Therefore, from (2.182, AM 2005) and (2.224,
Furthermore, we show that B
AM 2005) we have:
b
b
f (iT |B, ) = f (B|B,
)f (T |B,
)
1
N



T KN
K
0
1
2
b
b F (BB)
b
b
b

} || T K
2
b F 2 e 12 tr{(T )(BB)
= 2 |T | 2
e 2 tr(T ) .
T
(7.97)
Thus, after trivial regrouping and simplifications, the joint pdf of current information and the parameters
reads:
f (iT , B, ) = f (iT |B, )fpr (B, )
1
N2 T KN
0
T +K+0 N 1
N
2
b b
2
= 3
|F,0 | 2 |0 | 2 ||
F
0

e 2 tr{(BB0 )T0 F,0 (BB0 ) +(BB)T F (BB) }


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:

(7.98)

{ } = T1 (B B1 )F,1 (B B1 )0 + ,

(7.99)

where:
T1 T0 + T

(7.100)

bF
T0 F,0 + T
T1
b
b F )(T0 F,0 + T
b F )1
B1 (B0 T0 F,0 + BT

F,1

(7.101)
(7.102)

and:
b
bFB
b0
B0 T0 F,0 B00 + BT
b
b F )(T0 F,0 + T
b F )1 (T0 F,0 B0 + T
bFB
b 0) .
(B0 T0 F,0 + BT
0

(7.103)

b F we can write the expression in curly brackets (7.99) as


Indeed, defining D T0 F,0 and C T
A, where:
b
b 0
a (B B0 )D(B B0 )0 + (B B)C(B
B)
b B
b 0 2BCB
b0
= BDB0 + B0 DB0 2BDB0 + BCB0 + BC
0

= B(D + C)B +

B0 DB00

b B
b 0 2BCB
b0
2BDB00 + BC

= B(D + C)B + B1 (D + C)B01 2B(D + C)B01


b B
b 0 2BCB
b0
+ B0 DB0 2BDB0 + BC
0

B1 (D +

C)B01

+ 2B(D +

(7.104)

C)B01

= (B B1 )(D + C)(B B1 )0
b B
b 0 2BDB0 2BCB
b0
+ B0 DB00 + BC
0
B1 (D + C)B01 + 2B(D + C)B01 ,
defining:
b
B1 (B0 D + BC)(D
+ C)1 ,

(7.105)

a = (B B1 )(D + C)(B B1 )0
b B
b 0 (B0 D + BC)(D
b
b 0,
+ B0 DB0 + BC
+ C)1 (B0 D + BC)

(7.106)

the above simplifies to:

which proves the result. Substituting (7.99) in (7.98) and defining:


1 T + 0
b + 0 0 +
T
,
1
1

(7.107)
(7.108)

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

231

we obtain:
f (iT , B, ) = f (iT |B, )fpr (B, )
1
N2 T KN
0
T +K+0 N 1
N
2
b b
2
= 3
|F,0 | 2 |0 | 2 ||
F
0

(7.109)

e 2 tr{T1 (BB1 )F,1 (BB1 ) } e 2 tr(1 1 ) .


1

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
1
= 4
5 || 2 |F,1 | 2 e 2 tr{T1 (BB1 )F,1 (BB1 ) } dB
N2
b

F

1
T KN
N
2
b
N

|F,1 | 2 |F,0 | 2

1 N 1
2

0
2

(7.110)

21 tr( 1 1 )

d
|0 | ||
e
Z N T KN 1
N
2
b 2 b
N
= 4
|F,1 | 2 |F,0 | 2
F
0
2

|0 |

||

1 N 1
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
f (iT ) = 5

6 |1 |

N2
b

F
N2
b
= 5
F

1
2

||

1 N 1
2


1
e 2 tr(1 1 ) d

1
T KN
0

N
2
b
N
1

|F,1 | 2 |F,0 | 2 |0 | 2 |1 | 2

1
T KN
0

N
2
b
1
N
|F,1 | 2 |F,0 | 2 |0 | 2 |1 | 2 ,

(7.111)

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:

fpo (B, )

f (iT , B, )
f (iT )
N

= 7 |F,1 | 2 |1 |

1
2

||

K+1 N 1
2
0

e 2 tr{T1 (BB1 )F,1 (BB1 ) } e 2 tr(1 1 )


1

= 8 || 2 |F,1 | 2 e 2 tr{T1 (BB1 )F,1 (BB1 ) }


9 |1 |

1
2

||

1 N 1
2

e 2 tr(1 1 ) .

From (2.182, AM 2005) and (2.224, AM 2005) this proves that:

(7.112)



B| N B1 , (T1 )1 , 1
F,1 ,

(7.113)


W 1 , (1 1 )1 .

(7.114)



1
1
W 1 ,
,
1

(7.115)

and:

Recalling that 1 this means:

and:

B| N B1 , , 1
T1 F,1


.

(7.116)


E 275 Normal-inverse-Wishart factor loadings-dispersion: mode (www.7.7) *


Prove the expression (7.81, AM 2005) for the mode (7.6, AM 2005) of the posterior distribution of .
Solution of E 275
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.71, AM 2005)(7.72, AM 2005) on the posterior, although of course the solution applies verbatim to the prior, or any
NIW distribution. The parameter in this context are:
0

(vec [B] , vech [] )0 .

(7.117)

Assume that B and are joint NIW (normal-inverse-Wishart) distributed, i.e.:


1 W(1 , (1 1 )1 ) .

(7.118)

B| N(B1 , (T1 )1 , 1
F,1 ) .

(7.119)

and:

From (2.182, AM 2005) and (2.224, AM 2005) the joint NIW (normal-inverse-Wishart) pdf of B and
reads:
f (B, ) = f (B|)f ()
N

= 1 |F,1 | 2 |1 |

1
2

||

1 +KN 1
2

To determine the mode of this distribution:

e 2 tr{[(BB1 )T1 F,1 (BB1 ) +1 1 ]} .


1

(7.120)

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS


h i0
h i0 0
e , vech
e
vec B
,

233

(7.121)

we impose the first-order condition on the logarithm of the joint pdf (7.120):

ln f 2 +

1 + K N 1
ln ||
2

1
tr {[(B B1 )T1 F,1 (B B1 )0 + 1 1 ] } .
2

(7.122)

To compute the first variation we use (A.124, AM 2005) obtaining:

d ln f



1 
tr (1 + K N 1)1 a d
2
tr {T1 F,1 (B B1 )0 dB} ,

(7.123)

where:
a (B B1 )T1 F,1 (B B1 )0 + 1 1 .

(7.124)

d ln f tr {G d} + tr {GB dB} ,

(7.125)

Therefore:

where:

1
(1 + K N 1)1 a
2
GB T1 F,1 (B B1 )0 .

(7.126)
(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

d ln f = vec [G0 ] DN vech [d] + vec [G0B ] vec [dB] .

(7.128)

Therefore from (A.116, AM 2005) and (A.118, AM 2005) we obtain:


ln f
= vec [G0B ] = T1 vec [(B B1 )F,1 ] .
vec [B]

(7.129)

Similarly, from (A.116, AM 2005) and (A.118, AM 2005) we obtain:




ln f
1
= D0N vec [G0 ] = D0N vec (1 + K N 1)1 a .
vech []
2

(7.130)

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)

and the mode of the dispersion parameter:


e 1 =

1
1 .
1 + K N 1

(7.132)


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 differential reads:


1 
tr (1 + K N 1)1 (d)1 + 2T1 dBF,1 (B B1 )0 d
2
tr {T1 F,1 dB0 dB} tr {T1 F,1 (B B1 )0 ddB}

1 + K N 1  1
tr (d)1 d
=
2
T1 tr {F,1 dB0 dB} 2T1 tr {F,1 (B B1 )0 ddB} .

d(d ln f ) =

(7.133)

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
= vec [d] (1 1 ) vec [d]
= vec [d] (1 1 ) vec [d]

(7.134)

= vech [d] D0N (1 1 )DN vech [d] .


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):
tr {F,1 dB0 dB} = tr {dBF,1 dB0 }
0

= vec [dB0 ] vec [F,1 dB0 ]


= (KKN vec [dB])0 ( F,1 )(KKN vec [dB])

(7.135)

= vec [dB] KN K ( F,1 )KKN vec [dB] .


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
1 + K N 1
e
e 1 DN vech [d]
vech [d] D0N
2
0
e F,1 )KKN vec [dB] .
T1 vec [dB] KN K (

(7.136)

d(d ln f )|B,
e
e =

Therefore from (A.117, AM 2005) and (A.121, AM 2005) and substituting back (7.132) we obtain:


1 + K N 1
2 ln f

= T1
KN K (1
1 F,1 )KKN
0
1
vec [B] vec [B] B,
e
e


2 ln f

= 0(N (N +1)/2)2 (N K)2
0
vech [] vec [B] B,
e
e


1
12
2 ln f

=

D0 (1 1 )DN .
vech() vech()0 B,
2 1 + K N 1 N
e
e

(7.137)

Finally the modal dispersion reads:

MDis {}

1 

2 ln f
SB

=
0(N (N +1)/2)2 (N K)2
0 e

0(N K)2 (N (N +1)/2)2


S


,

(7.138)

where using (A.109, AM 2005) and (A.101, AM 2005) we have:


1
1
KN K (1 1
F,1 )KKN
T1 1 + K N 1
2 1 + K N 1 0
1
S
[DN (1 1 )DN ] .
1
1
SB

(7.139)
(7.140)


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:
1 W(0 , (0 0 )1 ) ,

(7.141)

B| N(B0 , (T0 )1 , 1
F,0 ) .

(7.142)

and:

From (A.182, AM 2005) and (A.224, AM 2005) the joint prior pdf of B and is:

f (B, ) = f (B|)f ()
N

= 1 || 2 |F,0 | 2 e 2 tr{(T0 )(BB0 )F,0 (BB0 ) }


|0 |

0
2

= 1 |F,0 |
e

||

N
2

0 N 1
2

|0 |

0
2

e 2 tr(0 0 )

||

(7.143)

0 +KN 1
2

12 tr{((BB0 )T0 F,0 (BB0 )0 +0 0 )}

To determine the unconditional pdf of B we have to compute the marginal in (7.143). Defining:
2 (B B0 )T0 F,0 (B B0 )0 + 0 0 ,

(7.144)

we obtain:
Z
f (B)

f (B, )d
Z

1 |F,0 | 2 |0 |

= 2 |F,0 |

N
2

|0 |

= 2 |F,0 | 2 |0 |

0
2

0
2

0
2

||

0 +KN 1
2

0 +K
2

0 +K
2

|2 |
|2 |

e 2 tr{2 } d

Z
3 |2 |

0 +K
2

||

0 +KN 1
2

12 tr{2 }


d

(7.145)

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

f (B) = 2 |F,0 | 2 |0 |

0
2

|0 0 + (B B0 )T0 F,0 (B B0 )0 |

0 +K
2

(7.146)

From (A.91, AM 2005) we obtain the following general identity:

||

0
2

| + vv0 |

0 +K
2


 0 +K

2
|| IN + 1 vv0
0 +K
K
2
= || 2 IN + 1 vv0
0 +K
K
2
= || 2 IK + v0 1 v
.
= ||

0
2

(7.147)

Applying this result to:


v (B B0 )pF,0

(7.148)

0 0 ,

(7.149)

T0 F,0 pF,0 p0F,0 ,

(7.150)

where pF,0 satisfies:

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

237

we reduce (7.145) to the following expression:


N

K
2

f (B) = 4 |F,0 | 2 |0 0 |


0 +K
IN + (0 0 )1 (B B0 )T0 F,0 (B B0 )0 2 .

(7.151)

Applying again (A.91, AM 2005) we obtain:


N2



K
f (B) = 4 1
|0 0 | 2
F,0

0 +K
2
IK + T0 F,0 (B B0 )0 (0 0 )1 (B B0 )
N2

K


(0 + K N )1 0 0 2
= 5 1
F,0
0 +K



2


1
(
+
K

N
)(

)
0
0
0


(B B0 )
.
IK + T0 F,0 (B B0 )0


(0 + K N )

(7.152)

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
0 , (T0 F,0 )1
B St 0 + K N, B0 ,
0 + K N


.

(7.153)


E 278 Allocation-implied parameters (www.7.9) *


Prove the expression (7.99, AM 2005).
Solution of E 278
Consider the constraints:
C1 : 0 pT = wT ,

(7.154)

C2 : g G g ,

(7.155)

and:

where G is a K N matrix and (g , g) are K-dimensional vectors. From (7.91, AM 2005) we obtain the
allocation function:

(, ) argmax

0 diag(pT )(1 + )

0 pT =wT
gGg

1 0
diag(pT ) diag(pT )
2


.

(7.156)

We can solve this problem by means of Lagrange multipliers. We define the Lagrangian:
1 0
diag(pT ) diag(pT )
2
0 pT ( )0 B ,

L 0 diag(pT )(1 + )

(7.157)

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
N
X

k Gkn g n =

n=1

(7.158)

N
X

k Gkn g n = 0,

k = 1, . . . , K .

(7.159)

n=1

Therefore, defining:
e [diag(pT )]1 G0 ( ) ,

(7.160)

we can write the Lagrangian as follows:


e ) 0
L = 0 diag(pT )(1 +

1 0
diag(pT ) diag(pT ) .
2

(7.161)

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:

(e
, ) 7 (e
, ) [diag(pT )]



e
wT 10 1
e+
1
1
.
10 1 1

(7.162)

This can be inverted, by pinning down specific values for the covariance matrix and solving the ensuing
implicit align:
1

10

1
e

1 1 =
0
1 1


diag(pT )

wT
1

10

(7.163)

From the inverse function:


e () ,
7

(7.164)

and from (7.160) the implied returns that include the constraints (7.155) read:
1

e () + [diag(pT )]
c =

G0 ( ) .

(7.165)


E 279 Likelihood maximization (www.7.9) *


Show that the allocation of example (7.91, AM 2005) with constraint (7.105, AM 2005)-(7.106, AM
2005) give rise to the constraint (7.107, AM 2005).

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

239

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:

CE ()

1 0
diag(pT ) diag(pT ) .
2

(7.166)

Assume there exists a budget constraint:


C1 : 0 pT = wT ,

(7.167)

C2 : 0 .

(7.168)

And consider the no-short-sale constraint:

The allocation function () follows in terms of the Lagrangian:


(), , = argmin L(, , ) ,

(7.169)

,,

where:
L(, , ) 0 diag(pT ) diag(pT ) 0 pT 0 .

(7.170)

From the first-order conditions on the Lagrangian we obtain:


= diag(pT )1 1 1 + diag(pT )1 1 diag(pT )1 ,

(7.171)

together with the Kuhn-Tucker conditions:


0,

n = 0 n > 0 .

(7.172)

Since prices are positive, the allocation is positive if:


1 1 0 ,
where the inequality is meant entry by entry.

(7.173)


E 280 Markov chain Monte Carlo


We recall that according to Bayesian theory, first we must specify a flexible parametric family for the
market, which might include fat tails and skewness, as represented by its pdf:
X| fX (Xt |) .

(7.174)

Then as in (7.13, AM 2005) the likelihood of the data:


iT {X1 , . . . , XT } ,

(7.175)

reads:

l(iT |)

T
Y

fX (Xt |) .

(7.176)

t=1

Assume a prior for the parameters f0 (). Then posterior distribution of the parameters reads:

(|iT ) R

l(iT |)f0 ()
,
l(iT |)f0 ()d

(7.177)

see (7.15, AM 2005). To generate samples from the posterior distribution we use the Metropolis-Hastings
algorithm.
First we select a one-parameter family of candidate-generating densities q(, ), which satisR
fies q(, )d = 1. Then we define the function:

(, ) min


l(iT |)f0 ()q(, )
,1 .
l(iT |)f0 ()q(, )

(7.178)

In particular, if we choose a symmetric function q(, ) = q(, ), this function simplifies to:

(, ) min


l(iT |)f0 ()
,1 .
l(iT |)f0 ()

(7.179)

A convenient rule of thumb is to pick q to be the multivariate normal density:


q(z, B) N(B, diag(B)) ,

(7.180)

where 102 . Then the algorithm proceeds as follows:


Step 0 Set j 0 and generate a starting point for the parameters (j) ;
Step 1 Generate from q( (j) , ) and u from U([0, 1]);
Step 2 If u ( (j) , ) set (j+1) , else set (j+1) (j) ;
Step 3 If convergence is achieved go to Step 4, else go to Step 1;
Step 4 Disregard the first samples and return the remaining (j) .
R
Write a MATLAB
script in which you:
Use the above algorithm to generate draws from a univariate density;
Display the draws over time; what can you say?
Hint. See Chib and Greenberg (1995).
Solution of E 280
R
See the MATLAB
script S_MarkovChainMonteCarlo

E 281 Bayesian: prior on correlation


Assume that the returns Xt (Xt,1 , Xt,2 , Xt,3 )0 on three stocks are jointly normal:

CHAPTER 7. ESTIMATING THE DISTRIBUTION OF THE MARKET INVARIANTS

Xt N(, ) ,

241

(7.181)

with null expectations and unit standard deviations:

0
0 ,
0

1
12
13

12
1
23

13
23 .
1

(7.182)

In this situation the joint distribution of the returns is fully determined by three parameters:
(12 , 13 , 23 )0 .

(7.183)

These parameters are constrained on a domain:


(1, 1) (1, 1) (1, 1) .

(7.184)

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)

R
Write a MATLAB
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
R
script S_CorrelationPriorUniform.
See the MATLAB

E 282 Bayesian: normal-inverse-Wishart posterior


R
Write a MATLAB
function RandNIW that takes as inputs a generic N -dimensional vector 0 , a generic
positive and symmetric N N matrix 0 , two positive scalars T0 and 0 and the number of simulations
J and outputs J independent simulations of the normal-inverse-Wishart distribution, as defined in (7.20,
R
AM 2005)-(7.21, AM 2005). Then, write a MATLAB
script in which you:
Upload the database DB_UsSwapRates of daily USD swap rates and compute the daily rate changes
b (see Chapter 7 for the notation);
b and
from. Then compute T ,
Set 0 T0 52 and define the prior parameters 0 and 0 arbitrarily. Use the function randNIW
to generate J 104 scenarios of the prior (7.20, AM 2005)-(7.21, AM 2005);
Compute the parameters of the posterior distribution and use the function randNIW to generate J
104 scenarios of the posterior;
Specialize the script to the case N 1, i.e. only consider the first swap rate change;
Subplot the histogram of the marginal distribution of the prior of and superimpose the profile of
its analytical pdf. Then, subplot the histogram of the marginal distribution of the prior of 1/ 2 and
superimpose the profile of its analytical pdf;

Subplot the histogram of the marginal distribution of the posterior of and superimpose the profile
of its analytical pdf. Then subplot the histogram of the marginal distribution of the posterior of
1/ 2 and superimpose the profile of its analytical pdf;
Check that (7.4, AM 2005) holds by changing the relative weights of 0 , T0 with respect to T .
Solution of E 282
R
See the MATLAB
script S_AnalyzeNormalInverseWishart.

Chapter 8

Evaluating allocations
E 283 Optimal allocation as function of invariant parameters (www.8.1)
Prove the expressions (8.33, AM 2005)-(8.34, AM 2005).
Solution of E 283
Replacing the market parameters (8.21, AM 2005) in the certainty-equivalent (8.25, AM 2005) we obtain:
S = 0 diag(pT )(1 + )

1 0
diag(pT ) diag(pT ) .
2

(8.1)

Substituting in this expression the optimal allocation (8.32, AM 2005), which we report here:

= [diag(pT )]

1 +

wT 10 1
1
[diag(pT )] 1 1 ,
10 1 1

(8.2)

we obtain:


wT 10 1 1
1
S = (1 + ) +
1
10 1 1




1
wT 10 1 1
wT 10 1 0
1
0

1
+
1
+
2
10 1 1
10 1 1
wT 10 1
= (1 + )0 1 +
(1 + )0 1 1 .
10 1 1
0

(8.3)

Defining:
A 10 1 1 ,

B 10 1 ,

the above expression simplifies as follows:

243

C 0 1 ,

(8.4)

wT B
wT B
S = B + C +
A+
B
A
A


1
wT B
wT B
wT B 2
2

C +
B+
B+(
) A
2
A
A
A
wT B
= B + C + wT B +
B
A


1
wT B
2BwT + B 2
1 wT2

C + 2
B+

2
A
A
2 A




1
B2
B
1 wT
= C
+ wT 1 +
.
2
A
A 2 A

(8.5)

E 284 Statistical significance of sample allocation (www.8.2)


Prove that the distributions of the estimators (8.100, AM 2005)-(8.101, AM 2005) are given by (8.102,
AM 2005).
Solution of E 284
Consider the independent sample estimators (8.85, AM 2005) and (8.86, AM 2005):


1
b N , ,

b W(T 1, ) .
T

(8.6)

where W denotes the Wishart distribution. Define:


b diag(pT ) .
vb 0 diag(pT )

(8.7)

From (2.230, AM 2005) the distribution of this random variable satisfies:


T vb Ga(T 1, 0 diag(pT ) diag(pT )) ,

(8.8)

where Ga denotes the gamma distribution. Thus from (1.113, AM 2005) the expected value of vb reads:
E {b
v} =

T 1 0
diag(pT ) diag(pT ) ,
T

(8.9)

and from (1.114, AM 2005) the inefficiency of vb reads:


r
Sd {b
v} =

T 1 0
diag(pT ) diag(pT ) .
T2

(8.10)

Similarly, define:
b) .
eb 0 diag(pT )(1 +
From (2.163, AM 2005) we obtain:

(8.11)

CHAPTER 8. EVALUATING ALLOCATIONS

0 diag(pT ) diag(pT )
eb N diag(pT )(1 + ),
T


245


.

(8.12)

Therefore, from (2.163, AM 2005) the expected value of eb reads:


E {b
e} = 0 diag(pT )(1 + ) ,

(8.13)

and from (2.159, AM 2005) the inefficiency of eb reads:


r
Sd {b
e} =

0 diag(pT ) diag(pT )
.
T

b are independent, so are vb and eb.


b and
Furthermore, since

(8.14)


E 285 Estimation risk and opportunity cost


R
script the evaluation of the best performer allocation (8.42, AM 2005) and
Replicate in a MATLAB
described in Figure 8.2 in Meucci (2005). You do not need to draw the figure, as long as you correctly
compute the number S(), as well as the distributions S (([IT ])), C+ (([IT ])) and OC (([IT ])), as
functions of .
Solution of E 285
R
script S_EvaluationGeneric.

See the MATLAB

Chapter 9

Optimizing allocations
E 286 Allocation of the resampled allocation (www.9.1) *
Prove expression (9.92, AM 2005) for the resampled allocation.
Solution of E 286
We can express the resampled allocation as:
n h
io
b T]
b
[i
],[i
rs [iT ] E s IT T
n
o
n w
o
T
1
1
= E [diag(pT )] Vu + E
[diag(pT )] V1
0
1V1
 0
1 Vu
1
E
[diag(pT )] V1
10 V1


V1
1
1
= [diag(pT )] E {V} E {u} + wT [diag(pT )] E
10 V1


V1
1
0
[diag(pT )] E {u} E
V1
10 V1


V1
1
1
b + wT [diag(pT )] E
= [diag(pT )] E {V}
10 V1


V1
1 0
b E
[diag(pT )]
V1 .
10 V1

(9.1)

Therefore:

rs [iT ] = [diag(pT )]




 
 0
V1
1 Vb

V1
+ wT E
.
E {Vb
} E
10 V1
10 V1

(9.2)


E 287 Probability bounds for the sample mean (www.9.2)


Prove the expression (9.109, AM 2005) of the probability that the range (9.108, AM 2005) captures the
true expected values.
Solution of E 287
246

CHAPTER 9. OPTIMIZING ALLOCATIONS

247

From (8.85, AM 2005) the sample estimator is distributed as follows:




t
b N t ,

,
T

(9.3)

where t and t are the true underlying parameters. Therefore from (9.53, AM 2005) we have:

(b
t )0

t
T

1

(b
t ) 2N .

(9.4)

From the definition (1.7, AM 2005) of the cdf:


(
t 0

F2N (T ) P (b
)

t
T

1

)
t

(b
) T

(9.5)



b )0 (t )1 (t
b) .
= P (t
By applying the quantile function (1.17, AM 2005) to both sides of the above equality we obtain:



t 1

b)
p = P (

b)
(

Q2N (p)


.

(9.6)

Therefore, considering the set:




b , t )
RN | Ma2 (t ,

Q2N (p)
T


,

(9.7)

the following result holds:




P t = p .

(9.8)


E 288 Bayes rule (www.9.3)


Prove the general Bayes rule (9.30, AM 2005).
Solution of E 288
By the definition of the conditional density we have:
fX,V (X, V)
,
fV (V)

(9.9)

fX,V (x, v)dx ,

(9.10)

fX|v (X|V)
where fX,V is the joint distribution of X and V and:
Z
fV (v)

is the marginal pdf of V. On the other hand, by the definition of the conditional density we also have:
fX,V (x, v) = fV|g(x) (v|x)fX (x) .

(9.11)

Thus:

fX|v (x|v) R

fV|g(x) (v|x)fX (x)


fX,V (x, v)
=R
.
fX,V (x, v)dx
fV|g(x) (v|x)fX (x)dx

(9.12)


E 289 Black-Litterman posterior distribution (www.9.3) **


Prove the expression (9.44, AM 2005)-(9.46, AM 2005) for the Black-Litterman posterior distribution.
Solution of E 289
In the Black-Litterman setting, the marginal pdf of X is assumed normal:
21

fX (x)

||

(2)

e 2 (x)

N
2

(x)

(9.13)

and the conditional pdf of V given PX = Px is:


12

fV|Px (v|x)

||

(2)

K
2

e 2 (vPx)

(vPx)

(9.14)

Thus the joint pdf of V and X reads:


fX,V (x, v) = fV|Px (v|x)fX (x)
12

||

12

||

e 2 [(x)
1

(x)+(vPx)0 1 (vPx)]

(9.15)
.

Expanding the expression in square brackets in (9.15) we obtain:


[ ] = (x )0 1 (x ) + (v Px)0 1 (v Px)
= x0 1 x 2x0 1 + 0 1 + v0 1 v 2x0 P0 1 v + x0 P0 1 Px


= x0 (1 + P0 1 P)x 2x0 1 + P0 1 v + 0 1 + v0 1 v .

(9.16)

e in such a way that the following holds:


We define
 1

+ P0 1 v (1 + P0 1 P)e
.

(9.17)

e (v) (1 + P0 1 P)1 (1 + P0 1 v) .

(9.18)

This implies:

Using (9.17) we easily re-write (9.16) as follows:

CHAPTER 9. OPTIMIZING ALLOCATIONS

249

[ ] = x0 (1 + P0 1 P)x 2x0 (1 + P0 1 P)e

e 0 (1 + P0 1 P)e
+
+ 0 1 + v0 1 v
e 0 (1 + P0 1 P)e

(9.19)

e )0 (1 + P0 1 P)(x
e) + .
= (x
where:
e 0 (1 + P0 1 P)e
0 1 + v0 1 v
.

(9.20)

Substituting the definition (9.18) in this expression we obtain:


= 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
+ 20 1 (1 + P0 1 P)1 P0 1 v


= v0 1 1 P(1 + P0 1 P)1 P0 1 v

(9.21)

+ 2v0 1 P(1 + P0 1 P)1 1


+ 0 (1 1 (1 + P0 1 P)1 1 ) .
Using the identity (A.90, AM 2005) we write the expression in curly brackets as follows:
1 1 P(1 + P0 1 P)1 P0 1 = ( + PP0 )1 .

(9.22)

e in such a way that:


Also, we define v
e = 1 P(1 + P0 1 P)1 1 .
( + PP0 )1 v

(9.23)

Therefore:
e
= v0 ( + PP0 )1 v 2v0 ( + PP0 )1 v
e 0 ( + PP0 )1 v
e + 0 (1 1 (1 + P0 1 P)1 1 )
+v
e 0 ( + PP0 )1 v
e
v

(9.24)

e )0 ( + PP0 )1 (v v
e) + ,
= (v v
where:
e 0 ( + PP0 )1 v
e.
0 (1 1 (1 + P0 1 P)1 1 ) v
From (9.23) we see that:

(9.25)

e = ( + PP0 )1 P(1 + P0 1 P)1 1 .


v

(9.26)

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:
e (v))0 (1 + P0 1 P)(x
e (v))
[ ] = (x

(9.27)

e )0 ( + PP0 )1 (v v
e) + .
+ (v v
Therefore (9.15) becomes:
21

fX,V (x, v) ||

21

||

e
(
e 2 (x(v))

e
+P0 1 P)(x(v))

0 1

e 2 (vev) (+PP ) (vev)



1
0
1
e
e
(1 +P0 1 P)(x(v))
= 1 + P0 1 P 2 e 2 (x(v))
12

| + PP0 |

0 1

e 2 (vev) (+PP )

(ve
v)

(9.28)

where the last equality follows from:


| + PP0 |
= 1,

|| || 1 + P0 1 P

(9.29)

which in turn follows from an application of (A.91, AM 2005):





|| || 1 + P0 1 P = (1 + P0 1 P) ||


= I + P0 1 P ||


= I + 1 PP0 ||


= (I + 1 PP0 )

(9.30)

= | + PP0 | .
To summarize, from (9.28) we see that:
fX,V (x, v) fX|v (x|v)fV (v) ,

(9.31)


1
0
1
e
e
(1 +P0 1 P)(x(v))
fX|v (x|v) 1 + P0 1 P 2 e 2 (x(v))
,

(9.32)

where:

and:
12

fV (v) | + PP0 |

0 1

e 2 (vev) (+PP )

(ve
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

e ,
X|v = v N(e
, )

(9.34)

e ,
V N(e
v, )

(9.35)

and so is the marginal distribution of V:

e (v) in (9.34) is defined in (9.18) and, using (A.90, AM 2005), it reads:


The expected value
e (v) (1 + P0 1 P)1 (1 + P0 1 v)

= ( P0 (PP0 + )1 P)(1 + P0 1 v)

(9.36)

= + P0 (1 (PP0 + )1 PP0 1 )v P0 (PP0 + )1 P .


Noticing that:
1 (PP0 + )1 PP0 1 = (PP0 + )1 ,

(9.37)

which can be easily checked by left-multiplying both sides by (PP0 + ), the expression for the
e (v) in (9.34) can be further simplified as follows:
expected value
e (v) = + P0 (PP0 + )1 (v P) .

(9.38)

Similarly, from (9.32) and using (A.90, AM 2005) the covariance matrix in (9.34) reads:
e (1 + P0 1 P)1 = P0 (PP0 + )1 P .

(9.39)

e in (9.35) is defined in (9.26) and from (9.33) the covariance


On the other hand, the expected value v
matrix in (9.35) reads:
e + PP0 .

(9.40)


E 290 Black-Litterman conditional distribution (www.9.4) **


Prove the expression (9.61, AM 2005), i.e. that the conditional distribution of the market is normal.
Solution of E 290
First of all we complete the K N matrix P to a non-singular N N matrix:

S

Q
P


,

(9.41)

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:


Y SX =

QX
PX

YA
YB

(9.42)

It is immediate to check that Y is normal:


Y N(, T) ,

(9.43)

where:


A
B

Q
P


,

(9.44)

and:

T

TAA
TBA

TAB
TBB

QQ0
PQ0

QP0
PP0


.

(9.45)

At this point we can compute the conditional pdf. From (2.164, AM 2005) we obtain:
YA |yB N(, ) ,

(9.46)

where the expected values and covariance read explicitly:


A + TAB T1
BB (yB B )
TAA

TAB T1
BB TBA

(9.47)

(9.48)


E 291 Black-Litterman conditional expectation (www.9.4) (see E 290) **


Prove the expression (9.61, AM 2005) for the conditional expectation of the Black-Litterman approach.
Solution of E 291
Substituting the investors opinion YB = Px = v in (9.48) we obtain therefore that the expected value
of the whole vector Y is:


E {YA |YB = v}
v

Q + QP0 (PP0 )1 (v P)
v

E {Y|YB = v} =
=


(9.49)


.

Recalling that Y = SX and rewriting v as P + PP0 (PP0 )1 (v P) we can express (9.49) as


follows:
S E {X|PX = v} = S( + P0 (PP0 )1 (v P)) .

(9.50)

CHAPTER 9. OPTIMIZING ALLOCATIONS

253

Since S is invertible we finally obtain:


E{X|PX = v} = + P0 (PP0 )1 (v P) ,

(9.51)


which is the expression of the conditional expectation that we were looking for.

E 292 Black-Litterman conditional covariance (www.9.4) (see E 290) *


Prove the expression (9.46, AM 2005) for the conditional covariance matrix of the Black-Litterman approach.
Solution of E 292
As for the covariance matrix, substituting the investors opinion YB = PX = v in (9.48) we obtain
therefore that the expected value of the whole vector Y is



Cov {YA |YB = v} 0
0
0


0
=
0 0

QQ0 QP0 (PP0 )1 PQ0
=
0

Cov {Y|YB = v} =

(9.52)
0
0


.

Recalling that Y = SX we can write:


a S Cov {X|PX = v} S0 ,

(9.53)

a = Cov {SX|PX = v}


Q( P0 (PP0 )1 P)Q0 0
=
0
0


0
0 1
0
Q( P (PP ) P)Q Q( P0 (PP0 )1 P)P0
=
P( P0 (PP0 )1 P)Q0 P( P0 (PP0 )1 P)P0




 Q 0
Q
=
P0 (PP0 )1 P
.
P
P

(9.54)

as follows:

Since S is invertible we can pre- and post- multiply (9.53) by S1 and finally obtain:
Cov {X|PX = v} = P0 (PP0 )1 P ,
which is the expression of the conditional covariance that we were looking for.

(9.55)


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:

argmin

s.t.

max
b p

0 1
A1 (10 1 )2 )
2 (
1
+wT (1 + A1 10 1 wT 2A
)
1
0
0
diag(pT )(1 + ) + 2

(9.56)

pT = wT

bp,
(1 )wT 0 diag(pT )(1 + ) + 20 0, for all

where:
A 10 1 1
erf

(9.57)

(2c 1)

(9.58)

diag(pT ) diag(pT ) ,

(9.59)

and:

bp

b )0 1 (
b)
| (

QN (p)
T


.

(9.60)

Using the budget constraint this becomes:


(
argmin

max


s.t.


cp

0 1

2A
(10 1 )2 + wAT (10 1 )
1
0
diag(pT ) + 2
0

)
(9.61)

0 pT = wT

bp,
0 diag(pT ) 20 wT , for all

or:
(
argmin

(
s.t.


max
cp

0 1

2A
(10 1 )2 + wAT (10 1 )
1
0
diag(pT ) + 2
0

0 pT = wn
T
o

20 0 diag(pT ) wT ,
max
cp

)
(9.62)

The second maximization:


max

o
20 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
b) .
g
(
cp

(9.64)

CHAPTER 9. OPTIMIZING ALLOCATIONS

255

For the gradient of the hyperplane we have:


gH diag(pT ) .

(9.65)

Therefore the maximum is achieved when there exists a such that:


b ) = diag(pT ) .
1 (

(9.66)

b p we have:
Since
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
.
T 0 diag(pT ) diag(pT )

(9.68)

Substituting in (9.66) we obtain:


s
b
=

QN (p)/T
diag(pT ) ,
0 diag(pT ) diag(pT )

(9.69)

where the choice of the sign follows from the maximization (9.63). Therefore the original problem (9.62)
reads:
(
argmin

(
s.t.


max
cp

wT 0 1
1
0 T +
1 0 diag(pT ) + 0
A
2

)

0 pT = wT q

N (p)/T
20 + Q
0 0 diag(pT )b
wT ,
0

(9.70)

where:

1 0 1
1

11 .
2
2A

(9.71)


E 294 Computations for the robust mean-variance problem I (www.9.6) *


Show that the robust mean-variance problem (9.117, AM 2005) under the specification (9.118, AM 2005)(9.119, AM 2005) for the robustness sets can be written equivalently as (9.130, AM 2005).

Solution of E 294
Taking into account the elliptical/certain specifications (9.118, AM 2005)-(9.119, AM 2005), the robust
mean-variance problem (9.117, AM 2005) can be written as follows:
(
(i)
r

)
0

min { }

= argmax

C
b v (i) ,
0

s.t.

(9.72)

where:


b | ( m)0 T1 ( m) q 2 .

(9.73)

Consider the spectral decomposition (A.70, AM 2005) of the shape parameter:


T E1/2 1/2 E0 .

(9.74)

n
o
b | ( m)0 E1/2 1/2 E0 ( m) q 2 .

(9.75)

Then:

Define the variable:

1 1/2 0

E ( m) ,
q

(9.76)

which implies:
m + qE1/2 u .

(9.77)

n
o
b m + qE1/2 u | u0 u 1 .

(9.78)

Then:

We can express the minimization in (9.72) as follows:


min {0 } = min
0

u u1

n
o
0 (m + qE1/2 u)

n
o
0 E1/2 u
u u1
D
E
1/2 0
= 0 m + q min

E
,
u
,
0

= 0 m + q min
0

(9.79)

u u1

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 ,
E

(9.80)

and the respective minimum reads:


D
E D
E
e
1/2 E0 , u = 1/2 E0 , u
u u1
*
min
0

+
1/2 E0

= E ,
1/2 0
E
D
E
1
1/2 E0 , 1/2 E0
=
1/2 0
E
2

1
1/2 0

E

=


1/2 0
E




= 1/2 E0 .
1/2

(9.81)

Substituting (9.81) in (9.79), the original problem (9.72) reads:



o
n
1/2 0
0
(i)
E
r = argmax m q


C
s.t.
b v (i) .
0

(9.82)

Equivalently, from (9.74) we can write:


n
o

0
0 T
(i)
=
argmax


C
s.t.
b v (i) .
0

(9.83)

E 295 Computations for the robust mean-variance problem II (www.9.6) (see E 294) *
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:
(i)
0
((i)
r , zr ) = argmax { m z}
,z


C


q 1/2 E0 z
s.t.

0b
v (i) .

(9.84)

Furthermore, considering the spectral decomposition (A.70, AM 2005) of the estimate of the covariance:
b F1/2 1/2 F0 ,

(9.85)

D
E
b = 1/2 F0 , 1/2 F0 .
0

(9.86)

we can write:

Therefore the mean-variance problem (9.84) can be written as follows:


(i)
0
((i)
r , zr ) = argmax { m z}
,z



q 1/2 E0 z
s.t.

1/2 0 (i)

F v .

(9.87)

If the investment constraints C are regular enough, this problem is in the SOCP form (6.55, AM 2005). 

E 296 Restating the robust mean-variance problem in SeDuMi format *


Show that the robust mean-variance (9.117, AM 2005) can be restated in SeDuMi format.
Solution of E 296
Let us define:
x (0 , z)0 ,

(9.88)

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)

We redefine the following quantities to re-express our problem


Target:
b (m0 , 1)0 ;
Long-only and budget constraints:

(9.91)

CHAPTER 9. OPTIMIZING ALLOCATIONS

259

Dlo [IN |0N ]


flo 0N
Db1 [10N |0]
fb1 1
Db2 [10N |0]
fb2 1

(9.92)
0

Dlo
D Db1
Db2

flo
f fb1 ;
fb2

Estimation error:
h
i
A01 q1/2 E0 |0N
B01 [00N |1]

(9.93)

d1 0
C1 0N ;
Variance:
h
i
A02 1/2 F0 |0N


B02 00N +1

d2 vi

(9.94)

C2 0N .
Then our problem (9.87) reads:
x = argmin {b0 x} ,

(9.95)

subject to:
D0 x + f 0
kA01 x + C1 k b01 x + d1
kA02 x

+ C2 k

b02 x

(9.96)

+ d2 .

This problem is in the standard SeDuMi format.

E 297 Normal predictive distribution (www.9.7) **


Prove the expression (9.11, AM 2005), i.e. that the predictive distribution of the normal market (9.5, AM
2005) with the normal posterior for the parameters (9.10, AM 2005) is also normal.

Solution of E 297
Consider:
Z
fM (m)

f, (m)f, ()d
0

e 2 (m) (m) e 2 () ()
d
N p
N p
(2) 2 ||
(2) 2 ||
Z
1
(2)N
=p p
e 2 a d ,
|| ||
Z

(9.97)

where:
a (m )0 1 (m ) + ( )0 1 ( )
= m0 1 m + 0 1 2m0 1 + 0 1 + 0 1 20 1
0

= (

) 2 (

m+

) + m

m+

(9.98)

Defining:
b (1 + 1 )1 (1 m + 1 ) ,

(9.99)

we can write:
a = ( b)0 (1 + 1 )( b)
b0 (1 + 1 )b + m0 1 m + 0 1 .

(9.100)

Therefore (9.97) becomes:


(2)N 12 [b0 (1 +1 )bm0 1 m+ 0 1 ]
fM (m) = p p
e
|| ||
Z 1 (b)0 (1 +1 )(b)
1
N
e 2
(2) 2 1 + 1 2
1 d
N
(2) 2 1 + 1 2
1

= 2 e 2 c ,
where 2 is a normalization constant and:

(9.101)

CHAPTER 9. OPTIMIZING ALLOCATIONS

261

c b0 (1 + 1 )bm0 1 m + 0 1
= (m0 1 + 0 1 )(1 + 1 )1 (1 m + 1 )
+ m0 1 m + 0 1
= (m + 1 )0 1 (1 + 1 )1 1 (m + 1 )
+ m0 1 m + 0 1
= m0 1 (1 + 1 )1 1 m 0 1 (1 + 1 )1 1

(9.102)

2m0 1 (1 + 1 )1 1 + m0 1 m + 0 1


= m0 1 1 (1 + 1 )1 1 m
2m0 1 (1 + 1 )1 1
0 1 (1 + 1 )1 1 + 0 1 .
Defining:
T 1 1 (1 + 1 )1 1
Tg 1 (1 + 1 )1 1
0

(9.103)
1 1

we obtain:
c = m0 Tm 2m0 Tg + h
= m0 Tm 2m0 Tg + G0 Tg G0 Tg + h
0

(9.104)

= (m G) T(m g) g Tg + h .
Since:

1 1 1
g = 1 1 (1 + 1 )1 1
( + 1 )1 1 ,

(9.105)

the term h g0 Tg cancels:


h g0 Tg = 0 1 0 1 (1 + 1 )1 1

0
1 (1 + 1 )1 1

1
1 1 (1 + 1 )1 1
1 (1 + 1 )1 1
= 0 1 0 1 (1 + 1 )1 1
0 1 1 (1 + 1 )1

1
1 1 (1 + 1 )1 1
1 (1 + 1 )1 1 .
Therefore:

(9.106)

fM (m) = 2 e 2 (mg) T(mg) .

(9.107)

M N(g, T1 ) .

(9.108)

or in other words:

In our example:

.
T

(9.109)

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
1+T
T
=

1
T
1+T
=,

(9.110)

and:
T = 1 1 (1 + T 1 )1 1
1
= 1 1
1+T
T
=
1 .
1+T

(9.111)

E 298 The robustness uncertainty set for the mean vector (www.9.8) *
Show that the optimization step in (9,139, AM 2005):
min {w0 }

(9.112)

where:

b

| ( 1 )0 1
1 ( 1 )

1 1
q2
T1 1 2


,

(9.113)

can be expressed as:

min
c

w 1

1 1
q2
T1 1 2

!
1/2

1/2 0
F w ,

(9.114)

CHAPTER 9. OPTIMIZING ALLOCATIONS

263

where:
1 F1/2 1/2 F0 ,

(9.115)

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:

b

1/2

| ( 1 ) F

1/2

1 1
F ( 1 )
q2
T1 1 2
0


.

(9.116)

Define the new variable:



u

1 1
q2
T1 1 2

1/2

1/2 F0 ( 1 ) ,

(9.117)

which implies:

= 1 +

1 1
q2
T1 1 2

1/2

F1/2 u ,

(9.118)

we can write (9.116) as follows:


(
b

1 +

1 1
q2
T1 1 2

1/2

)
1/2

u|u u 1

(9.119)

Since:
*

+
1/2
1 1
1/2
2
w = w, 1 +
q
F u
T1 1 2
*
+
1/2
1 1
1/2 0
2
hw, 1 i
q
F w, u ,
T1 1 2


(9.120)

(9.121)

we have:
*

min {w } = hw, 1 i + min


0

u u1

= w 1

1 1
T1 1 2

+
1/2
1 1
1/2 0
2
q
F w, u
T1 1 2
1/2

1/2 0
2
q
F w .

(9.122)

E 299 The robustness uncertainty set for the covariance matrix (www.9.8) **
Show that the optimization step in (9,139, AM 2005):
max {w0 w} ,

(9.123)

where:

b


h
i0
h
i
b CE S1 vech
b CE q 2 ,
| vech

(9.124)

1
1 ,
1 + N + 1

(9.125)

with:
b CE =

and:

S =

212
1
(D0 (1 1
.
1 )DN )
(1 + N + 1)3 N 1

(9.126)

can be expressed as:


"

1
max {w w} =
+

+
N +1
c
1

2
212 q
(1 + N + 1)3

1/2 #

1/2 0 2
F w .

(9.127)

Solution of E 299
Consider the spectral decomposition of the rescaled dispersion parameter (7.78):
1
(D0N (11 1
EE0 ,
1 )DN )

(9.128)

where E is the juxtaposition (A.62, AM 2005) of the eigenvectors:


E (e(1) , . . . , e(N (N +1)/2) ) ,

(9.129)

and is the diagonal matrix (A.65, AM 2005) of the eigenvalues:


diag(1 , . . . , N (N +1)/2 ) .

(9.130)

We can write (9.124) as follows:



b

h
i0
h
i
b CE E1/2 1/2 E0 vech
b CE
vech

Define the new variable:

2
212 q
(1 + N + 1)3


.

(9.131)

CHAPTER 9. OPTIMIZING ALLOCATIONS


u

2
212 q
(1 + N + 1)3

265

1/2

h
i
b CE ,
1/2 E0 vech

(9.132)

which implies:
h
i 
b
vech [] vech CE +

2
212 q
(1 + N + 1)3

1/2

E1/2 u .

(9.133)

we can write (9.131) as follows:


(
b

N (N +1)/2 

b CE +
vech

2
212 q
(1 + N + 1)3

b CE +
vech

s=1

1/2

1/2

2
212 q
s
(1 + N + 1)3

u | u0 u 1

1/2

e(s) us | u0 u 1 .

(9.134)

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:
w0 w = (w0 w0 ) vec []
= (w0 w0 )DN vech []
*
=
=

h
i 
b CE +
w ) , vech

D0N (w0

0 0

2
212 q
(1 + N + 1)3

1/2

+
1/2

h
iE
b CE
D0N (w0 w0 )0 , vech
+
*
1/2

2
212 q
1/2
0
0
0 0
E u
+ DN (w w ) ,
(1 + N + 1)3

(9.135)

b CE w
= w0

1/2 D
E
2
212 q
+
1/2 E0 D0N (w0 w0 )0 , u .
3
(1 + N + 1)
Therefore:
b CE w
max {w0 w} = w0
c


+
0b

2
212 q
(1 + N + 1)3

1/2

D
E
max
1/2 E0 D0N (w0 w0 )0 , u
0

u u1

= w CE w

1/2

2
212 q
1/2 0 0

+
E DN (w0 w0 )0 .
3
(1 + N + 1)

(9.136)

Substituting (9.125) this becomes:


max w0 w =
c

1
w0 1 w
1 + N + 1
1/2


2
212 q
1/2 0 0
0
0
E
D
(w

w
)
+
.

N
(1 + N + 1)3

(9.137)

e of the duplication matrix:


To simplify this expression, consider the pseudo inverse D
e N DN = IN (N +1)/2 .
D

(9.138)

1
1
e0 ,
e N (1 1 )1 D
=D
(D0N (1
N
1
1
1 1 )DN )

(9.139)

e N = (w0 w0 ) ,
(w0 w0 )DN D

(9.140)

It is possible to show that:

and:

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
= (w0 w0 )DN E1/2 1/2 E0 D0N (w0 w0 )0
1
1 0
= (w0 w0 )DN (D0N (1
DN (w0 w0 )0
1 1 )DN )
e N (1 1 )D
e 0 D0 (w0 w0 )0
= (w0 w0 )DN D
N N
h
i0
0
0
e
e N)
= (w w )DN DN (1 1 ) (w0 w0 )(DN D

(9.141)

= (w0 w0 )(1 1 )(w0 w0 )0 .


Using (A.100, AM 2005) this becomes:
a = (w0 w0 )(1 1 )(w0 w0 )0
= (w0 1 w) (w0 1 w)
0

(9.142)

= (w 1 w) .
Therefore (9.137) yields:
1
w0 1 w
1 + N + 1

1/2
2
212 q
+
(w0 1 w)
(1 + N + 1)3
"

1/2 #
2
1
212 q
=
+
(w0 1 w) .
1 + N + 1
(1 + N + 1)3

max w0 w =
c

(9.143)

CHAPTER 9. OPTIMIZING ALLOCATIONS

267

Equivalently, recalling (9.115) we can write (9.137) as follows:


"

1
max {w0 w} =
+

+
N +1
c
1

2
212 q
(1 + N + 1)3

1/2 #

1/2 0 2
F w .

(9.144)


E 300 Robust Bayesian mean-variance problem (www.9.8) *


Show that the robust Bayesian mean-variance problem (9.139, AM 2005) with the robustness uncertainty
sets specified as in (9.149, AM 2005) and (9.152, AM 2005) can be expressed as in (9.155, AM 2005)(9.157, AM 2005).
Solution of E 300
Substituting (9.114) and (9.127) in (9.139, AM 2005), and defining:

2
1
1 q
T1 1 2

(i)

1
1 +N +1

!1/2
(9.145)

v (i)


2
212 q
(1 +N +1)3

1/2 ,

(9.146)

the Bayesian robust mean-variance problem reads:



o
n


(i)
wrB = argmax w0 1 1/2 F0 w
w

q
1/2 0
(i)
s.t. F w .

(9.147)

This is equivalent to:


(i)

(wrB , z ) = argmax {w0 1 z} ,

(9.148)

wC,z

subject to:


1/2 0
F w z/

q
1/2 0
(i)
F w .
This problem is in the SOCP form (6.55, AM 2005).

(9.149)
(9.150)


E 301 Robust mean-variance for derivatives (see E 259)


Consider the market of call options in E 259. Consider a small ellipsoidal neighborhood of the expected
linear returns, as determined by reasonable T, M, and q 2 , see (9.118, AM 2005), and assume no uncertainty in the estimation of the covariance of the linear returns, see (9.119, AM 2005), and set up the robust
optimization problem (9.117, AM 2005) in the form of SOCP, see comments after (9.130, AM 2005).
R
Write a MATLAB
script in which you:

Compute the robust mean-variance efficient frontier in terms of relative weights, assuming the
standard long-only and full investment constraints;
Plot the efficient frontier in the plane of weights and standard deviation.
Hint. Use the CVX package available at http://cvxr.com/cvx/.
Solution of E 301
R
See the MATLAB
script S_MeanVarianceCallsRobust.

E 302 Black-Litterman and beyond I


Assume as in Black-Scholes that the compounded returns are normally distributed:
ln(PT + ) ln(PT ) N(, ) .

(9.151)

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

E{YY0 } = (e+ 2 diag() (e+ 2 diag() )0 ) e ,

(9.153)

where denotes the term-by-term Hadamard product. Since:


1 + R LogN(, ) ,

(9.154)

E{(Y 1)} = E{Y} 1


E{(Y 1)(Y 1)0 } = E{YY0 } + 110 E{Y10 } E{1Y0 } .

(9.155)
(9.156)

using (9.153) and the property:

we can easily compute the expectations E{R} and the second moments E{RR0 }. The covariance then
follows from:
Cov{R} = E{RR0 } E{R} E{R0 } .

(9.157)


E 303 Black-Litterman and beyond II (see E 302)


R
Consider the same setup than in E 302. Write a MATLAB
script in which you:
Upload the database DB_CovNRets that contains estimates for and ;
Use the results from E 302 to compute and plot the efficient frontier under the constraints that the
weights sum to one and that they are non-negative;

CHAPTER 9. OPTIMIZING ALLOCATIONS

269

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
R
See the MATLAB
script S_BlackLittermanBasic.

E 304 Entropy pooling


Consider the market prior:
d

X = BZ1 + (1 B)Z1 ,

(9.158)

where:
Z1 N(1, 1) ,

Z1 N(1, 1) ,

(9.159)

R
script
B is Bernoulli with P{B = 1} 1/2, and all the variables are independent. Write a MATLAB
in which you compute and plot the posterior market distribution that is the most consistent with the view:

e
E{X}
0.5 .

(9.160)

R
Hint. Use the MATLAB
package Entropy Pooling available at www.mathworks.com/matlabcentral/
fileexchange/21307.

Solution of E 304
R
script S_EntropyView.
See the MATLAB

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. Quantitative Finance 4 (3), 328338.
Bertsimas, D., Lauprete, G. J., Samarov, A., 2004. Shortfall as a risk measure: Properties, optimization
and applications. Journal of Economic Dynamics and Control 28, 13531381.
Black, F., Scholes, M. S., 1973. The pricing of options and corporate liabilities. Journal of Political
Economy 81, 637654.
Chib, S., Greenberg, E., 1995. Understanding the Metropolis-Hastings algorithm. The American Statistician 49, 327335.
Dickey, J. M., 1967. Matrix-variate generalizations of the multivariate t distribution and the inverted
multivariate t distribution. Annals of Mathematical Statistics 38, 511518.
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, 3755.
Gourieroux, C., Laurent, J. P., Scaillet, O., 2000. Sensitivity analysis of values at risk. Journal of Empirical Finance 7, 225245.
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, 735747.
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, 125144.
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 statistics. GARP Risk Professional August, 5556.
URL http://symmys.com/node/136
Meucci, A., 2010b. Common misconceptions about beta - hedging, estimation and horizon effects.
GARP Risk Professional June, 4245.
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), 8489.
URL http://symmys.com/node/164
Meucci, A., 2010d. Review of dynamic allocation strategies: Convex versus concave management. Working Paper.
URL http://symmys.com/node/153
Meucci, A., 2010e. Review of linear factor models: Unexpected common features and the systematicplus-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. 6168.
Rudin, W., 1976. Principles of Mathematical Analysis, 3rd Edition. McGraw-Hill.

You might also like