Using the Lognormal GBM Distribution to Check Simulated Price Outcomes
Summary
The document explains why a geometric Brownian motion simulation can appear to rise consistently when its drift is strongly positive. Applying Itô’s lemma to the GBM model shows that the log return over a fixed horizon is normally distributed, so the price ratio follows a lognormal distribution. This gives a direct way to calculate the probability that a terminal price falls below a chosen threshold, rather than judging behavior from a few plotted paths.
For the stated starting price, drift and volatility, the answer estimates the chance of finishing below a lower price and compares that probability with the expected count across repeated simulations. The example illustrates that a low-probability outcome can be absent from an individual run without indicating a coding error. The result depends on the selected GBM assumptions and parameter values; it does not establish that real stock returns follow GBM or that one path should match the distribution’s average behavior.
Key ideas
- Under GBM, log returns over a fixed horizon are normally distributed.
- The corresponding price ratio has a lognormal distribution.
- A threshold probability can be calculated from that distribution to assess simulated outcomes.
- A rare event may not appear in a finite batch of simulated paths.
- The conclusion depends on the chosen drift, volatility and GBM model assumptions.
Tags
Full text
# Monte carlo simulations giving biased output
# Monte carlo simulations giving biased output
I wrote code to simulate the stock price using geometric brownian motion.
My code is as follows:
```
t=1
n=1000
dt=1/1000
t=[]
t.append(0)
p=[]
p.append(S)
S0=S
for i in range( N):
S1=S*np.exp(((mu - sigma**2/2)*dt) + (sigma * np.sqrt(dt) * np.random.normal(0,1)))
p.append(S1)
t.append(i)
S=S1
```
However one thing that I notice is that the price always seems to follow an upward trend. If my starting point is 120, it never goes below 100 for some reason. Sure, there could be dips in the graph, but the trend is always upward.
Is that how geometric brownian motion is supposed to work or have I gotten something wrong?
## Answer by Yoda And Friends (score 2)
https://quant.stackexchange.com/a/64276
To answer your question, few steps are necessary:
- I assume your are working under the BS model (from your code). Therefore we have that $$dS_t = \mu S_t dt + \sigma S_t dW_t$$ where $W_t$ is a SBM.
- Using Ito's lemma we can recover: $$\log(S_t) - \log(S_0) \sim N \left((\mu - \frac{1}{2}\sigma^2)t, \ \ \sigma^2t \right)$$
- Now, observe how $\exp(\log(S_t) - \log(S_0)) = \frac{S_t}{S_0}$. What does this tells you? It tells you that $$\frac{S_t}{S_0} \sim Log N \left((\mu - \frac{1}{2}\sigma^2)t, \ \ \sigma^2t \right)$$
- We plug in the parameters you have indicated $\mu = 0.61$ and $\sigma = 0.39$. What we obtain is then $\frac{S_t}{S_0} \sim Log N \left(0.53395t, \ \ 0.1521t\right)$. Choosing a value for $t$, you can plot the density using this tool. At the same link you can also ask for the CDF.
As an illustrative example, fix $t=1$. You are asking: why is my simulation never producing $S_t \leq 100$? Let's see what is $\mathbb{P}\left[S_t \leq 100\right]$. $$\left[S_t \leq 100\right] = \left[\frac{S_t}{S_0} \leq \frac{100}{S_0}\right] = \left[\frac{S_t}{S_0} \leq \frac{100}{120}\right] = \left[L \leq 0.8333\right]$$ where $L \sim Log N \left(0.53395, \ \ 0.1521\right)$. So that $\mathbb{P}\left[S_t \leq 100\right] = 0.03313$. This means that, choosing to simulate $n = 1000$ different values, around 33 of these should be less than 100. This is indeed the case. You can try with this code:
```
import numpy as np
ns = 1000
sum = 0
for i in range(100):
S = np.zeros(ns)
randomE = np.random.normal(0.0, 1.0, ns)
S = 120*np.exp((0.61 - 0.5*0.39*0.39) + 0.39*randomE)
boole3 = np.where(S < 100)
sum += len(boole3[0])
print(sum/100)
```
Hope this clarifies!Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.