2
$\begingroup$

I'm building a Monte Carlo option pricing model in Python/SciPy. I want to test the results produced by the Python code by building the model independently in Excel and then comparing the results. Off course the values won't match exactly, but what is close enough?

My idea is to calculate the standard error and then calculate the range on a 95% confidence level where the true mean lies for both implementation. If these two ranges overlap then it is close enough.

I'll also do enough simulations so that the standard error is less than 2% of the estimated mean.

Alternatively I can generate the random numbers in Python and feed that into Excel for a type of quasi Monte Carlo. Or I might be able to to give it the same seed (but I'm not sure if this will work).

Is my approach described above sound or what other options are there?

$\endgroup$
5
$\begingroup$

I wouldn't repeat the same algorithm on Excel, because if you make a mistake in your Python code, it's likely that you'll also make the same mistake in your Excel code.

Quants usually test an implementation with an analytical formula (not always possible). You should start off with something easy by pricing an European option with your MC algorithm. You should compare your MC price with Black-Scholes. Note that you don't have to code the formula yourself, google "online black scholes calculator".

Do some runs, plot the standard errors against N where N is the number of iterations. Make sure the standard errors from your MC drop by an inverse square root of N (central limit theorem).

Data visualisation is your friend. Plot the distribution of the spot price against time. Do they have a trend? You should see a trend unless your drift is zero. Now, change the drift to zero, do you see a normal distribution? Does the plot look symmetric? The key to model validation is a deep understanding of the underlying distribution and what would it look like if you change the parameters.

You can also compare your MC with an MC implementation from somebody else. Generally, you should validate your results with an implementation that is done independently (i.e.: not you).

$\endgroup$
  • $\begingroup$ Thanks, that's excellent suggestions. I'll definitely do the data visualization and compare my results to Black Scholes for simple cases. Once I've done these checks and I have an independently built Excel model (by someone else) can I then follow my approach using the standard errors as described above? Or what would you suggest? $\endgroup$ – Johan Nov 11 '15 at 7:36
  • $\begingroup$ @Johan Of course you can! $\endgroup$ – SmallChess Nov 11 '15 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.