Euler–Milstein and Monte Carlo Extensions

Euler Milstein

We will expand on the variance reduction techniques, we will repeat a couple things from last week.

But before we do that, we should talk about Euler Milstein or Euler Maruyama.

𝑃𝑒𝑜𝑝𝑙𝑒𝑘𝑒𝑒𝑝𝑡𝑎𝑙𝑘𝑖𝑛𝑔.𝐼𝑡ℎ𝑢𝑟𝑡𝑠𝐹𝑙𝑜𝑟𝑒𝑠𝑐𝑢𝑏𝑒𝑐𝑎𝑢𝑠𝑒ℎ𝑒ℎ𝑎𝑠𝑎𝑑𝑖𝑠𝑒𝑎𝑠𝑒𝑐𝑎𝑙𝑙𝑒𝑑𝐴𝐷𝐻𝐷.

This is a better approximation. I’m going to show you this because it involves applying Itô’s formula a bunch.

Here is the stochastic process we can approximate. Euler works for any stochastic process, but Milstein has to be homogeneous, like so:

𝑑𝑋𝑡=𝛼(𝑋𝑡)𝑑𝑡+𝛽(𝑋𝑡)𝑑𝑊𝑡

These coefficients are not functions of time, so they are homogeneous.

The idea is to use Itô for both 𝛼 and 𝛽. They are functions of stochastic process 𝑋𝑡. Therefore I can use Itô for both.

I get

𝑑𝛼(𝑋𝑡)=𝛼′(𝑋𝑡)𝑑𝑋𝑡+12𝛼″(𝑋𝑡)(𝑑𝑋𝑡)2

This is Itô, so we are lacking the dt, that term would screw up our calculations.

Now we substitute 𝑋𝑡 here, so we get

The dX^2 gets eliminated

=𝛼′(𝑋𝑡)𝛼(𝑋𝑡)𝑑𝑡+𝛼′(𝑋𝑡)𝛽(𝑋𝑡)𝑑𝑊𝑡+12𝛼″(𝑋𝑡)𝛽2(𝑋𝑡)𝑑𝑡

If I just group these terms and drop 𝑋𝑡 all over the place to make it easier to write:

=(𝛼′𝛼+12𝛼″𝛽2)𝑑𝑡+𝛼′𝛽𝑑𝑊𝑡

Now, if we do the same calculation/derivation for 𝛽, then we basically get something very similar. We’re not going to go through the entire calculation. You can derive this yourself,

𝑑𝛽(𝑋𝑡)=(…)𝑑𝑡+…+𝑑𝑊𝑡

Writing in integral from,

Now we substitute 𝛼 and 𝛽 from the same formula. So there are two integrals:

X\_{t+\\Delta t} \- X\_t \= \\int\_t^{t+\\Delta t}

When we substitute, we will get four terms, two terms for 𝛼 and 𝛽 each.

We will get terms such as

𝑑𝑠𝑑𝑢∼𝑂(Δ𝑡2)

We will change the letters to make sure they’re right, based on what our dummy variables are

𝑑𝑠𝑑𝑊𝑢≈𝑑𝑢𝑑𝑊𝑠∼𝑂(Δ𝑡32)

Because 𝑑𝑠 is order Δ𝑡, and 𝑑𝑊𝑡 is order Δ𝑡

Then there is

𝑑𝑊𝑢𝑑𝑊𝑠∼𝑂(Δ𝑡)

For the reason just discussed.

Once I substitute everything, I will neglect the first two orders, and will be left with terms with just du and ds

𝑑𝑢𝑑𝑠

The existing equation then simplifies a lot

𝑋𝑡+Δ𝑡=𝑋𝑡+𝛼(𝑋𝑡)Δ𝑡+𝛽(𝑋𝑡)Δ𝑊𝑡+∫𝑡𝑡+Δ𝑡∫𝑡𝑢𝛽𝑠′𝛽𝑠𝑑𝑊𝑠𝑑𝑊𝑢

And there’s another integral term you can see here.

You need to take the increments of Brownian motion and such, but then you can show that the integral term is equal to the

=𝛽𝑡′𝛽𝑡12(Δ𝑊𝑡−Δ𝑡)

This gives the Euler Milstein scheme.

