# Tag Info

0

Your code has a bug that it picks one random jump time by exprnd(lam), then makes a vector of jump times with jumps repeating at the same interval. It should pick a new random time for each jump.

5

There is Monte Carlo Simulation and there is Monte Carlo Simulation. If you are referring to a simple question like simulating dice or calculation of $\pi$ or even vanilla option price calculation, it is one thing and "concisely" available. I recommend get a gist of small examples from CS books and then get on with finance. But if you are referring ...

1

The GBM is a continuous model, so using large integer time steps naturally leaves large discretization error (which vanishes when you increase the number of steps). Use small time step 0.001: paths(j + 1,i) = paths(j,i) * exp((mu - vol^2/2)*0.001 + vol * 0.001^0.5*shocks_ant(j,i)); Then the mean is almost exactly 100 as expected.

0

appearantly your sampling variance is too large. I reimplemented your example in R. What I first saw is, that the mean got worse if I took more time steps (you take $300$). Your volatility is $0.3$ which is $30\%$ per year and you sample $300$ years. What you should do is the following: define a variable nbr_steps_peryear choose the number of years then ...

2

You should look at confidence interval. Normally, your confidence interval size is proportional to the standard deviation, looking something like: with probability $p$ your value will be in the interval: $$[\bar{S} - k*StdDev, \bar{S} + k*StdDev]$$ Then, getting back to your simulation, we can say that your time step is very big (1 year) and you simulate ...

3

Your question is too general because Monte Carlo methods differ quite a bit. It's driven more by the problem you are trying to solve, significant result sets, etc, etc. You would either have to provide more details to what you're trying to solve or; try programming some Monte Carlo simulations yourself. My first experience with them was trying to solve ...

3

You have typo "vol^2", but it should be "vol". Its $$\sqrt{\sigma^2T}=\sigma\sqrt{T}$$

3

The error is, you are not storing the random numbers for the same path at the end: xbefore = x + c*tau + sigma*sqrt(tau)*randn() A = muA + sigmaA*randn(); xafter = xbefore + A; But then at end you set a different path here by creating a new random number: xT = log(S0)+(c+muA*lambda)*T+sqrt((sigma^2+(muA^2+sigmaA^2)*lambda)*T)*randn(); randn() ...

1

Giuseppe Bruno, Bank of Italy, did some interesting work in R showing that the use of Quasi Random Numbers in Monte Carlo simulations was superior to Pseudo-Random. Here is an abstract of what he presented at useR! 2014: Pricing Credit Risk Derivative with R

Top 50 recent answers are included