# How to simulate stock prices with a Geometric Brownian Motion?

I want to simulate stock price paths with different stochastic processes. I started with the famous geometric brownian motion. I simulated the values with the following formula:

$$R_i=\frac{S_{i+1}-S_i}{S_i}=\mu \Delta t + \sigma \varphi \sqrt{\Delta t}$$

with:

$\mu=$ sample mean

$\sigma=$ sample volatility

$\Delta t =$ 1 (1 day)

$\varphi=$ normally distributed random number

I used a short way of simulating: Simulate normally distributed random numbers with sample mean and sample standard deviation.

Multiplicate this with the stock price, this gives the price increment.

Calculate Sum of price increment and stock price and this gives the simulated stock price value. (This methodology can be found here)

So I thought I understood this, but now I found the following formula, which is also the geometric brownian motion:

$$S_t = S_0 \exp\left[\left(\mu - \frac{\sigma^2}{2}\right) t + \sigma W_t \right]$$

I do not understand the difference? What does the second formula says in comparison to the first? Should I have taken the second one? How should I simulate with the second formula?

-
This method is really close to be off-topic, but it can be interesting for later users so I'll still answer it. – SRKX Nov 22 '12 at 8:37
@SRKX, by the way, why would this question be close to be off-topic? I find it more on target than 30%-40% of all other questions recently asked. You will be surprised how many market practitioners cannot answer this seemingly simple question, even those on the derivatives and exotics side. – Matt Wolf Nov 22 '12 at 9:12
Please do not hesitate to register in order to help the site grow and make it out of beta! – SRKX Nov 22 '12 at 9:24
@Freddy we try our best to close the one we find off-topic, maybe some of them went through. About registration, I was talking to the user who wrote the question, and it helps in the Area51 stats for make it out of beta. – SRKX Nov 22 '12 at 9:30
see if you can get your hands on a copy of Glasserman's book Monte Carlo Methods in Financial Engineering, truly a masterpiece in many regards. – user25064 Jan 27 '14 at 17:54

The way you do it in the first place is a discretization of the Geometric Brownian Motion (GBM) process. This method is most useful when you want to compute the path between $S_0$ and $S_t$, i.e. you want to know all the intermediary points $S_i$ for $0 \leq i \leq t$.

The second equation is a closed form solution for the GBM given $S_0$. A simple mathematical proof showed that, if you know the initial point $S_0$ (which is $a$ in your equation), then the value of the process at time $t$ is given by your equation (which contains $W_t$, so $S_t$ is still random). However, this method will not tell you anything about the path.

As mentioned in the comments below, you can also use the close form to simulate each step of the paths.

-
nice concise explanation. Upvoted – Matt Wolf Nov 22 '12 at 9:03
ok, thanks @SRKX – user1690846 Nov 22 '12 at 9:06
There is no reason at all that paths cannot be simulated using the second method. Solving the SDE over a single interval will still allow a conditional formula such as $S_t = S_{t-1} \exp \{ (\mu - \sigma^2/2)\Delta t + \sigma (W_t - W_{t-1})\}$ with the standard method of simulation for the sample path of the brownian motion. – user25064 Jan 27 '14 at 17:57
@user25064 this is not what I meant, you can indeed do these multiple steps with the closed form. I meant that if you use it to compute $S_T$ directly, then you don't know what happened until then. There was no judgement here. – SRKX Dec 1 '14 at 13:25
solving closed form might get you boost on parallel system once you are not dependent on St-1 anymore – Boppity Bop Dec 29 '14 at 23:10

To complement @SRKX comment ,i'll try to explain the "simple mathematical proof" beetween both formula : I assume you know the geometric or arithmetic brownian motion :

Geometric: \begin{equation*} dS = \mu S dt + \sigma Sdz \end{equation*} Arithmetic : \begin{equation*} dS = \mu dt + \sigma dz \end{equation*}

Then another important stochastic tool you need to know is the so called Ito Lemma : Loosely speaking, if a random variable $x$ follows an Ito process : (drift = $a(x,t)$ et variance = $b(x,t)^{2}$):

\begin{equation*} dx = a(x,t) dt + b(x,t) dz \end{equation*} Then another function $G$ which depends of $x$ and $t$ will respect also (ito lemma) the following process : \begin{equation*} dG = (\frac{\partial G}{\partial x}a + \frac{\partial G}{\partial t}+ \frac{1}{2}\frac{\partial^{2} G}{\partial x^{2}} b^{2}) dt + \frac{\partial G}{\partial x} bdz \end{equation*}