The 𝑋𝑡+Δ𝑡 is what you’re approximating. The first part is the regular Euler, and then the integrals are the Milstein part.

If the model

𝑑𝑋𝑡=𝛼(𝑋𝑡)𝑑𝑡+𝛽(𝑋𝑡)𝑑𝑊𝑡

, then the Euler Milstein scheme is

𝑋𝑡+Δ𝑡=𝑋𝑡+𝛼(𝑋𝑡)Δ𝑡+𝛽(𝑋𝑡)Δ𝑊𝑡+12𝛽′(𝑋𝑡)𝛽(𝑋𝑡)(Δ𝑊𝑡2−Δ𝑡)

And by 𝑊 you introduce a normal variable multiplied by

𝑍∼𝑁(0,1)

. The Δ𝑊 is created by

𝑍Δ𝑡

. The other one is

(𝑍2−1)Δ𝑡

when the thing factors. For the same increment, you put it in two places, not just one places.

However, there is a possible issue, which might be the derivative. If the 𝛽 function, the volatility part, if it’s complicated, how do you calculate the derivative? That might be hard. There’s another way to deal with this, a scheme called Runge-Kutta, a generalization where you calculate the Euler part, and plug it into the 𝛽, then you calculate the finite difference as an approximation of the derivative.

One more thing to mention. Which I shouldn’t, because it’s from the homework. Let’s have an example.

We have a process

𝑑𝑌𝑡=𝜅(𝑦̄−𝑌𝑡)𝑑𝑡+𝜎𝑦𝑡𝑑𝑊𝑡

This is the CIR process.

In this process, I have my

𝛼(𝑥)=𝜅(𝑌̄−𝑥)

Then you have 𝛽

𝛽(𝑥)=𝜎𝑥

If we now substitute in this formula, we have to calculate the derivative.

𝛽′(𝑥)=𝜎2𝑥

Now if we do Euler Milstein:

𝑌𝑡+Δ𝑡=𝑌𝑡+𝜅(𝑌̄−𝑌𝑡)Δ𝑡+𝜎𝑌𝑡Δ𝑊𝑡+ milstein correction: 𝜎𝑌𝑡𝜎2𝑌𝑡(Δ𝑊𝑡2−Δ𝑡)

Here, the two 𝑌𝑡 terms cancel, so it becomes 𝜎2/2.

The other thing to show is that if you look for example, this process.

𝑑𝑋=𝑒𝑋𝑡cos𝑋𝑡𝑑𝑡+0.7𝑑𝑊𝑡

Here, you have this constant

𝛽(𝑋𝑡)=0.7

So

𝛽′(𝑋𝑡)=0

Therefore there is no Euler-Milstein correction, because it relies on multiplication by the derivative. Like for example in GBM.

Variance Reduction Redux

More of the idea to use on HW 4.

One additional note will be given on antithetic variate.

We discussed the CLT and the basis of the whole thing, and the variance being smaller gives you better estimates.

However, this is more complicated than that.

The better method is not always the one with smaller variability of the sample paths.

We also need to consider the time to generate paths. If you have a Monte Carlo technique with less variability, but it takes one minute to generate a path, then it could be that another method with much higher variability that can generate 1 per second, is better, just by raw brute force. The paper mentioned is really good, the basis of the Monte Carlo book, which expands on the paper. Boyle is a Canadian professor from University of Waterloo, in 1997 they met, he did a summer school. He was drunk all the time in the morning lectures. Glasserman is a friend of the show as well. Third guy Brodie sucks.

If method 1 has variance 𝜎12, and 𝑏1, they have a term called “work”, which could be time, but could be other stuff, 𝑏1 is the work to generate one replication of the final parameter, the one you’re trying to estimate, then we need to look at

𝜎12𝑏1<𝜎22𝑏2

He has a better expression, but I’m showing the simple thing. Why multiplication? There’s a reason

If you look at this perspective, and if you rewrite this as

𝜎12𝜎22<𝑏2𝑏1

That’s when you would prefer one method over another.

Antithetic note:

Reminder: The way it works is you create one normal for one path, and use the negative of that normal for another path.

For antithetic variates, one replicate is

𝑐𝑖+𝑐𝑖𝑎2=𝐶𝑖̄

