Mit Cce
Mit Cce
Mike Giles
University of Oxford
Mathematical Institute
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 1 / 47
Outline
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 2 / 47
Short personal history
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 3 / 47
Research history
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 4 / 47
Research history
Developing HYDRA was too much like hard work, not enough fun
— time for a change
Currently:
50% effort on Monte Carlo methods – half in finance
50% effort on HPC, primarily using GPUs
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 5 / 47
Computational Finance
Might seem a bad time to be in this business, but as an academic it’s fine:
clear need for better models
regulators and internal risk management demanding more simulation
computational finance accounts for 10% of Top500 “supercomputers”
only problem is lack of research funding
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 6 / 47
Computational Finance
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 7 / 47
SDEs in Finance
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 8 / 47
SDEs in Finance
The aim is not to predict exactly what will happen in the future, but
to predict the probability of a range of possible things that might happen,
and compute some averages, or the probability of an excessive loss.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 9 / 47
SDEs in Finance
multiple Geometric Brownian Motion paths
250
200
150
asset value
100
50
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
years
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 10 / 47
SDEs in Finance
Examples:
Geometric Brownian motion (Black-Scholes model for stock prices)
dS = r S dt + σ S dW
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 11 / 47
Generic Problem
W (t) is a Wiener variable with the properties that for any q < r < s < t,
W (t)−W (s) is Normally distributed with mean 0 and variance t −s,
independent of W (r )−W (q).
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 12 / 47
Euler Discretisation
Euler-Maruyama discretisation with timestep h:
bn+1 = S
S bn + a(S
bn , tn ) h + b(S
bn , tn ) ∆Wn
In the scalar case, each ∆Wn is a Normal random variable with mean 0
and variance h.
May seem very simple-minded but it’s hard to improve on the Euler
discretisation, and many codes are this simple.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 13 / 47
The “Greeks”
These are needed for “hedging” – banks try to hold a portfolio of different
financial products so that the effects of the random terms all cancel.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 14 / 47
Monte Carlo simulation
If we want the expected value of a payoff function P which depends
on an underlying quantity S, so that
Z
V = E[P(S)] = P(S) pS (θ; S) dS
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 15 / 47
LRM sensitivity analysis
If pS is a differentiable function of θ, then
Z Z
∂V ∂pS ∂ log pS
= P(S) dS = P(S) pS (S) dS
∂θ ∂θ ∂θ
∂ log pS
= E P(S)
∂θ
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 16 / 47
Pathwise sensitivity analysis
Alternatively, if S depends on θ and an independent random variable Z ,
then Z
V = E[P( S(θ; Z ) )] = P( S(θ; Z ) ) pZ (Z ) dZ
and Z
∂V ∂P ∂S ∂P ∂S
= pZ (Z ) dZ = E ,
∂θ ∂S ∂θ ∂S ∂θ
which gives the pathwise sensitivity estimate
N
X ∂P
N −1
Ṡ (n)
∂S
n=1
where Ṡ is the path sensitivity keeping fixed all of the random numbers.
This is the “natural” sensitivity analysis which comes from differentiating
the original Monte Carlo estimate – this derivation shows the need for
P(S) to be at least continuous.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 17 / 47
“Smoking Adjoints”
My first finance paper in 2006 was with Paul Glasserman from Columbia
Business School:
“Smoking Adjoints: fast Monte Carlo Greeks” in Risk, the leading
monthly publication for the finance industry
explains how to do a discrete adjoint implementation of pathwise
sensitivity analysis for an application needing 100’s of Greeks,
at a cost less than double the original MC cost
Yves Achdou and Olivier Pironneau had previously used adjoints for
finance PDEs, but the technique hadn’t been transferred over to the
Monte Carlo side
absolutely nothing novel from an academic point of view, but has had
an impact in the industry – I think many banks now use it
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 18 / 47
Unsteady adjoints
∂fn ∂fn ∂P
Ṡn+1 = Ṡn + ≡ An Ṡn + bn , Ṗ = ṠN ,
∂Sn ∂θ ∂SN
and therefore, after some rearrangement,
N−1
∂P X
Ṗ = (AN−1 AN−2 . . . An+2 An+1 ) bn .
∂SN
n=0
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 19 / 47
Unsteady adjoints
Equivalently, we have
N−1 N−1
∂P X X
T
Ṗ = (AN−1 AN−2 . . . An+2 An+1 ) bn = vn+1 bn
∂SN
n=0 n=0
Key points:
separate Ṡn calculation required for each input parameter θ
vn doesn’t depend on θ, so just one adjoint computation required
nothing here depends on whether the application is CFD or finance
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 20 / 47
Unsteady adjoints
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 21 / 47
“Vibrato” Monte Carlo
“Vibrato” Monte Carlo combines LRM for the final simulation timestep
with pathwise analysis for the rest of the path calculation.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 22 / 47
“Binning”
Differentiating everything gives the sensitivity of both the estimate and the
confidence interval, but we want the confidence interval for the sensitivity.
In simple cases, compute the sensitivity analysis for each path, then
calculate the confidence interval.
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 23 / 47
More on adjoints for finance
Anyone interested to learn more, please contact me for lecture notes, and
see
http://people.maths.ox.ac.uk/gilesm/libor/
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 24 / 47
Multilevel Monte Carlo
But there’s no iterative solver here – instead just keep the central ideas of
a nested sequence of grids
fine grid accuracy at coarse grid cost
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 25 / 47
Multilevel Monte Carlo
The expected value on the finest level, which is what we want, can be
expressed as a telescoping sum:
L
X
bL ] = E[P
E[P b0 ] + bℓ − P
E[P bℓ−1 ]
ℓ=1
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 26 / 47
Multilevel Monte Carlo
bℓ − P
Key idea: approximate E[P bℓ−1 ] using Nℓ simulations with P
bℓ and P
bℓ−1
obtained using same Brownian path:
Nℓ
X
bℓ = N −1
Y P b (i )
b (i ) − P
ℓ ℓ ℓ−1
i =1
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 27 / 47
Multilevel Monte Carlo
Discrete Brownian path at different levels (with offset for clarity)
3
2.5
1.5
0.5
−0.5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 28 / 47
Multilevel Monte Carlo
GBM paths at different levels (without offsets)
140
135
130
125
120
115
110
105
100
95
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 29 / 47
Multilevel Monte Carlo
If Cℓ is cost of a sample on level ℓ, the variance of the combined estimator
is
X L
Nℓ−1 Vℓ
ℓ=0
and its computational cost is
L
X
Nℓ Cℓ
ℓ=0
iv) Cℓ ≤ c3 2γ ℓ
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 31 / 47
MLMC Theorem
then there exists a positive constant c4 such that for any ε < 1 there exist
L and Nℓ for which the multilevel estimator
L
X
b =
Y bℓ ,
Y
ℓ=0
2
b
has a mean-square-error with bound E Y − E[P] < ε2
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 32 / 47
MLMC Theorem
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 33 / 47
Multilevel Monte Carlo
Finance applications:
SDEs with Euler and Milstein discretisations
jump-diffusion and Lévy processes, either by directly simulating
increments, or by simulating all but the smallest jumps
support for a variety of path-dependent options
◮ digital – discontinuous function of final value
◮ Asian – based on an average over time interval
◮ lookback – based on minimum / maximum over interval
◮ barrier – knocked out if path crosses a certain level
◮ American options – much tougher because of optional early exercise
numerical analysis now exists for most of this
also some work on Multilevel quasi-Monte Carlo (using Sobol points
or rank-1 lattices instead of pseudo-random numbers)
10-15 groups worldwide working on different aspects
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 34 / 47
Back to CFD
I’m now working with Rob Scheichl (Bath) and Andrew Cliffe
(Nottingham) applying these ideas to the modelling of oil reservoirs and
groundwater contamination in nuclear waste repositories.
where the permeability κ(x) is uncertain, and log κ(x) is often modelled as
being Normally distributed with a spatial covariance such as
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 35 / 47
Elliptic SPDE
X
∞ p
log k(x, ω) = θn ξn (ω) fn (x),
n=0
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 37 / 47
Elliptic SPDE
Decay of 1D eigenvalues
0
10
λ=0.01
λ=0.1
λ=1
−2
10
eigenvalue
−4
10
−6
10
0 1 2 3
10 10 10 10
n
Discretisation:
cell-centred finite volume discretisation on a uniform grid – for rough
coefficients we need to make grid spacing very small on finest grid
each level of refinement has twice as many grid points in each
direction
current numerical experiments use a direct solver for simplicity,
but in 3D will use an efficient AMG multigrid solver with a cost
roughly proportional to the total number of grid points
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 39 / 47
2D Results
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 40 / 47
2D Results
2 2
0 0
−2 −2
log2 variance
log2 |mean|
−4 −4
−6 −6
−8 −8
P P
−10 l −10 l
Pl− Pl−1 Pl− Pl−1
−12 −12
0 1 2 3 4 0 1 2 3 4
level l level l
bℓ − P
V[P bℓ−1 ] ∼ h2 bℓ − P
E[P bℓ−1 ] ∼ h2
ℓ ℓ
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 41 / 47
2D Results
8
10
ε=0.0005 Std MC
7 ε=0.001 MLMC
10
ε=0.002
2
ε=0.005 10
6
10 ε=0.01
ε2 Cost
5
Nl
10
1
4 10
10
3
10
2 0
10 10
0 1 2 3 4 −3 −2
10 10
level l accuracy ε
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 42 / 47
Complexity analysis
Relating things back to the MLMC theorem:
bℓ −P] ∼ 2−2ℓ =⇒ α = 2
E[P
Vℓ ∼ 2−2ℓ =⇒ β = 2
Cℓ ∼ 2dℓ =⇒ γ = d (dimension of PDE)
dim MC MLMC
1 ε−2.5 ε−2
2 ε−3 ε (log ε)2
−2
3 ε−3.5 ε−2.5
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 43 / 47
Other SPDE applications
For more on multilevel for SPDEs, see the work of Christoph Schwab and
his group (ETH Zurich):
http://www.math.ethz.ch/∼schwab/
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 44 / 47
Bio-chemical reactions
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 45 / 47
Bio-chemical reactions
This leads to a hierarchy of models:
SSA (Stochastic Simulation Algorithm)
◮ models each individual reaction
τ -leaping method
◮ time-stepping with Poisson model for reactions in each time interval
Langevin equations
◮ an SDE with Brownian noise
◮ limit as Poisson distribution approaches Normal at high rates
“standard” ODEs
◮ limit as std. dev. of Normal distribution becoming negligible relative to
mean
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 46 / 47
Conclusions
Mike Giles (Oxford) CFD to finance (and back?) March 14th, 2013 47 / 47