Lecture outline. Monte Carlo Methods for Uncertainty Quantification. Importance Sampling. Importance Sampling

Similar documents
Monte Carlo Methods for Uncertainty Quantification

Numerical Methods II

Monte Carlo Methods for Uncertainty Quantification

Monte Carlo Methods for Uncertainty Quantification

Chapter 2 Uncertainty Analysis and Sampling Techniques

Module 2: Monte Carlo Methods

Multilevel Monte Carlo for VaR

Quasi-Monte Carlo for finance applications

Quasi-Monte Carlo for Finance Applications

Module 4: Monte Carlo path simulation

Alternative VaR Models

Quasi-Monte Carlo for Finance

Bias Reduction Using the Bootstrap

SIMULATION OF ELECTRICITY MARKETS

IEOR E4703: Monte-Carlo Simulation

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMSN50)

Monte Carlo Methods. Prof. Mike Giles. Oxford University Mathematical Institute. Lecture 1 p. 1.

Monte Carlo Methods in Financial Engineering

"Vibrato" Monte Carlo evaluation of Greeks

Introduction to Algorithmic Trading Strategies Lecture 8

ELEMENTS OF MONTE CARLO SIMULATION

MONTE CARLO EXTENSIONS

Using Halton Sequences. in Random Parameters Logit Models

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMSN50)

An analysis of faster convergence in certain finance applications for quasi-monte Carlo

Financial Risk Management and Governance Other VaR methods. Prof. Hugues Pirotte

Math489/889 Stochastic Processes and Advanced Mathematical Finance Homework 5

Probability. An intro for calculus students P= Figure 1: A normal integral

Strategies for Improving the Efficiency of Monte-Carlo Methods

Math Computational Finance Option pricing using Brownian bridge and Stratified samlping

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMS091)

Computational Finance Improving Monte Carlo

AD in Monte Carlo for finance

Ch4. Variance Reduction Techniques

IEOR E4602: Quantitative Risk Management

Multilevel quasi-monte Carlo path simulation

Monte Carlo Methods for Uncertainty Quantification

Valuation of performance-dependent options in a Black- Scholes framework

Using Monte Carlo Integration and Control Variates to Estimate π

Efficient Deterministic Numerical Simulation of Stochastic Asset-Liability Management Models in Life Insurance

3. Monte Carlo Simulation

Martingales. by D. Cox December 2, 2009

Lecture 17. The model is parametrized by the time period, δt, and three fixed constant parameters, v, σ and the riskless rate r.

arxiv: v1 [math.st] 21 Mar 2016

ROM SIMULATION Exact Moment Simulation using Random Orthogonal Matrices

Modelling Returns: the CER and the CAPM

A general approach to calculating VaR without volatilities and correlations

EFFICIENCY IMPROVEMENT BY LATTICE RULES FOR PRICING ASIAN OPTIONS. Christiane Lemieux Pierre L Ecuyer

10. Monte Carlo Methods

UQ, STAT2201, 2017, Lectures 3 and 4 Unit 3 Probability Distributions.

The Vasicek Distribution

A Matlab Program for Testing Quasi-Monte Carlo Constructions

Geometric tools for the valuation of performance-dependent options

Stratified Sampling in Monte Carlo Simulation: Motivation, Design, and Sampling Error

V ar( X 1 + X 2. ) = ( V ar(x 1) + V ar(x 2 ) + 2 Cov(X 1, X 2 ) ),

Extend the ideas of Kan and Zhou paper on Optimal Portfolio Construction under parameter uncertainty

Fast Convergence of Regress-later Series Estimators

Math Computational Finance Double barrier option pricing using Quasi Monte Carlo and Brownian Bridge methods

IEOR E4703: Monte-Carlo Simulation

MTH6154 Financial Mathematics I Stochastic Interest Rates

Measuring and managing market risk June 2003

Multilevel Monte Carlo for Basket Options

Computer Exercise 2 Simulation

ENHANCED QUASI-MONTE CARLO METHODS WITH DIMENSION REDUCTION