The actual estimate is the average of the 2. This is not necessarily important for the final pricing, because if you take the general average, it doesn’t matter, but it’s important for the variance estimate, for confidence intervals.

This is because these paths are not independent, they’re very related. So you would use something like

Variance=1𝑛−1∑𝑖−1𝑛(𝐶𝑖̄−𝐶̄)2

This is important because each sequence of n is independent.

You might think I should iterate over 2n elements instead of n. and do both the regular and antithetic.

But this one will show less than it really is.

Control Variates for the Asian Option

Glasserman’s explanation is better than mine, I will follow him.

The one with Δ-hedging and Asian option. There’s nothing wrong with Δ-hedging or Asian option, it’s just that it needs to be explained where it’s coming from.

The control variate for Monte Carlo, what it does, it should be called “use what you know”. You know, for example, that the option that Δ-hedges, you’re using the concept that if you do this very fast, the two values should be the same.

Similarly, for the Asian option, we’re using what we know.

𝑃𝐴

is the price of an Asian option based on Arithmetic average, which is what is encountered in practice.

𝑃𝐺

is geometric.

This 𝑃𝐺 has a formula, and for any variation on Asian options it’s very easy to get a geometric formula.

We’ll say we have a formula, if you give me characteristics and 𝜇 and 𝜎, you get an exact number.

With this, let

𝑃𝐴̂

be the value calculated using a single path.

It doesn’t matter what you use, just one single path, where you calculate the value of the Asian option based on this average of all these paths.

And we’ll do the same for geometric

𝑃𝐺̂

We don’t need this for geometric because we have the formula.

We are using the same path for both of these.

I do know that

𝔼[𝑃𝐴̂]=𝑃𝐴

On expectation, I get the true vlau eof my option.

I also know

𝔼[𝑃𝐺̂]=𝑃𝐺

If we subtract, we get

𝑃𝐴−𝑃𝐺=𝔼[𝑃𝐴̂−𝑃𝐺̂]

This gives you a very natural kind of estimate.

𝑃𝐴=𝑃𝐺+𝔼[𝑃𝐴̂−𝑃𝐺̂]

We can create a Monte Carlo path using this control variate:

𝑃𝐴̂𝑐𝑣=𝑃𝐴̂−𝑃𝐺̂+𝑃𝐺

If I create a new path and average this, then it should give me on average this difference

You can write it like this

=𝑃𝐴̂+(𝑃𝐺−𝑃𝐺̂)

That parentheses statement is the control variate. I have my original path with Euler Milstein, then I control it.

For every path, I obtain the difference between the true value and the value of geometric from that particular path. But is this better than just using

𝑃𝐴̂

?

If we want, we can calculate the variance. So the variance should be less. And remember that

𝑃𝐺

is just a number, a constant with no variance.

𝕍[𝑃𝐴̂𝑐𝑣]=𝕍[𝑃𝐴̂]+𝕍[𝑃𝐺̂]−2Cov(𝑃𝐴̂,𝑃𝐺̂)

Everything after the first term should be negative to give me a better variance. The covariance should be greater than the variance. It’s only worth it if the covariance is large.

This brings the next idea. This is the original term plus this term. I can control the size of the difference, which puts a 𝛽 on the coefficient. That 𝛽 allows me to make the thing smaller. This is all specific to the Asian option, where there is this arithmetic and geometric thing. But there is no assumption about the stochastic model.

𝛽 means I’m going to parameterize this:

𝑃𝐴̂𝛽=𝑃𝐴̂+𝛽(𝑃𝐺−𝑃𝐺̂)

I can play around with 𝛽 in such a way that the resulting variance is the smallest. What is that? We can do the same exact calculation, and minimize the result with respect to 𝛽.

𝕍[𝑃𝐴̂𝛽]=𝕍[𝑃𝐴̂]+𝛽2𝕍[𝑃𝐺̂]−2𝛽Cov(𝑃𝐴̂,𝑃𝐺̂)

This is a quadratic expression. It’s a parabola, so the smallest value is in the vertex. The position of the vertex is obtain for

𝛽min=−𝑏2𝑎

Where the varG is a, and the cov stuff is b.

