How to Make Predictions Using Monte Carlo Simulations
Hey, my name is Christoph and today I’d like to talk about Monte Carlo simulation What? Hearing “Monte Carlo” triggers my brain to think about French Riviera or the Monaco, Formula One Grand Prix? And by the way? Google hits are supporting that But let’s move away from photos showing casino. By the way casinos are actually why Monte Carlo simulations are named this way But more on that later What we are going to talk about is admittedly gambling But let’s call it systematic gambling to answer real-world questions So why and where are Monte Carlo simulations used? Well Monte Carlo simulations help to answer probability questions They are used for example in finance for economic forecasting risk management and stress testing Also an automotive for sensitivity analysis to make customer products more robust or also tackling our daily life Monte Carlo simulation is used in weather forecasting So now, we need to answer the question. What are Monte Carlo simulations? Wikipedia says it’s “repeated random sampling to obtain numerical results” MathWorks is even a bit more specific saying: “the process of generating independent random draws from a specified probabilistic model” Let me try to describe it using my very own words “You start with a simulation model” “You run that model many times with randomly changing parameters” and then “you analyze the result systematically” and to understand what that means, let’s do an example together Blackjack seems to be an appropriate one for us today The game is also known as “21” The goal is to get a hand with a value close to, but not more than 21 We play against the dealer and each of us starts with two cards We see here a MATLAB app that’s basically a visualization on top of a MATLAB script that includes the concept of blackjack Our cards are dealt face up. One of the dealer’s card stays facedown Remember rule one said, “start with a simulation model” and that’s pretty much what we have here But what strategy should we follow? One approach is called “basic strategy”, and I will link the related publications in the video description Basic strategy for example recommends to always stand on 17, always split aces, never split tens So, let’s open the Wikipedia next to our cards to get the full picture of basic strategy I get 18 here, which is more than 17 So I certainly should stand Oh nonetheless, I lose because the dealer get 20 Let’s try to play again. Again 18 basic strategy recommends that I stand And now instead of playing manually again and again Let’s follow a more systematic Monte Carlo like approach Rule 2 says run that simulation many times Let’s exactly do that See here a script that will play blackjack many times for us Due to the increased number of computations required We employ a parallel execution, a feature that MATLAB provides That will distribute the compute tasks to all the cores on my laptop But this approach could also be scaled to match future compute environments such as clusters or cloud solutions So, what we are seeing here is the total dollar return after 15 players have been playing 2500 hands each Overall, we have a huge amount of data and that we can analyze and even analyze smart-decision-making during blackjack So you may ask yourself: Where does basic strategy come from? Well, basic strategy has been derived analyzing thousands of simulated games exactly like the one here, which essentially is a Monte Carlo approach So, all files I’ve used here today are authored by Cleve Moler, one of the co-founders of MathWorks and today chief mathematician at the MathWorks You will also find a very nice article explaining basic strategy and the MATLAB implementation of blackjack All right. So, let’s conclude for our specific example We’ve learned that following the basic strategy lets us eventually win a few times over the casino and fortunately in the long run the casino still has an advantage of about 1/2 of 1% If you found that example interesting, allow me to refer you to a MathWorks webpage that provides a whole lot of context and examples about Monte Carlo simulation as well as many MATLAB and Simulink models to download and run if you like the casual blackjack example Let’s end here with another one from basketball on YouTube LeBron James brings up an interesting questions “So you’re down three points with 30 seconds left in the match. Is it better to take a more difficult shirt for three points or an easy one for two an attempt to get another possession?” So, Khan Academy provides you with an interactive simulation tool to run through the decision-making in the browser Thanks for watching and stay tuned on MathWorks video!