If we replace $x$ by the stock price and take its logarithm: $G = ln(S)$. We also know : \begin{equation*} dS = \mu S dt + \sigma Sdz \end{equation*} then $a = \mu S$ et $b = \sigma S$ and \begin{equation*} \frac{\partial G}{\partial S} =\frac{1}{S}, \frac{\partial^{2} G}{\partial S^{2}} = - \frac{1}{S^{2}},\frac{\partial G}{\partial t} =0 \end{equation*} using Ito lemma : \begin{equation*} dG = (\mu - \frac{\sigma^{2}}{2})dt + \sigma dz \end{equation*} Thus if we investigate the variation of $ln(S)$ (=G) between date zero and date $T$ : \begin{equation*} ln(S_{T})-ln(S_{0}) \sim \phi[(\mu - \frac{\sigma^{2}}{2})T, \sigma \sqrt{T}] \end{equation*} \begin{equation*} ln(S_{T}) \sim \phi[ln(S_{0})+(\mu - \frac{\sigma^{2}}{2})T, \sigma \sqrt{T}] \end{equation*} If we integrate : \begin{equation*} S(t) = S(0) \exp{(\mu - \frac{\sigma^{2}}{2})t + \sigma (z(t)-z(0))} \end{equation*} or \begin{equation*} S(t) = S(0) \exp{(\mu - \frac{\sigma^{2}}{2})t + B_{t}} \end{equation*} where $B_{t}$ is a brownian motion.

-
I might be wrong but it seems like your arithmetic and geometric BM are the same. You might want to drop S for the arithmetic. – user7227 Feb 13 '14 at 6:36
you are right, sorry, i corrected it. – Malick Feb 13 '14 at 18:51

They won't be the same.

If you run a discrete simulation you will get the actual (or an instance of an actual path) price process for the future value of the stock using the real probability measure.

If you do the same thing using the closed form solution, the path will look very similar but will drift downwards.

Why are they different?

To see it easily, build a spreadsheet model with a graph that shows both the real and the modeled path (the latter being the one with $e^{r-\sigma^2/2)}$. Then plug in maybe 5% for $r$ (or $\mu$, they are the same). Then run it using $\sigma=0$ and perhaps $\sigma=40\%$.

It will be clear that with no risk ($\sigma=0$) the path is just $S_t=B_0e^{rt}$, where $B_0$ is the price of the bond at time $t=0$. It drifts up in value to return the risk free rate over a single period (a year). This makes sense.

However, with $\sigma=40\%$ the modeled price process for a stock that starts at price $B_0$ drifts downwards.

The whole point of a risk-neutral measure and model is that you discount future amounts by the risk-neutral, or risk-free, rate. It doesn't make that real, or make the stock's expected return the same as a bond. It just makes it consistent.

So imagine a stock with an initial price of $S_0$. If the stock has a higher risk than the bond (which it must) and investors in equilibrium have bid the price to a point so it is expected to have a return greater than the bond to compensate for the risk, it must be that the stock is priced a discount to the bond if investors expect the future value to be equal. Thus, if investors expect $B_{t=1}=S_{t=1}$then $S_0<B_0$. In essence, the stock is priced today at a discount to the bond.

The closed-form solution does everything in risk-neutral space. So if we start with $S_0=B_0$ the bond trajectory of price $B_t$ must discount back to $B_0$ when the risk-free rate is used. As a result the future value of the stock at the same time must be below $B_t$ so that it discounts back to a lower value at $t=0$ using $r$ as the discount rate to earn a return that compensates for the risk.

Simply, if you 'roll forward' a simulation the stock will outperform the bond on average, but if you see a price model under risk-neutrality the path must be such that when you discount future values to today they must give you a fair value today for the stock.

This is a bit of mathematical sleight of hand but it all works out the same. So, for example, if $B_0=100$ and $r=5%$ the future value of the bond in one year is 105, and its present value is 100. But the future value of the stock must look like a smaller number (say, perhaps, 94) so that the price today, $S_0$, is maybe 89 or some such.

The closed form solution does not give you the actual price model. It gives you a future price model that allows you to price a stock as if the risk-free rate can be used to discount the future value to get the right present value. They are really the same model just expressed differently.

-
I disagree both methods should yield the same result for $\Delta t$ small enough. The closed-form solution of the GBM behavior has no direct link to risk-neutrality, that comes into account when you change the measure for the Black-Scholes solution for example. – SRKX Oct 28 at 7:58