=−−2Cov(𝑃𝐴̂,𝑃𝐺̂)2𝕍[𝑃𝐺̂]

This cancels to:

=Cov(𝑃𝐴̂,𝑃𝐺̂)𝕍[𝑃𝐺̂]

If you have two variables, the regression is the covariance divided by the variance, so this is the formula for market 𝛽/regression.

So if we regress

𝑃𝐴̂=𝛼+𝛽𝑃𝐺̂+𝜖

, the 𝛽 is the 𝛽.

Last week, we learned this was true, but now we know how to get it.

This control variate thing is basically

𝑃𝐴̂𝛽=𝑃𝐴̂+𝛽̂(𝑃𝐺−𝑃𝐺̂)

Now we have another problem.

This is kinda screwed up. Because you’re using the same paths to estimate 𝛽, and the same path to estimate the value of the option. That introduces a bias, and this is calculated in the Glasserman paper.

Typically you have 𝑛 paths, and you set 𝑛1 paths out to do regression. Then you use 𝑛−𝑛1 paths for calculation.

The advantage here is to do a proper regression, you don’t need a lot of observations, 100 would be plenty. But for Monte Carlo, you need hundreds of thousands.

Hopefully this is more clear, and what I hope you get is that he used the particular relationship that exists in the Asian option, to reason through the whole thing.

I’m going to make another expansion to this. We can introduce more control!!

It’s not really necessary because this existing control variate already gives a good estimate, but this shows you can introduce as many control as you like!

Under risk-neutral equivalent martingale measure, we have

𝑆0=𝔼𝑄[𝑆𝑇𝑒−𝑟𝑇]

If you take the stock price as a martingale, and discount it back, you should get 𝑆0. Nothing new.

This brings up another way to control.

We use the following, with 𝛽1 being our original control variate.

𝑃𝐴̂𝑐𝑣=𝑃𝐴̂+𝛽1(𝑃𝐺−𝑃𝐺̂)+𝛽2(𝑆0−𝑆𝑇̂𝑒−𝑟𝑇)

Now you have the path, you know what 𝑆𝑇 is, and 𝑆0 is a constant.

You have the same kind of regression of

𝑃𝐴̂=𝛼+𝛽1𝑃𝐺̂+𝛽2𝑆𝑇̂+𝜖

The constants don’t matter because you’re doing a regression, it just changes the y-intercept, doesn’t impact the 𝛽.

Technically, it’s 𝜎𝑡, which is the confidence interval size, the diffusion size. It’s an estimate, work could refer to other things.

Moment Matching Method

This is simple to use, so I’ll mention it, even though it’s useless.

If we have

𝑍1,…𝑍𝑛∼𝑁(0,1)

They should have theoretical mean 0, but the sample mean is not 0.

The idea is to modify the sample to match the theoretical moments.

The reason I actually have never taught this method is because it’s kinda stupid, as a statistician.

Also, from the raw power of this method, it doesn’t do better than straight Monte Carlo. It does better when you pair it with control variate, where the power comes from the control variate.

In the example here, the random variables don’t have mean 0, so instead use

𝑍1−𝑍̄,𝑍2−𝑍̄,…

These now all have mean 0, but now they’re correlated. So it creates problems when estimating stdev, it becomes bad, very tricky for estimating confidence intervals.

In the example, let’s say I’m going to price a European option based on GBM. When you do GBM, you don’t have to do all the intermediate steps, you can do all in one step. Because the terminal value

𝑆𝑇̃(𝑖)=𝑆0𝑒(𝑟−𝜎22)𝑇+𝜎𝑇𝑍̃𝑖

After you modify the normal variable with the thing I said.

This is fine for European options, but it won’t work for path-dependent options.

Confidence intervals are hard to obtain.

This is the first order moment matching. You can also do second order moment matching. Say we want to create

𝑁(𝜇𝑍,𝜎𝑍2)

I’m trying to create numbers that are normal with this particular target. The usual thing to do here is

𝑍𝑖∼𝑁(0,1)→𝜎𝑍𝑍𝑖+𝜇𝑍

Multiply to create the desired distribution.

But the numbers in the sample will have their own sample mean and stdev. So you have to modify this as

𝑍𝑖̃=𝜎𝑍𝑆𝑍(𝑍𝑖−𝑍̄)+𝜇𝑍

