Quants and system developers who calculate derivative prices use this method to value products that cannot be solved with a formula. Risk managers use it to find the future exposure (a value found from the distribution of the value of a trade assessed at a future date) in counterparty credit risk calculations, and to calculate risk measures such as value at risk (VaR)12.

What the Monte Carlo method calculates

In financial practice, the Monte Carlo method means repeating numerical experiments with random numbers many times and finding a target value from the many results1. For the pricing covered on this page, it approximates the price of a derivative by the average of many results generated with random numbers. Take the call option from the example used throughout the option valuation chapter (underlying asset price 100, strike price 100, 1 year to expiry, interest rate 1%, volatility 20%). Valued with 10,000 paths, the estimate is 8.33. The value given by the Black-Scholes model formula (the analytic price) is 8.43, a difference of 0.103.

Under risk-neutral valuation, the price is the discounted expected value of the payoff (the amount received) at expiry. The Monte Carlo method replaces this expected value with the average payoff over paths generated with random numbers. The paths are therefore generated with the expected return of the underlying set to the risk-free rate4. How this setting differs from the scenarios used to forecast future values is covered in Risk-Neutral Valuation.

In financial practice, the Monte Carlo method is used both to find the mean of a distribution, as with derivative prices, and to find a point in the tail of a distribution, as with value at risk (VaR). Both follow the same steps: generate changes in the underlying price with random numbers, calculate values or profits and losses from them, and aggregate the results1. The rest of the page takes up pricing, which finds the mean.

How paths are generated and the price is found

The calculation has three steps: generate random numbers, generate paths, and discount and average the payoffs. Uniform random numbers between 0 and 1 are converted into standard normal random numbers, which follow the normal distribution with mean 0 and variance 1. These are used to generate prices of the underlying, from which the value of the derivative is calculated. Repeating this as many times as needed and taking the average gives the price estimate5.

Geometric Brownian motion is a process in which the log of the price follows Brownian motion with drift. When the price of the underlying follows geometric Brownian motion, the price Δt\Delta t years after time tt can be generated from the price StS_t with one normal random number ZZ, using the formula below6. rr is the interest rate (continuously compounded) and σ\sigma is the volatility.

St+Δt=Stexp⁡ ⁣((r−12σ2)Δt+σΔt Z)S_{t+\Delta t} = S_t \exp\!\left( \left( r - \tfrac{1}{2}\sigma^2 \right) \Delta t + \sigma \sqrt{\Delta t}\, Z \right)

This formula directly uses the fact that the increment in the log price is normally distributed, so the distribution stays exact even when Δt\Delta t is large6. For a European option, whose payoff depends only on the price at expiry, you can set Δt\Delta t to the time to expiry TT and reach expiry in a single step, which is what the simulator on this page does. For products that look at prices along the way, you advance one step at a time to each observation date.

If the prices at expiry on NN paths are ST(1),…,ST(N)S_T^{(1)}, \dots, S_T^{(N)}, the price estimate C^\hat{C} for a call with strike KK is the average of the discounted payoffs YiY_i on the paths.

C^=1N∑i=1NYi,Yi=e−rTmax⁡ ⁣(ST(i)−K, 0)\hat{C} = \frac{1}{N} \sum_{i=1}^{N} Y_i, \qquad Y_i = e^{-rT} \max\!\left(S_T^{(i)} - K,\ 0\right)

For one path, check the calculation with the common example (S0=100S_0 = 100, K=100K = 100, r=1%r = 1\%, σ=20%\sigma = 20\%, T=1T = 1). If the normal random number is Z=1Z = 1, the price at expiry is 100exp⁡(0.01−0.02+0.2)=100exp⁡(0.19)100 \exp(0.01 - 0.02 + 0.2) = 100 \exp(0.19), about 120.925. The payoff is 120.925 − 100 = 20.925, and the discounted value YY is 20.925×e−0.0120.925 \times e^{-0.01}, about 20.72. If Z=−1Z = -1, the price at expiry is 100exp⁡(−0.21)100 \exp(-0.21), about 81.06, which is below the strike price, so the payoff is 0 and so is YY. The average of these two paths alone is about 10.36, far from the analytic price of 8.43. The value on a single path varies widely, from 0 to large values, so you take the average over more paths.

