0

I was under the impression that simulations involving geometric brownian motion are not supposed to yield negative numbers. However, I was trying the following Monte Carlo simulation in R for a GBM, where my initial asset price is: $98.78$, $\mu = 0.208$, $\sigma = 0.824$. I initialized my dataframe as such: (I am just doing 1000 simulations over 5 years, simulating the price each year)

V = matrix(0, nrow = 1000, ncol = 6)
V_df = data.frame(V)

Then:

V[, 1] <- 98.78

I then perform the simulations (with dt = 1):

for (i in 1:1000) {
        for (j in 1:5) {
            V_df[i,j+1] <- V_df[i,j]*(mu*dt + sigma*sqrt(dt)*rnorm(1)) + V_df[i,j]
        }
    }    

When I then check V_df there are many negative entries, which is not supposed to be the case. Would anyone have an idea as to why this is so?

Thanks.

Thomas Moore
  • 941
  • 2
  • 11
  • 17

1 Answers1

-1

Your solution to the GBM is not correct. One step should read

V_df[i,j+1] <- V_df[i,j]*exp((mu - sigma^2/2)*dt + sigma*sqrt(dt)*rnorm(1))

However, doing this with a double loop is very inefficient. You can create a matrix of random numbers and use cumprod or cumsum to generate the paths. Which function you use depends on when you take the exp.

See also https://en.m.wikipedia.org/wiki/Geometric_Brownian_motion

Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75