### Transcription

Intro to Simulation(using Excel)DSC340Mike PangburnGenerating random numbers in Excel Excel has a RAND() function for generating“random” numbers The numbers are really coming from a formula andhence are often called pseudo-random RAND() generates a number between 0 and 1,where are values are equally likely (the so-calledUniform distribution) RANDBETWEEN(low, high) generates apseudo-random # between low and high,where all #’s are equally likely1

Generating random numbers in Excel We can use RAND() to generate #’s from otherdistributions To generate values from the Normal distribution NORMINV(RAND(), mean, standard deviation) E.g., NORMINV(rand(), 10,5) will generate a random number from a Normaldistribution with mean 10 and std. dev. 5.Generating random numbers in Excel“Why bother generatingrandom numbers?”2

Creating a Simulation What is a simulation? Investigating a real-life phenomenon, process, or problemusing a model. The Excel features we have discussed can be blendedtogether to create a simulation The flexibility of Excel allows us to create many types ofsimulation models Why use a model?Value from simulation modeling1. In business (and life), “do overs” are not always possible Simulations let you experiment with different decisionsand see their outcomes2. Humans have a poor ability to assess odds in somesituations You can use repeated simulation “trials” to assess odds ofvarious outcomes Companies typically use simulations to assess thelikelihood of outcomes that may follow from differentactions3

Creating a Simulation Because you can simulate so many differentkinds of situations, there is no one “recipe” tofollow Makes it challenging, and creative (even fun?!) Simulations typically require bringing togetherlots of Excel skills! If you can do Excel simulations, then you are good atExcelSimulation modeling in Excel First get your model of the problem (finance/profit/cost/capacity/whatever) correct, before making certaininputs random Visually separate your model on the Worksheet Then make the necessary inputs random Refresh the Worksheet many times to see the random valueschange and check whether your model’s calculations seemto behave properly Then add a Data Table to automate many, many trials ofyour model, collecting the output(s) you want Then add some summarizing statistics (e.g., average)based on the results you obtained in your Data Table4

General tips on modeling in Excel Organize – keep your worksheet neat Be clear on how to do any given calculation on paper first Then identify the corresponding Excel function, using Googlesearch if you don’t know the name of the Excel function Don’t embed data values within formulas Put data values in visible cells and reference that data Don’t put too much logic in one cell If it starts to get complicated, split the logic across more cells Remember to use the power of the Data Table for trying different parameter values for replicating multiple trials of random #’s1st Simulation example: dice game We play a game against 2 opponents 3 players (we are player 1) Each player rolls a die To win, a player needs to roll a # bigger than the othertwo dice values If it’s a tie, then the game is called a tie You want to simulate a play of the game and reportwhether you win, lose, or tie5

2nd sim. example: inventory management Demand is uncertain, and you want to determine howmany of your product to stock Let’s assume that demand is uniform between 50 and 150 unitsEach units costs you 6Your price is 10If you end up with unsold units, you will have to “dump” them at 2 salvage value Simulate one “play” of this game, where you stock a certainquantity and then see how much profit you make (givensome random demand realization)Repeating simulation “trials” The real power of simulations comes from being able toconsider many trials In Excel, the Data Table concept provides a convenientmeans for doing so Previously, we used the Data Table concept repeatedlyanalyze a spreadsheet model for different parametervalues, without randomness6

Repeating simulation “trials” If our spreadsheet model contains a random input, we againcan use a Data Table to repeatedly analyze the model To do this, we define a long column of trials as the left columndefining our Data Table Each trial corresponds to the need to re-run the sheet, creatingthe new random number(s), and seeing how results change It’s convenient to give each trial a # (e.g., 1,2,3, ) but usuallyyou don’t want to use those #’s in any formula you are using Therefore, the Data Table’s “column input cell” should point toan unused cell in your spreadsheet (again, because you don’twant to use the trial-# for anything)2nd sim. example revisited Let’s now use a Data Table with the prior example The Data Table will automate the process of consideringmany different scenarios In this case, the scenarios do not correspond to different interestrates (as in the last class), but rather to different random #’s Create a Data Table that will address 200 random scenarios At the end, we can average over those scenarios7

3rd simulation example As a hotel manager, you are involved in a major renovation of a hotel thatwill have space for 100 standard hotel rooms. You are wondering whethersome of that space should be used for “luxury suite” rooms, each of whichwould be twice the size of a standard room. For example, you could planfor 20 suites, in which case you would have remaining space for 60 standardrooms (100 – 2*20 60). Your overall construction costs won’t be impactedby this decision, because a suite costs about twice as much to build as anormal hotel room. You predict being able to fetch 99/night and 169/night for standard andluxury rooms, respectively. Anticipated demand for Standard rooms – mean of 50, standard deviation of 10 Luxury suites – mean of 20, standard deviation of 10 Note: you can upgrade a customer from standardà luxury, if the better room isavailable. Occupied rooms incur the following nightly cost (for cleaning/upkeep/”utilities”): Standard rooms – 12.50 Luxury suites – 25 You estimate fixed costs (including amortized building costs and otheroverhead such as staff salaries) at 6000 per night.How would you deal with this problem? Old school approaches See what other hotels have done, hope that they had a bettermethod than you Use intuition Ask colleagues / friends / family New school approach Do the above, but also use modeling / data Sometimes, you won’t have any “intuitive feel” for the rightanswer, when things get complicated Even worse, you might think you have the intuition, but it’s wrong Sometimes you can develop a very accurate model, if theassumptions and inputs are quite clear8

Recall: Simulation modeling steps1. First get your model of the problem (finance/profit/cost/capacity/whatever) correct, before making certaininputs random2. Then make the necessary inputs random3. Then add a Data Table to automate many, many trialsof your model, collecting the output(s) you want4. Then add some summarizing statistics (e.g., average)based on the results you obtained in your Data TableModel inputsThe modelData Table (2 way)Summary statistics9

What to make random? Demand assumptions Standard rooms – mean of 50, standard deviation of 10 NORMINV(RAND(),50,10) Luxury suites – mean of 20, standard deviation of 10 NORMINV(RAND(),20,10) To remove unwanted non-integer and negative #’s, we willuse: MAX(0,ROUND(NORMINV(RAND(),50,10),0)) Luxury suites – mean of 20, standard deviation of 10 MAX(0,ROUND(NORMINV(RAND(),20,10),0)) The impact of ignoring neg. #’s should be small, becauseneg. #’s are over 5 and 2 std deviations below the mean See tribution-table.html andclick on “Z onwards” button10

Creating a Simulation ! What is a simulation? ! Investigating a real-life phenomenon, process, or problem using a model. ! The Excel features we have discussed can be blended together to create a simulation ! The flexibility of Excel allows us to create many types of simulation models !Why use a model? Value from simulation modeling 1.File Size: 263KBPage Count: 10Explore furtherFree Excel Simulation Downloadsexcel-simulation.winsite.comTutorial of Simulation using Excel Spreadsheetshenhaihui.github.ioRunning a Simulation Using Microsoft Excelwww.ms.uky.edu#1: Simulation using Excel: Tricks, Trials, Trendssites.google.com10 Best Free Monte Carlo Simulation Software For Windowslistoffreeware.comRecommended to you b