2.1 Mathematical Basis: Risk-Neutral Pricing

IEOR E4703: Monte-Carlo Simulation

Chapter 14 : Statistical Inference 1. Note : Here the 4-th and 5-th editions of the text have different chapters, but the material is the same.

CPSC 540: Machine Learning

Modelling the Sharpe ratio for investment strategies

Characterization of the Optimum

Posterior Inference. , where should we start? Consider the following computational procedure: 1. draw samples. 2. convert. 3. compute properties

AMERICAN OPTION PRICING WITH RANDOMIZED QUASI-MONTE CARLO SIMULATIONS. Maxime Dion Pierre L Ecuyer

Modeling Portfolios that Contain Risky Assets Stochastic Models I: One Risky Asset

Math Option pricing using Quasi Monte Carlo simulation

Tutorial 11: Limit Theorems. Baoxiang Wang & Yihan Zhang bxwang, April 10, 2017

ADVANCED OPERATIONAL RISK MODELLING IN BANKS AND INSURANCE COMPANIES

Statistical Computing (36-350)

IEOR E4703: Monte-Carlo Simulation

CPSC 540: Machine Learning

Martingales, Part II, with Exercise Due 9/21

ASC Topic 718 Accounting Valuation Report. Company ABC, Inc.

Financial Econometrics (FinMetrics04) Time-series Statistics Concepts Exploratory Data Analysis Testing for Normality Empirical VaR

MAS115: R programming Lecture 3: Some more pseudo-code and Monte Carlo estimation Lab Class: for and if statements, input

Overview. We will discuss the nature of market risk and appropriate measures

Homework Assignments

MEASURING PORTFOLIO RISKS USING CONDITIONAL COPULA-AR-GARCH MODEL

Numerical Simulation of Stochastic Differential Equations: Lecture 2, Part 2

Essays on the Random Parameters Logit Model

Quasi-Monte Carlo Methods in Financial Engineering: An Equivalence Principle and Dimension Reduction

Monte Carlo Methods for Uncertainty Quantification

Practical example of an Economic Scenario Generator

MAS187/AEF258. University of Newcastle upon Tyne

Monte Carlo Simulation of a Two-Factor Stochastic Volatility Model

Point Estimation. Stat 4570/5570 Material from Devore s book (Ed 8), and Cengage

STATS 200: Introduction to Statistical Inference. Lecture 4: Asymptotics and simulation

Final exam solutions

Monte Carlo Methods in Finance

Contents Critique 26. portfolio optimization 32

Central limit theorems

5.3 Statistics and Their Distributions

Transcription:

Lecture outline Monte Carlo Methods for Uncertainty Quantification Mike Giles Mathematical Institute, University of Oxford KU Leuven Summer School on Uncertainty Quantification Lecture 2: Variance reduction importance sampling stratified sampling Latin Hypercube randomised quasi-monte Carlo May 30 31, 2013 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 1 / 37 Importance Sampling Importance sampling involves a change of probability measure. Instead of taking X from a distribution with p.d.f. p 1 (X ), we instead take it from a different distribution with p.d.f. p 2 (X ). E 1 [f (X )] = f (X ) p 1 (X ) dx = f (X ) p 1(X ) p 2 (X ) p 2(X ) dx = E 2 [f (X ) R(X )] where R(X ) = p 1 (X )/p 2 (X ) is the Radon-Nikodym derivative. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 2 / 37 Importance Sampling We want the new variance V 2 [f (X ) R(X )] to be smaller than the old variance V 1 [f (X )]. How do we achieve this? Ideal is to make f (X )R(X ) constant, so its variance is zero. More practically, make R(X ) small where f (X ) is large, and make R(X ) large where f (X ) is small. Small R(X ) large p 2 (X ) relative to p 1 (X ), so more random samples in region where f (X ) is large. Particularly important for rare event simulation where f (X ) is zero almost everywhere. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 3 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 4 / 37