Each number is modified by these two numbers 𝑆𝑍 and 𝑍̄, where 𝑆𝑍 is the sample stdev.

𝑆𝑍=1𝑛−1∑(𝑍𝑖−𝑍̄)2

For the random variables in the sample, they will have the desired distribution.

Like I said, this is a method from the 90s. I never liked it because it’s slower. All these modifications…

And in order to estimate the sample 𝜇 and stdev, I have to do all of the simulations first, then calculate the samples, then plug them back, so it’s SLOWER than doing it all at once.

And generally, from my experience, improvement is marginal, it’s not particularly useful.

Is the sample calculated in one path or all paths? It depends. In this example, you need all the paths. But you can do it for one path if you like.

Computationally, when you have numbers that you’re observing, if I have to estimate an average or variance of a certain number of them, theoretically, I can do this.

The idea of the GPU is that you have a lot of matrices and you do these calculations really fast. There is a memory of GPU and a memory of CPU. You want to keep everything in GPU memory as much as possible. The problem is that this method aggregates the paths, and does it again, which is impossible with a GPU.

Additional Stuff

Stratified sampling is not the best explained here. It is a statistics technique, check any statistics book they will explain better there.

Importance sampling, same deal. I have a chapter in my book about importance sampling which is way better.

Conditional MC: very well explained in the paper

Low discrepancy sequences. (Quasi-Monte Carlo techniques). It’s not explained well in the paper, but you can look it up and read better papers.

Briefly:

when you start generating one dimensional random variables, we’ll say for a uniform distribution, we can use testers to see if the numbers are actually uniform.

Then you can generate pairs, two at a time (𝑋1,𝑋2) and plot them. You should definitely do this experiment with a random number generator. It would not look uniform at all. Human mind when you say uniform, thinks that it’s perfectly spread out. The point of the quasi generator is to spread out on purpose, to get a perfect uniform distribution. It’s okay as an exhaustive search method. But if you need more points, you have to quadruple them to have the same spread everywhere. The more detail you want, the finer quasi becomes, and it gets a lot slower.

But there are circumstances in which this is useful, and people in engineering that don’t understand randomness like this thing.

Chapter 5 is about estimating American options using Monte Carlo simulations.

subjective probability

George Calhoun sent an article to me in Nature

Trump’s election is a subjectiv eprobabiolity, it matters what people’s perceptions are.

A stock, TSLA. It’s been going down, so you’r wondering if it should keep going down or should it stabilize? And we don’t know because the stock is not the value of the company, it reflects the perception of people about the company.

It’s the same as poker. Game theory is so close to probability.

When people lose concentration, they react poorly.

Generating Correlated Processes

If you have multiple stock processes that you want to generate that are correlated, how do you do that?

Each asset looks like

𝑑𝑋𝑡𝑖=𝑓(𝑋𝑡𝑖)𝑑𝑡+𝑔(𝑋𝑡𝑖)𝑑𝑊𝑡𝑖

Each is a separate stochastic process, but they don’t move their own way at random.

This Brownian motion is correlated.

If we take the notation

𝑋𝑡

the vector of components, and same for f(x). This is the simpler case. You can have a more complicated thing. Each function could depend on all the other ones, it doesn’t have to be driven by just one variable.

g(x) is a matrix dxd size, where dW is dx1, the vector of Brownian motion.

When you do the Monte Carlo simulation, the Brownian motion is what you’re interested in simulating.

We will assume that these are correlated. With this notation, we have

𝑑𝑋𝑡=𝑓(𝑋𝑡)𝑑𝑡+𝑔(𝑋𝑡)𝑑𝑊𝑡

It’s more complicated because it’s a collection of multiple integrals on dW, but we will write like this for conciseness.

We have the covariance matrix

Cov(Δ𝑊𝑡)=ΣΔ𝑡

This is Brownian motion. So what exactly is the covariance matrix? The components are the covariances of each of the components.

[1𝜌12𝜌13𝜌1𝑑]

Symmetric and positive definite matrix!

Positive is vector times matrix times vector transpose, which is a 1x1 number. Positive definite means that for a vector u, this is always greater than 0. This is very important because you can take a vector multiply with vector which will give us the variance, which will be always positive.

