-
Notifications
You must be signed in to change notification settings - Fork 1
/
market_risk.rmd
194 lines (104 loc) · 3.57 KB
/
market_risk.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
---
title: "FRM Market Risk Management"
author: "Alex Dou"
date: "October 26, 2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## VaR and Risk Measurement
* Profit/Loss Data
$$ P/L_t = P_t+D_t-P_{t-1} $$
* Arithmetic return data
$$ r_t=\frac{P_t+D_t-P_{t-1}}{P_{t-1}} = \frac{P_t+D_t}{P_{t-1}} -1 $$
* Geometric return data
$$ R_t = ln(\frac{P_t+D_t}{P_{t-1}}) = ln(1+r_t)$$
### VaR
#### Parametric Approach
##### Normal VaR
$$ -(u_{PL}-Z_{\alpha} \sigma_{PL}) $$
##### Lognormal VaR
$$ (1-e^{u_R-z_{\alpha} \sigma_R})P_{t-1}$$
##### Standard Error of VaR
* Standard Error: The standard deviation of a random variable.
$$ \frac{\sqrt{\frac{p(1-p)}{n}}}{f(q)} $$
##### Quantile-Quantile plots
![QQ Plot](images/qqplot.JPG)
#### Non-parametric Approach
* Sample Number
$$ n \times \alpha +1 $$
##### Bootstrap
* 有放回重复抽样
##### Age-weighted historical simulation (BRW)
$$ \omega_1 = \frac{1-\lambda}{1-\lambda^n} $$
$$ \omega_1 = \frac{\lambda^{i-1}(1-\lambda)}{1-\lambda^n} $$
$$ 0 \le \lambda \le 1 $$
##### Volatility-weighted historical simulation (HW)
$$r^*_{t,i} = (\frac{\sigma_{T,i}}{\sigma_{t,i}})r_{t_i} $$
### Backtesting VaR
#### Failure Rate
$$ \frac{N_{exception}}{T} $$
#### Classic testing framework
$$z = \frac{X-u}{\sigma} = \frac{x-np}{\sqrt{p(1-p)n}}$$
* x, the number of exceptions
#### Unconditionial coverage model
* H0: The model is correctly calibrated
* Reject H0 with 95% confidence level
$$ LR_{uc} > 3.84 $$
#### Conditional coverage model
* H0: The model is correctly calibrated
* Reject H0 with 95% confidence level
$$ LR_{cc} = LR_{uc} + LR_{ind} $$
$$ LR_{cc} > 5.991 $$
#### Type 1 and Type 2 Error
$$ Type_1 = \alpha$$
$$ Type_2 = \beta $$
$$ PowerOfTest = 1-\beta $$
## Correlations
#### Correlations in financial investment
$$ r_p = w_1 r_1 + w_2 r_2 $$
$$ \rho_p = \sqrt{w_1^2 \sigma_1^2+ w_2^2 \sigma_2^2 + 2w_1 w_2Cov_{12}} $$
$$ Cov_{xy} = \frac{\sum{(x_i-u_x)(y_i-u_y)}}{n-1} $$
$$ \rho_{xy} = \frac{Cov_{xy}}{\sigma_x \sigma_y} $$
#### Multi-assets options/Rainbow options
* Options on the better of two
$$ max(s_1, s_2) $$
* Options on the worse of two
$$ min(s_1, s_2) $$
* Call on the max of two
$$ max[0, max(s_1, s_2) - k] $$
* Exchange option
$$ max(0, s_2 - s_1) $$
* Spread call option
$$ max[0, (s_2-s_1) - k] $$
#### Correlation swap
$$ Amount_{national}(\rho_{realized} - \rho_{fixed}) $$
$$ \rho_{realized} = \frac{2}{n^2-n} \sum_{i>j} {\rho_{i,j}} $$
#### Joint probability of default
$$ P(AB) = \rho_{AB} \sqrt{PD_A(1-PD_A)PD_B(1-PD_B)} + PD_A PD_B $$
#### Mean reversion and autocorrelation
##### n-period lag Autocorrelation
$$ AC(\rho_t, \rho_{t-n}) = \frac{conv(\rho_t, rho_{t-n})}{\sigma(\rho_t) \sigma{\rho_{t-n}}} $$
##### Mean reversion
$$ S_t-S_{t-1} = a(u-S_{t-1}) \Delta t + \sigma_s \epsilon \sqrt{\Delta t} \approx a(u-S_{t-1}) $$
#### Correlation and Correlation volatility
TBD
### Statistical Correlation Models
#### The Pearson correlation
$$ Cov_{xy} = \frac{\sum{(x_i-u_x)(y_i-u_y)}}{n-1} $$
$$ \rho_{xy} = \frac{Cov_{xy}}{\sigma_x \sigma_y} $$
#### The Spearman rank correlation
$$ \rho_s = 1- \frac{6 \sum{ d_i^2}}{n(n^2-1)} $$
$$ d_i = rank(x_1) -rank(y_i) $$
#### The Kendall's tau
$$ \tau = \frac{n_c-n_d}{n(n-1)/2} $$
* Concordant pairs
$$ sign(x_i - x_j) = sign(y_i - y_j) $$
* Discordant pairs
$$ sign(x_i - x_j) = -sign(y_i - y_j) $$
#### Gaussian Copula
$$ Probability = N(quantile)$$
$$ Quantile = N^{-1}(Probability) $$
## Term structure models of interest rates
## Other related topics