Because the method only calculates the payoff on each path, the same steps can value a path-dependent option, whose payoff changes with the price movements before expiry7.

Worked example: number of paths and the estimate

Valuing the call from the common example with different numbers of paths gives the estimates and standard errors in the table below. The random seed is 1, and every row uses the same sequence of random numbers from the start3.

Number of paths Estimate Standard error Difference from analytic price 8.43 Difference ÷ standard error
1,000 7.94 0.43 −0.49 −1.14
4,000 8.24 0.21 −0.19 −0.90
9,000 8.32 0.14 −0.11 −0.79
10,000 8.33 0.13 −0.10 −0.77

Quadrupling the paths from 1,000 to 4,000 roughly halves the standard error, from 0.43 to 0.21. Nine times as many paths (9,000) cut it to 0.14, roughly a third. Meanwhile, the difference between the estimate and the analytic price stays around one standard error in size. More paths bring the estimate closer to the analytic price, but the difference moves up and down with the random numbers, so you cannot judge accuracy from the difference in a single run. Accuracy is expressed by the standard error.

Standard error and the 95% range

The standard error measures how much the estimate varies because of the random numbers. It is found by dividing the standard deviation ss of the discounted payoffs on the paths by the square root of the number of paths.

SE=sN,s2=1N−1∑i=1N(Yi−C^)2\mathrm{SE} = \frac{s}{\sqrt{N}}, \qquad s^2 = \frac{1}{N-1} \sum_{i=1}^{N} \left( Y_i - \hat{C} \right)^2

ss barely changes as the number of paths grows, and in the common example it is around 13.43. The standard error therefore shrinks in proportion to 1/N1/\sqrt{N}: halving it takes four times as many paths, and gaining one more digit of accuracy takes 100 times as many8. To bring the standard error in the common example down to 0.01 takes (13.4 ÷ 0.01) squared, or about 1.8 million paths3. Because ss is the spread of the payoffs on the paths, it depends on the product's terms. With volatility at 40%, ss is about 30, and the standard error with 10,000 paths is 0.303.

When the number of paths is large, the range of 1.96 standard errors either side of the estimate contains the true price under the model about 95% of the time. The true price is the risk-neutral expected value, which in the common example is the analytic price. 1.96 is the 97.5th percentile of the standard normal distribution9. For the common example with 10,000 paths, 8.33 ± 1.96 × 0.13 gives a range of 8.08 to 8.58, which contains the analytic price of 8.433. Building the range the same way for each seed from 1 to 100, the analytic price fell inside it in 96 of the 100 runs. In the other 4, the difference between the estimate and the analytic price was still within 3 standard errors3.

Deep diveWhy the standard error is inversely proportional to the square root of the number of paths

When the values on the paths Y1,…,YNY_1, \dots, Y_N are independent and identically distributed, the variance of their average C^\hat{C} equals the variance of a single value Var(Y)\mathrm{Var}(Y) divided by NN10.

Var(C^)=Var(Y)N\mathrm{Var}(\hat{C}) = \frac{\mathrm{Var}(Y)}{N}

The standard error is the square root of this, Var(Y)/N\sqrt{\mathrm{Var}(Y)} / \sqrt{N}. Since Var(Y)\mathrm{Var}(Y) is unknown, actual calculations replace it with s2s^2, computed from the values on the paths.

SimulatorConvergence of the Monte Carlo estimate and the standard error
Inputs
Product
Option type
yrs
%
%
paths
7.88.08.28.48.68.89.09.22,0004,0006,0008,00010,000PriceNumber of pathsAnalytic 8.43Estimate 8.33
  • Monte Carlo estimate
  • Analytic price
Monte Carlo estimate
8.3272
Standard error
0.1341
Estimate ± 3 standard errors
7.9249 to 8.7294
Analytic price
8.4333
Gap from the analytic price (in standard errors)
−0.79