For example, take Heston

𝑑𝑆𝑡=𝑟𝑆𝑡𝑑𝑡+𝑌𝑡𝑆𝑡𝑑𝑊𝑡1𝑑𝑌𝑡=𝛼(𝑌̄−𝑌𝑡)𝑑𝑡+𝜎𝑌𝑡𝑑𝑊𝑡2

If I want to simulate this, which is part of homework, how would you do this?

Generate two random numbers which are correlated with 𝜌.

For two, it’s very simple.

We need

𝑋1,𝑋2∼𝑁(0,1)

, such that

Corr(𝑋1,𝑋2)=𝜌

Then we can multiply by Δ𝑡 and everything will work.

We will start with uncorrelated 𝑍1,𝑍2∼𝑁(0,1). I’ll take 𝑋1=𝑍1.

Then, I’ll take 𝑋2=𝜌𝑍1. We can do this because the variance of 𝑍1 is 1, and covariance of 𝑍1 and 𝑍2=0;

The combination has to have variance of 1, and if we’re combining linear combinations, then it’s normal.

So total value is

𝑋2=𝜌𝑍1+1−𝜌2𝑍2

If you understand the principle, what do I do when I want to do three? 𝑋1,𝑋2,𝑋3

Take the same idea

𝑋1=𝑍1𝑋2=𝜌12𝑍1+1−𝜌122𝑍2????𝑋3=𝜌13𝑍1????

It becomes tricky. So is there a method to do this?

There is! You should know where this is coming from

We have a vector 𝑋 which is a lot of 𝑋s. We are interested in covariance, which is distinct from correlation. Our covariance matrix will be one diagonal, where we multiply by Δ𝑡. The values on the diagonal of the matrix are the variance, and the rest are covariance.

So how do I generate a vector with this covariance structure? Here is the idea.

If 𝑋 is a random vector, (more details you could talk about in 540) with mean 𝜇, componentwise for each element in vector, then

Cov(𝑋)=𝔼[(𝑋−𝜇)(𝑋−𝜇)𝑇]

Take 𝑌=𝐴𝑋. 𝐴 is a matrix, but it can be ANY DIMENSION 𝑛×𝑑. We can transform 4 components into 15 components with different linear combinations.

The basis of the whole method is this:

Cov(𝑌)=𝔼[(𝑌−𝜇𝑌)𝑌−𝜇𝑦)𝑇]

And we know that the expectation of Y from linear combination si

𝔼[𝑌]=𝐴𝔼[𝑋]

Because of this, we get

=𝔼[(𝐴𝑋−𝐴𝜇𝑋)(𝐴𝑋−𝐴𝜇𝑋)𝑇]

And you can factor this. Remember that the order is very important.

=𝔼[𝐴(𝑋−𝜇𝑋)(𝐴𝑋−𝐴𝜇𝑋)𝑇]

And we can also do this in the transpose

=𝔼[𝐴(𝑋−𝜇𝑋)(𝑋−𝜇𝑋)𝑇𝐴𝑇]

And the inner product is the covariance matrix! So it ends up being this

=𝐴Σ𝐴𝑇

CHOLESKY DECOMPOSITION

Take the 𝑍 vector of iid normals, which are 𝑁(0,𝐼𝑑). On the diagonal, you have 1 correlation.

Find a matrix A such that

𝐴𝐴𝑇=Σ

, the desired covariance.

The reason why you do this is because you have A, and you multiply it, and you get the thing you need.

Cholesky uses eigenvalues and eigenvectors, but it does exactly this.

Covariance vs Correlation

How do you get from the covariance matrix to correlation?

𝜌𝑖𝑗=𝜎𝑖𝑗𝜎𝑖𝜎𝑗

How do you go from this method to other methods and vice versa?

In terms of matrix operations, it’s not complicated.

If D is the diagonal matrix of the variances (just the diagonal), then the correlation matrix is this. Inverse is regular inverse because it’s just a diagonal.

=𝐷−1×Σ(𝐷−1)𝑇

And the transpose is actually the same thing.

And you do non-inverse to get from correlation to covariance.

Not commutative, so be careful.

Markov Chain Monte Carlo

Left unsaid