cf-3 bank hapoalim jun-2001 zvi wiener 02-588-3049 mswiener/zvi.html computational finance
Post on 20-Dec-2015
217 views
TRANSCRIPT
CF-3 Bank Hapoalim Jun-2001
Zvi Wiener
02-588-3049http://pluto.mscc.huji.ac.il/~mswiener/zvi.html
Computational Finance
CF3 slide 2Zvi Wiener
Plan
1. Hypothesis test
2. Maximal Likelihood estimate
3. Multidimensional VaR, contour plots
4. Monte Carlo type methods
CF3 slide 3Zvi Wiener
Hypothesis tests
Given a population, we would like to perform
a test in order to accept or reject the claim that
it is distributed according to some rule (for
example normal or normal with some mean
and standard deviation).
CF3 slide 4Zvi Wiener
Pearson goodness of fit test
Is based on calculating the sample moments and then
comparing the number of observations in more or
less equally full bins.
The comparison of actual number of points versus
the expected frequency allows to estimate the
likelihood of the distribution to belong to the
suspected class.
CF3 slide 5Zvi Wiener
Pearson goodness of fit test
For large samples the following Q statistics follows a Chi Square distribution with m-1 degrees of freedom.
Here m – the number of bins.
fk – is the actual number of points in bin k,
ek is the expected number of points.
m
k k
kk
e
efQ
1
2)(
CF3 slide 6Zvi Wiener
The Kolmogorov-Smirnov test
Here we compare the maximal distance between actual and proposed cumulative distribution.
1. Numerical Recepies in C, second edition, p. 623-625.
2. Mathematica in Education and Research Journal, vol. 5:2, 1996, p. 23-30 by David K. Neal.
CF3 slide 7Zvi Wiener
The Kolmogorov-Smirnov test
Define test statistics by
)()(sup xGxFnD Here n is the number of sample points, F(x) the sample and G(x) the expected cumulative distribution. For large n distribution of D converges to a distribution Y (see Degroot 1986).
222
1
)1(2)( ti
i
ietYP
CF3 slide 8Zvi Wiener
The Kolmogorov-Smirnov test
-2 -1 1 2
0.2
0.4
0.6
0.8
1
-2 -1 1 2
0.2
0.4
0.6
0.8
1
-2 -1 1 2
-0.04
-0.02
0.02
0.04
0.06
0.08
data hypothesis
difference
CF3 slide 9Zvi Wiener
Maximal Likelihood
CF3 slide 10Zvi Wiener
Example
Your portfolio is exposed to two independent
(correlation =0) risk factors.
Each one is uniformly distributed between –1
and 1 for a given time horizon.
What is your VaR95% for the same horizon?
CF3 slide 11Zvi Wiener
Example
A
B
Probability density
CF3 slide 12Zvi Wiener
2 dimensional risk
-1 1 A
B
1
-1Probability of 5%
CF3 slide 13Zvi Wiener
Example
The total probability is 1, the area of the rectangle is 4, so the height is 0.25.
We are looking for x, such that
95.014
1
2
1 2 x
x=0.6325, and VaR95%=2-x=1.3675
CF3 slide 14Zvi Wiener
OvalsConsider a portfolio managed versus benchmark.The benchmark has duration T and includes only government bonds (no credit risk).
A manager has two degrees of freedom. He can choose non-government bonds and have a duration mismatch.Denote the actual duration by T+q and by a – % of the assets invested in non-government bonds.
CF3 slide 15Zvi Wiener
Ovals
Denote by r – the current yield on treasuries Denote by L – LIBOR
(for simplicity we assume a flat term structure).
Denote by dr and dL the possible change in each risk factor during a short period of time.
CF3 slide 16Zvi Wiener
Ovals
The value of the benchmark today is 1.rTrT eeBenchmark 0
quantity discount factor
The value of the benchmark tomorrow will be
))((1
dTTdrrrT eeBenchmark
For short time intervals we ignore dT.
CF3 slide 17Zvi Wiener
Ovals
Similarly the dollar P&L of the portfolio will be
)()(01 )1( qTdrqTdL eaaePP
We ignore convexity and carry effects.
To measure relative performance we use
drT
qTdrqTdL
e
eaae
BB
PP
)()(
01
01 )1(
CF3 slide 18Zvi Wiener
Assume that dr and dL are jointly normal and use delta approach. Then the gradient vector is
)(
))(1(
qTa
qTaTgrad
One should also check the impact of the second derivative.
For a given variance covariance matrix of the risk factors one can easily construct the level curves of the total risk on the q, a plane.
CF3 slide 19Zvi Wiener
Assuming correlation of 26% between dr and dL we have:
gradgradbenchmportf ../
The resulting contour plot shows the levels of risk for any potential position as seen according to today’s data.
CF3 slide 20Zvi Wiener
0 0.1 0.2 0.3 0.4 0.5
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
spread
OvalsVaR=1bp
VaR=2bp
CF3 slide 21Zvi Wiener
Plan1. Monte Carlo Method
2. Variance Reduction Methods
3. Quasi Monte Carlo
4. Permuting QMC sequences
5. Dimension reduction
6. Financial Applications
simple and exotic options
American type
prepayments
CF3 slide 22Zvi Wiener
Monte Carlo
-1 -0.5 0.5 1
-1
-0.5
0.5
1
CF3 slide 23Zvi Wiener
Monte Carlo Simulation
10 20 30 40
-15
-10
-5
5
10
15
CF3 slide 24Zvi Wiener
Introduction to MC
N
iixf
Ndxxf
1
1
0
)(1
)(
Hopefully due to the strong law of large
numbers the approximation is good.
The idea is very simple
CF3 slide 25Zvi Wiener
Introduction to MC
N
iixf
Ndxxf
1
1
0
)(1
)(
How to determine a well distributed sequence?
How one can generate such a sequence?
How to measure precision?
CF3 slide 26Zvi Wiener
Speed of Convergence
From the central limit theorem the error of approximation is distributed normal with mean 0 and standard deviation
s
dxIxf]1,0[
22 )(
s
dxxfI]1,0[
)(
N
CF3 slide 27Zvi Wiener
Regular Grid
An alternative to MC is using a regular grid to approximate the integral.
Advantages:
The speed of convergence is error~1/N.
All areas are covered more uniformly.
There is no need to generate random numbers.
Disadvantages:
One can’t improve it a little bit.
It is more difficult to use it with a measure.
CF3 slide 28Zvi Wiener
Variance Reduction
Let X() be an option.
Let Y be a similar option which is correlated with X but for which we have an analytic formula.
Introduce a new random variable
YYXX )()()(
CF3 slide 29Zvi Wiener
Variance Reduction
The variance of the new variable is
]var[],cov[2]var[]var[ 2 YYXXX
If 2cov[X,Y] > 2var[Y] we have reduced
the variance.
CF3 slide 30Zvi Wiener
Variance Reduction
The optimal value of is
Then the variance of the estimator becomes:
]var[
],cov[*
Y
YX
]var[)1(]var[ 2* XX XY
CF3 slide 31Zvi Wiener
Variance Reduction
Note that we do not have to use the optimal
* in order to get a significant variance
reduction.
CF3 slide 32Zvi Wiener
Multidimensional Variance Reduction
A simple generalization of the method can be used when there are several correlated variables with known expected values.
Let Y1, …, Yn be variables with known means.
Denote by Y the covariance matrix of variables Y and by XY the n-dimensional vector of covariances between X and Yi.
CF3 slide 33Zvi Wiener
Multidimensional Variance Reduction
Then the optimal projection on the Y plane is given by vector: 1* Y
TXY
The resulting minimum variance is
]var[)1(]var[ 2* XRX XY
where
]var[
12
XR XYY
TXY
XY
CF3 slide 34Zvi Wiener
Variance Reduction
• Antithetic sampling
• Moment matching/calibration
• Control variate
• Importance sampling
• Stratification
CF3 slide 35Zvi Wiener
Monte Carlo
• Distribution of market factors
• Simulation of a large number of events
• P&L for each scenario
• Order the results
• VaR = lowest quantile