Simplifications

  • The underlying follows geometric Brownian motion with constant volatility and interest rates and no dividends.
  • Random numbers come from a seeded pseudorandom generator (xoshiro128**), so the same inputs always give the same result.
  • The digital is cash-or-nothing, paying 10 if the price at expiry is above the strike (below for a put).
  • The barrier is checked on a fixed number of dates (discrete monitoring). The analytic formula assumes continuous monitoring and is compared after shifting the barrier with the Broadie-Glasserman-Kou correction, an approximation for short monitoring intervals that drifts off when there are few dates.

This simulator uses simplified calculations for learning. It cannot be used for valuing actual transactions or managing their risk. (Disclaimer)

About this simulator

You can change the product (European, digital, or barrier), call or put, underlying price, strike price, time to expiry, volatility, interest rate, number of paths, and random seed. Each change updates the chart of the estimate against the number of paths, the standard error, and the difference from the analytic price. With fewer paths, the standard error grows and the estimate in the chart swings more. Changing the seed changes the estimate, but in most cases it stays within about 2 standard errors of the analytic price. Raising the volatility increases the standard error for the same number of paths.

Random numbers and seeds

The random numbers used in the Monte Carlo method are pseudo-random numbers, which a computer generates one after another with a formula. A sequence is often regarded as random enough, and called pseudo-random, when its values do not depend on earlier values (statistical independence) and appear without bias (uniformity)11. For example, the linear congruential generator produces the next value from the previous one with the formula Xn=aXn−1+c(modm)X_n = aX_{n-1} + c \pmod m12.

Because the numbers come from a formula, the same starting value produces the same sequence. In this site's simulator, the input that sets this starting value is called the seed, and the same seed gives the same estimate. A different seed changes the sequence, and the estimate moves within a range about the size of the standard error.

Random numbers generated by a formula return to the same sequence after a fixed period. Using more random numbers than the period only reuses the same numbers and does not improve the accuracy of the estimate12. A 2002 paper from the Bank of Japan's Institute for Monetary and Economic Studies showed that the built-in random number generator of a spreadsheet program had a short period that may not be enough for large calculations. It gave the Mersenne Twister, with a long period of 219937−12^{19937}-1, as an example13.

Variance reduction: smaller errors without more paths

Variance reduction methods use random numbers in ways that reduce the spread of the values on the paths (ss in the standard error formula). They leave the 1/N1/\sqrt{N} rate unchanged and reduce its proportionality constant15. Two common variance reduction methods are antithetic variates and control variates.

The antithetic variates method pairs a path generated with a normal random number ZZ with a path generated with the opposite sign, −Z-Z, and uses the average of the two values as one value15. The more the two values in a pair move in opposite directions, the smaller the variance of their average. When the payoff is monotonically increasing or decreasing in the random number (as with a European call), the covariance of the two values is negative, which guarantees a smaller variance16. However, antithetic variates rarely reduce the variance by a large amount17.

The control variates method calculates, on the same paths, a value WW that moves together with the value to be estimated YY and whose expected value is known from a formula. It then uses the error in the estimate of WW to correct the estimate of YY18. If cc in the formula below is set from the covariance of YY and WW, the stronger the correlation between YY and WW, the smaller the variance19.

C^cv=1N∑i=1N(Yi+c(Wi−E[W])),c=−Cov(Y,W)Var(W)\hat{C}_{\mathrm{cv}} = \frac{1}{N} \sum_{i=1}^{N} \left( Y_i + c \left( W_i - E[W] \right) \right), \qquad c = -\frac{\mathrm{Cov}(Y, W)}{\mathrm{Var}(W)}

For example, when valuing an Asian option, whose payoff is set by the average price over a period, you can use as WW the discounted payoff of an ordinary European call calculated on the same paths. The expected value of WW is the price given by the Black-Scholes model formula20.

When choosing a method, compare not only the variance but also the computational effort per path. A method that halves the variance but takes more than twice as long per path gives lower accuracy for the same computing time21. Some methods also reduce the number of trials per unit of time and can increase the computing time22.

Deep diveWhy antithetic variates reduce the variance

Let YY be the value on the path generated with ZZ and Y~\tilde{Y} the value on the path generated with −Z-Z. The variance of the average of the two is as follows23.