Importance Sampling Importance Sampling Simple example: want to estimate E[X 8 ] when X is a N(0, 1) Normal random variable. Here p 1 (x) = φ(x) 1 2π exp( 1 2 x2 ) but what should we choose for p 2 (x)? Want more samples in extreme tails, so instead take samples from a N(0, σ 2 ) distribution with σ >1: p 2 (x) = 1 2π σ exp( 1 2 x2 /σ 2 ) The Radon-Nikodym derivative is ) R(X ) = exp ( x2 1 / exp 2 σ 2 ( = σ 2 exp x2 (σ2 2 1) ) 2 σ2 2 > 1 for small x 1 for large x ( x2 2 σ 2 2 This is good for applications where both tails are important. If only one is important then it might be better to shift the mean towards that end. ) Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 5 / 37 Importance Sampling Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 6 / 37 Note that V 2 [f (X ) R(X )] = E 2 [f (X ) 2 R(X ) 2 ] (E 2 [f (X ) R(X )]) 2 = E 1 [f (X ) 2 R(X )] (E 1 [f (X )]) 2 so to minimise the variance we can try to minimise E 1 [f (X ) 2 R(X )]. If the new distribution is defined parametrically (e.g. a Normal distribution N(µ, σ 2 ) with mean µ and variance σ 2 ) then we have an optimisation problem: Find µ, σ to minimise E 1 [f (X ) 2 R(X )] Can use a few samples to estimate E 1 [f (X ) 2 R(X )] and do the optimisation, then use those values of µ, σ to construct the real estimate for E 2 [f (X ) R(X )]. The key idea is to achieve a more regular sampling of the most important dimension in the uncertainty. Start by considering a one-dimensional problem: I = 1 0 f (U) du. Instead of taking N samples, drawn from uniform distribution on [0, 1], instead break the interval into M strata of equal width and take L samples from each. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 7 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 8 / 37

Define U i to be the value of i th sample from strata, With stratified sampling, F = L 1 i f (U i ) = average from strata, E[F ] = M 1 E[F ] = M 1 µ = µ F = M 1 F = overall average so it is unbiased. and similarly let The variance is µ = E[f (U) U strata ], σ 2 = V[f (U) U strata ], µ = E[f ], σ 2 = V[f ]. V[F ] = M 2 V[F ] = M 2 L 1 = N 1 M 1 where N = LM is the total number of samples. σ 2 σ 2 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 9 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 10 / 37 Without stratified sampling, V[F ] = N 1 σ 2 with σ 2 = E[f 2 ] µ 2 = M 1 E[f (U) 2 U strata ] µ 2 = M 1 (µ 2 + σ 2 ) µ 2 = M 1 ( (µ µ) 2 + σ 2 ) M 1 σ 2 How do we use this for MC simulations? For a one-dimensional application: Break [0, 1] into M strata For each stratum, take L samples U with uniform probability distribution Compute average within each stratum, and overall average. Thus stratified sampling reduces the variance. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 11 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 12 / 37

Application MATLAB code: Test case: European call r =0.05, σ =0.5, T =1, S 0 =110, K =100, N =10 4 samples M L MC error bound 1 10000 1.39 10 1000 0.55 100 100 0.21 1000 10 0.07 for M = [1 10 100 1000] L = N/M; ave=0; var=0; for m = 1:M U = (m-1+rand(1,l))/m; Y = ncfinv(u); S = S0*exp((r-sig^2/2)*T + sig*sqrt(t)*y); F = exp(-r*t)*max(0,s-k); ave1 = sum(f)/l; var1 = (sum(f.^2)/l - ave1^2)/(l-1); ave = ave + ave1/m; var = var + var1/m^2; end end Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 13 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 14 / 37 Sub-dividing a stratum always reduces the variance, so the optimum choice is to use 1 sample per stratum However, need multiple samples in each stratum to estimate the variance and obtain a confidence interval. This tradeoff between efficiency and confidence/reliability happens also with quasi-monte Carlo sampling Despite this, worth noting that when using ust 1 sample per stratum, the variance of the overall estimator is O(N 3 ), much better than the usual O(N 1 ). For a multivariate application, one approach is to: Break [0, 1] into M strata For each stratum, take L samples U with uniform probability distribution Define X 1 = Φ 1 (U) Simulate other elements of X using standard Normal random number generation Multiply X by matrix C to get Y = C X with desired covariance Compute average within each stratum, and overall average Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 15 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 16 / 37

The effectiveness of this depends on a good choice of C. Ideally, want the function f (Y ) to depend solely on the value of X 1 so it reduces to a one-dimensional application. Not easy in practice, requires good insight or a complex optimisation, so instead generalise stratified sampling approach to multiple dimensions. For a d-dimensional application, can split each dimension of the [0, 1] d hypercube into M strata producing M d sub-cubes. One generalisation of stratified sampling is to generate L points in each of these hypercubes However, the total number of points is L M d which for large d would force M to be very small in practice. Instead, use a method called Latin Hypercube sampling Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 17 / 37 Latin Hypercube Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 18 / 37 Latin Hypercube Generate M points, dimension-by-dimension, using 1D stratified sampling with 1 value per stratum, assigning them randomly to the M points to give precisely one point in each stratum This gives one set of M points, with average f = M 1 M m=1 f (U m ) Since each of the points U m is uniformly distributed over the hypercube, E[f ] = E[f ] The fact that the points are not independently generated does not affect the expectation, only the (reduced) variance Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 19 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 20 / 37

Latin Hypercube Latin Hypercube We now take L independently-generated set of points, each giving an average f l. Averaging these L 1 L l=1 gives an unbiased estimate for E[f ], and the empirical variance for f l gives a confidence interval in the usual way. f l Note: in the special case in which the function f (U) is a sum of one-dimensional functions: f (U) = i f i (U i ) where U i is the i th component of U, then Latin Hypercube sampling reduces to 1D stratified sampling in each dimension. In this case, potential for very large variance reduction by using large sample size M. Much harder to analyse in general case. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 21 / 37 Quasi Monte Carlo Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 22 / 37 Quasi Monte Carlo Standard Monte Carlo approximates high-dimensional hypercube integral [0,1] d f (x) dx by 1 N N f (x (i) ) i=1 with points chosen randomly, giving r.m.s. error proportional to N 1/2 confidence interval Standard quasi Monte Carlo uses the same equal-weight estimator 1 N N f (x (i) ) i=1 but chooses the points systematically so that error roughly proportional to N 1 no confidence interval (We ll get the confidence interval back later by adding in some randomisation!) Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 23 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 24 / 37

Quasi-Monte Carlo The key is to use points which are fairly uniformly spread within the hypercube, not clustered anywhere. There is theory to prove that for certain point constructions, and certain function classes, Error < C (log N)d N for small dimension d, (d <10?) this is much better than N 1/2 r.m.s. error for standard MC for large dimension d, (log N) d could be enormous, so not clear there is any benefit Rank-1 Lattice Rule A rank-1 lattice rule has the simple construction x (i) = i N z mod 1 where z is a special d-dimensional generating vector with integer components co-prime with N (i.e. GCF is 1) and r mod 1 means dropping the integer part of r In each dimension k, the values x (i) k are a permutation of the equally spaced points 0, 1/N, 2/N... (N 1)/N which is great for integrands f which vary only in one dimension. Also very good if f (x) = k f k (x k ). Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 25 / 37 Rank-1 Lattice Rule Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 26 / 37 Sobol Sequences Two dimensions: 256 points rank 1 lattice 1 1 random points Sobol sequences x (i) have the property that for small dimensions d <40 the subsequence 2 m i < 2 m+1 has precisely 2 m d points in each sub-unit formed by d bisections of the original hypercube. x 2 0.8 0.6 0.4 0.2 x 2 0.8 0.6 0.4 0.2 For example: cutting it into halves in any dimension, each has 2 m 1 points cutting it into quarters in any dimension, each has 2 m 2 points cutting it into halves in one direction, then halves in another direction, each quarter has 2 m 2 points etc. 0 0 0.5 1 x 1 0 0 0.5 1 x 1 The generation of these sequences is a bit complicated, but it is fast and plenty of software is available to do it. MATLAB has sobolset as part of the Statistics toolbox. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 27 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 28 / 37

Randomised QMC Randomised QMC In the best cases, QMC error is O(N 1 ) instead of O(N 1/2 ) but without a confidence interval. To get a confidence interval using a rank-1 lattice rule, we use several sets of QMC points, with the N points in set m defined by ( ) i x (i,m) = N z + X (m) mod 1 where X (m) is a random offset vector, uniformly distributed in [0, 1] d For each m, let f m = 1 N N f (x (i,m) ) This is a random variable, and since E[f (x (i,m) )] = E[f ] it follows that E[f m ] = E[f ] By using multiple sets, we can estimate V[f ] in the usual way and so get a confidence interval i=1 More sets = better variance estimate, but poorer error. Some people use as few as 10 sets, but I prefer 32. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 29 / 37 Randomised QMC For Sobol sequences, randomisation is achieved through digital scrambling: x (i,m) = x (i) X (m) where the exclusive-or operation is applied bitwise so that 0.1010011 0.0110110 = 0.1100101 The benefit of the digital scrambling is that it maintains the special properties of the Sobol sequence. MATLAB s sobolset supports digital scrambling. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 30 / 37 Dominant Dimensions QMC points have the property that the points are more uniformly distributed through the lowest dimensions. Consequently, important to think about how the dimensions are allocated to the problem. Previously, have generated correlated Normals through Y = L X with X i.i.d. N(0, 1) Normals. For Monte Carlo, Y s have same distribution for any L such that LL T = Σ, but for QMC different L s are equivalent to a change of coordinates and it can make a big difference. Usually best to use a PCA construction L = U Λ 1/2 with eigenvalues arranged in descending order, from largest (= most important?) to smallest. Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 31 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 32 / 37

Finance Applications 1D call option Monte Carlo convergence Finance Applications 1D call option Sobol QMC convergence 10 1 MC convergence Error MC error bound 10 1 QMC convergence Error QMC error bound 10 0 10 0 10 1 Error Error 10 1 10 2 10 3 10 2 10 2 10 3 10 4 10 5 10 6 N 10 4 10 2 10 3 10 4 10 5 10 6 M*N Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 33 / 37 Application Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 34 / 37 Final comments Main piece of MATLAB code: M = 2^p; N = 64; % number of points in each set % number of sets of points for n = 1:N Ps = sobolset(1); % dimension 1 Ps = scramble(ps, MatousekAffineOwen ); U = net(ps,m) ; Y = ncfinv(u); % inverts Normal cum. fn. S = S0*exp((r-sig^2/2)*T + sig*sqrt(t)*y); F = exp(-r*t)*max(0,s-k); Fave(n) = sum(f)/m; end Control variates can sometimes be very useful needs good insight to find a suitable control variate Importance sampling is very useful when the main contribution to the expectation comes from rare extreme events Stratified sampling is very effective in 1D, but not so clear how to use it in multiple dimensions Latin Hypercube is one generalisation particularly effective when function can be almost decomposed into a sum of 1D functions V = sum(fave)/n; sd = sqrt((sum(fave.^2)/n - (sum(fave)/n)^2)/(n-1)); Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 35 / 37 Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 36 / 37

Final words quasi-monte Carlo can give a much lower error than standard MC; O(N 1 ) in best cases, instead of O(N 1/2 ) randomised QMC is important to regain confidence interval correct selection of dominant dimensions can also be important Hard to predict which variance reduction approach will be most effective Advice: when facing a new class of applications, try each one, and don t forget you can sometimes combine different techniques (e.g. stratified sampling with antithetic variables, or Latin Hypercube with importance sampling) Mike Giles (Oxford) Monte Carlo methods May 30 31, 2013 37 / 37