Var ⁣(Y+Y~2)=14(Var(Y)+Var(Y~)+2 Cov(Y,Y~))\mathrm{Var}\!\left( \frac{Y + \tilde{Y}}{2} \right) = \frac{1}{4} \left( \mathrm{Var}(Y) + \mathrm{Var}(\tilde{Y}) + 2\,\mathrm{Cov}(Y, \tilde{Y}) \right)

If YY and Y~\tilde{Y} are independent, the covariance is 0 and the variance is Var(Y)/2\mathrm{Var}(Y)/2, the same as for the average of two independent paths. If the covariance is negative, the variance is smaller than that. Pairing ZZ with −Z-Z also makes the mean of the random numbers used exactly 0, and makes the odd-order moments 0 as well23.

Where it is used and how it compares with other methods

The Monte Carlo method needs more computation than other methods to reach high accuracy. According to a 2002 paper from the Bank of Japan's Institute for Monetary and Economic Studies, practitioners chose methods in this order: analytic formulas such as the Black-Scholes model, then lattice methods such as the binomial model and finite difference methods, then the Monte Carlo method. In the front office in particular, where fast calculation is required, the Monte Carlo method was in many cases regarded as a last resort7.

The same paper states that, among options exercisable only at expiry, the Monte Carlo method is used in the following cases7: options whose model of underlying price movements is complex enough to make other methods laborious to build, options with path dependence, and options on four or more underlyings. For lattice and finite difference methods, the amount of computation rises sharply as the number of underlyings grows, and about three underlyings is the practical limit. With the Monte Carlo method, adding an underlying only adds random numbers in proportion to the number of paths24.

For a barrier option, an example of a path-dependent product, the price on each path is checked at every date on which the barrier is observed. Take a down-and-out call with an underlying price of 100, a strike price of 100, and a barrier of 90, observed 50 times before expiry. The estimate with 10,000 paths is 7.44 (standard error 0.13). This is higher than the analytic price of 6.88, which assumes continuous monitoring, and close to the analytic price of 7.32 adjusted for the number of observations3. The adjustment shifts the barrier in the continuous-monitoring formula away from the underlying, to suit a contract monitored only on set dates25. Because it moves the barrier from 90 to 88.53, the adjusted analytic price of 7.32 is higher than 6.88.

Besides derivative prices, the method is also used to calculate counterparty credit risk. The expected exposure used in XVA calculations can be found with simplified methods, but the Monte Carlo method is used to find it precisely while capturing complex trades and the effect of netting. Its drawback is the heavy computational load2. The whole picture of how the exposure feeds into valuation is covered in Overview of XVA.

Calculations that find a point in the tail of a distribution, such as VaR, can have larger errors than calculations of the mean for the same number of paths. In the normal distribution example in the same 2002 Institute for Monetary and Economic Studies paper, the error of the 99.5th percentile was larger than the error of the mean. Most variance reduction methods are techniques for reducing the error in calculations of the mean, and they cannot always be applied as they are to calculations of tail points26.

Notes

  1. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), Section 2 (1) "モンテカルロ法の定義と実務での適用対象" (Definition of the Monte Carlo method and its uses in practice) (page 54) (in Japanese). ↩ ↩2 ↩3

  2. Takashi Kawakami, "ヘッジ取引におけるデリバティブ信用評価調整の影響についての考察" (A study of the effects of credit valuation adjustments of derivatives on hedging transactions), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (April 2018), the paragraph on calculating expected exposure on page 126 (page 8 of the PDF) (in Japanese). ↩ ↩2

  3. Values from the same calculation as this page's simulator, using the function computeMonteCarlo in src/lib/simulators/monte-carlo.ts. The standard deviation ss is the standard error × N\sqrt{N}, which is 13.41 with 10,000 paths. The analytic price is the value from the function in src/lib/simulators/black-scholes.ts (8.4333). ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8

  4. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Example 2 (pages 4–5). The price is the expected discounted payoff under the risk-neutral probability QQ, under which the stock price is assumed to follow geometric Brownian motion with drift rr. ↩

  5. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), steps 1 to 5 at the start of Section 3 (page 57) (in Japanese). ↩

  6. Martin Haugh, "Generating Random Variables and Stochastic Processes" (Columbia University, 2017), Section 7.2 (pages 18–19). The source's formula is St+Δt=Ste(μ−σ2/2)Δt+σ(Bt+Δt−Bt)S_{t+\Delta t} = S_t e^{(\mu - \sigma^2/2)\Delta t + \sigma(B_{t+\Delta t} - B_t)}, where BB is Brownian motion. The text replaces μ\mu with rr and the increment Bt+Δt−BtB_{t+\Delta t} - B_t with Δt Z\sqrt{\Delta t}\, Z. ↩ ↩2

  7. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), Appendix 3 "派生商品のプライシングを行う際の数値計算手法" (Numerical methods for pricing derivatives) (page 85) (in Japanese). ↩ ↩2 ↩3

  8. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), the paragraph after equation (A-5) in Appendix 1 (page 78) and note 14 on page 55 (in Japanese). ↩

  9. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Section 1 (page 1). The source writes the confidence interval as θ^n±z1−α/2 σ^n/n\hat{\theta}_n \pm z_{1-\alpha/2}\,\hat{\sigma}_n/\sqrt{n}. The text sets α=0.05\alpha = 0.05 and z0.975=1.96z_{0.975} = 1.96. ↩ ↩2

  10. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), equations (A-4) and (A-5) in Appendix 1 (page 78) (in Japanese). ↩

  11. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), note 5 in Section 1 (page 52) (in Japanese). ↩

  12. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), Section 3 (1) "乱数の周期と Excel の組み込み乱数" (The period of random numbers and Excel's built-in random numbers) and note 18 (page 57) (in Japanese). ↩ ↩2

  13. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), Section 3 (1) and (2) and "図表 2" (Figure 2) (pages 57–58) (in Japanese). ↩

  14. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), note 20 on page 58 (in Japanese). ↩

  15. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), the opening of Appendix 2 "分散減少法とモーメント調整法" (Variance reduction and moment matching methods) and "図表 A-1" (Figure A-1) (page 80), and "①対称変量法" (1. Antithetic variates) (pages 81–82) (in Japanese). ↩ ↩2

  16. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Section 3, Theorem 1 in Section 3.1, and Section 3.3 (pages 7–9). ↩

  17. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), the paragraph after Example 8 in Section 3 (page 10). ↩

  18. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), control variates in "図表 A-1" (Figure A-1) (page 81) (in Japanese). The paper writes Z=X−α(Y−E[Y])Z = X - \alpha(Y - E[Y]). The text's YY, WW, and cc correspond to the paper's XX, YY, and −α-\alpha. ↩

  19. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Section 2.1 (page 3). The text writes the source's ZZ as WW. The source says that when the covariance and variance are unknown, they are first estimated with a small pilot run. ↩

  20. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Example 2 (pages 4–5). ↩

  21. Martin Haugh, "Simulation Efficiency and an Introduction to Variance Reduction Methods" (Columbia University, 2017), Section 1.1 (page 2). The source compares the efficiency of methods by the product of the variance and the computational effort per path. ↩

  22. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), item ④ in Section 1 (page 53) (in Japanese). ↩

  23. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), equations (A-11) to (A-13) in Appendix 2 (page 82) (in Japanese). ↩ ↩2

  24. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), item ③ in Appendix 3 (page 86) (in Japanese). ↩

  25. Mark Broadie, Paul Glasserman, and Steven Kou, "A Continuity Correction for Discrete Barrier Options" (Mathematical Finance, October 1997), Section 1.1 (pages 325–326). The corrected analytic price is calculated with the barrier set to 88.53 by the same paper's correction (multiplying the barrier by e±0.5826 σΔte^{\pm 0.5826\,\sigma\sqrt{\Delta t}}). ↩

  26. Tatsuya Ishikawa and Yoshihiko Uchida, "モンテカルロ法によるプライシングとリスク量の算出について" (Pricing and risk measurement with the Monte Carlo method), Kinyu Kenkyu, Institute for Monetary and Economic Studies, Bank of Japan (June 2002), Section 2 (2) and (3) (pages 55–56) (in Japanese). The larger error of the 99.5th percentile is the result of the example in "図表 1" (Figure 1), which calculates the expected value and the 99.5th percentile of a normally distributed value. ↩