Monte Carlo SIMULATION with EXCEL Montana Going Green Workshop October 2010.

Slides:



Advertisements
Similar presentations
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. A PowerPoint Presentation Package to Accompany Applied Statistics.
Advertisements

Chapter 18 If mathematical analysis is too difficult, we can try each possibility out on paper. That way we can find which alternative appears to work.
Monte Carlo Simulation A technique that helps modelers examine the consequences of continuous risk Most risks in real world generate hundreds of possible.
Simulation Operations -- Prof. Juran.
Session 7a. Decision Models -- Prof. Juran2 Overview Monte Carlo Simulation –Basic concepts and history Excel Tricks –RAND(), IF, Boolean Crystal Ball.
(Monté Carlo) Simulation
1 Spreadsheet Modeling & Decision Analysis: A Practical Introduction to Management Science, 3e by Cliff Ragsdale.
Spreadsheet Simulation
Module F: Simulation. Introduction What: Simulation Where: To duplicate the features, appearance, and characteristics of a real system Why: To estimate.
FIN 685: Risk Management Topic 5: Simulation Larry Schrenk, Instructor.
Discrete Event Simulation How to generate RV according to a specified distribution? geometric Poisson etc. Example of a DEVS: repair problem.
Tests of significance Confidence intervals are used when the goal of our analysis is to estimate an unknown parameter in the population. A second goal.
Introduction to Simulation. What is simulation? A simulation is the imitation of the operation of a real-world system over time. It involves the generation.
QMF Simulation. Outline What is Simulation What is Simulation Advantages and Disadvantages of Simulation Advantages and Disadvantages of Simulation Monte.
1 1 Slide Chapter 6 Simulation n Advantages and Disadvantages of Using Simulation n Modeling n Random Variables and Pseudo-Random Numbers n Time Increments.
Monté Carlo Simulation MGS 3100 – Chapter 9. Simulation Defined A computer-based model used to run experiments on a real system.  Typically done on a.
Operations Management
Stevenson and Ozgur First Edition Introduction to Management Science with Spreadsheets McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Simulation.
Spreadsheets Objective 6.02
2 Explain advanced spreadsheet concepts and functions Advanced Calculations 1 Sabbir Saleh_Lecture_17_Computer Application_BBA.
Lesson 4 Cell Reference Formulas. Working with Cell References continued… Relative Cell Reference A relative cell reference means that the cell value.
Example 16.1 Ordering calendars at Walton Bookstore
Managerial Decision Modeling with Spreadsheets
Simulation Examples ~ By Hand ~ Using Excel
 1  Outline  stages and topics in simulation  generation of random variates.
Chapter 14 Simulation. What Is Simulation? Simulation is to mimic a process by using computers.
The AIE Monte Carlo Tool The AIE Monte Carlo tool is an Excel spreadsheet and a set of supporting macros. It is the main tool used in AIE analysis of a.
ESD.70J Engineering Economy Module - Session 21 ESD.70J Engineering Economy Module Fall 2005 Session One Alex Fadeev - Link for this PPT:
F Simulation PowerPoint presentation to accompany Heizer and Render
F - 1© 2011 Pearson Education, Inc. publishing as Prentice Hall F F Simulation PowerPoint presentation to accompany Heizer and Render Operations Management,
Contemporary Engineering Economics, 6 th edition Park Copyright © 2016 by Pearson Education, Inc. All Rights Reserved Risk Simulation Lecture No. 40 Chapter.
Discrete Distributions The values generated for a random variable must be from a finite distinct set of individual values. For example, based on past observations,
OPIM 5103-Lecture #3 Jose M. Cruz Assistant Professor.
Lesson 5: Working with Formulas and Functions Logical and 3D Formulas.
Simulation OPIM 310-Lecture #4 Instructor: Jose Cruz.
Simulation is the process of studying the behavior of a real system by using a model that replicates the behavior of the system under different scenarios.
Copyright ©2011 Pearson Education, Inc. publishing as Prentice Hall 5-1 Business Statistics: A Decision-Making Approach 8 th Edition Chapter 5 Discrete.
Simulation Using computers to simulate real- world observations.
PowerPoint presentation to accompany Operations Management, 6E (Heizer & Render) © 2001 by Prentice Hall, Inc., Upper Saddle River, N.J F-1 Operations.
Simulation is the process of studying the behavior of a real system by using a model that replicates the system under different scenarios. A simulation.
Risk Analysis Simulate a scenario of possible input values that could occur and observe key impacts Pick many input scenarios according to their likelihood.
Computer Simulation. The Essence of Computer Simulation A stochastic system is a system that evolves over time according to one or more probability distributions.
Summarizing Risk Analysis Results To quantify the risk of an output variable, 3 properties must be estimated: A measure of central tendency (e.g. µ ) A.
1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random.
1 BA 555 Practical Business Analysis Linear Programming (LP) Sensitivity Analysis Simulation Agenda.
Risk Analysis Simulate a scenario of possible input values that could occur and observe key financial impacts Pick many different input scenarios according.
1 Doing Statistics for Business Doing Statistics for Business Data, Inference, and Decision Making Marilyn K. Pelosi Theresa M. Sandifer Chapter 2 The.
Microsoft Office 2013 ®® Calculating Data with Formulas and Functions.
Simulation Chapter 16 of Quantitative Methods for Business, by Anderson, Sweeney and Williams Read sections 16.1, 16.2, 16.3, 16.4, and Appendix 16.1.
Microsoft ® Excel ® 2013 Enhanced Excel Tutorial 3 Calculating Data with Formulas and Functions.
Microsoft Excel Prepared by the Academic Faculty Members of IT.
To accompany Quantitative Analysis for Management, 9e by Render/Stair/Hanna 15-1 © 2006 by Prentice Hall, Inc. Upper Saddle River, NJ Prepared by.
Simulation Modeling.
Simulasi sistem persediaan
Computer Simulation Henry C. Co Technology and Operations Management,
Monte Carlo Simulation Random Number Generation
Prepared by Lloyd R. Jaisingh
Monte Carlo Simulation
Sampling Distributions and Estimation
Simulation - Introduction
Prepared by Lee Revere and John Large
Simulation Modeling.
Working with Formulas and Functions
Spreadsheets 2 Explain advanced spreadsheet concepts and functions
Spreadsheets Objective 6.02
Statistical analysis and its application
Spreadsheets Objective 6.02
Working with Formulas and Functions
Simulation Supplement B.
Presentation transcript:

Monte Carlo SIMULATION with EXCEL Montana Going Green Workshop October 2010

2 What we will discuss Background Monte-Carlo intro Examples

3 Simulation Simulation refers to a broad collection of methods and applications that we use to mimic complex real systems We “reproduce” the operational behavior of a system. We use simulation to evaluate a system through a model (numerically). We collect data from a simulation to support our analysis.

4 Simulations Support Risk Analysis Risk implies a potential for loss Uncertainty does not mean “loss” or “risky” Three tools to help us inform decision makers –Best case – worst case (no idea on how our outcomes are distributed) –“What if” analysis (many required…) –Simulations (greater insights on outcomes)

5 Types we will see Static versus Dynamic –Static – time is not a player –Dynamic – we are interested in time Continuous versus Discrete –Continuous – state of the model can change continuously (water flowing in a reservoir) –Discrete – change only occurs at given points (arrival and departures) Deterministic versus stochastic –Deterministic – all inputs known, with fixed time periods –Stochastic – random inputs (random arrival times) Random Variable – a variable whose value cannot be predicted or set with certainty

6 Simulation To simulate is to try to duplicate the features, appearance, and characteristics of a real system because not all parameters are known with certainty. A large family of problems consist of random variables represented by probability distributions. “Probabilistic” models are a natural application of computerized simulation. Simulation = a systematic way of analyzing such problems. –Can imitate a real-world situation with a mathematical model that does not affect operations –Study the model’s properties and operating characteristics –Draw conclusions and make decisions based on the simulation’s results

7 Where we find Simulations Manufacturing Queuing – banks, stores, latrines,…. Business and finance – returns, futures, rates, … Military with systems design or combat operations Development of new items

8 When should we simulate? A decision is being made that needs additional information The process is well defined and repetitive Activities in the system exhibit interdependency and are repetitive The cost impact of the decision is greater than the cost of doing the simulation The cost of experimentation is greater than the cost to do a simulation

9 Disadvantages GOOD simulations may take months to develop and can be very expensive “Trial and error” approach – does not produce optimal results (descriptive) The model will not produce answers without adequate and realistic inputs. Each one is unique

10 Simulation Characteristics Captures system interdependencies Accounts for variability Versatile to model almost any system Illustrates behavior over time Less costly than using a real system for testing Rich source of information on multiple measures Interesting to the user and senior management Results can be communicated and explained Runs in compressed time Different levels of detail Avoids disruptive trial and error methods Safety – think of flight simulators

11 Applications Work flow planning Capacity planning Cycle time reduction Staff and resource planning Work prioritization Bottleneck analysis Quality improvement Cost reduction Inventory reduction Throughput analysis Productivity improvements Layout analysis Line balancing Batch size Production scheduling Resource scheduling Maintenance scheduling System design

12 Algorithm An algorithm is a step-by-step process that traces the inputs through the major steps to the outputs. We need an algorithm for every simulation. Programming is not an algorithm.

13 Process in Monte Carlo Simulation Random numbers  Event  Outcomes

14 Algorithm Example 1: Flip of a Coin-Probability Inputs: Number of trials (flips), N Output: P(H), P(T) Step 1: Set Counter H and T at 0. Step 2: For I = 1 to N (number of flips) do Step 3: Generate a random number, x i, between [0,1] Step 4: If 0 < x i <.5, then H=H+1, else T=T+1 Step 5: Calculate P(H) = H/N and P(T)=T/N Output P(H) and P(T) Stop

15 Algorithm Generic enough to be coded by any simulation language or Excel.

Simulations with EXCEL

17 Monte Carlo Simulations Pieces Generate Random Numbers  Events (logical statements for assignment)  Output or Calculated Result

18 Random Number in EXCEL RAND Show All Returns an evenly distributed random real number greater than or equal to 0 and less than 1. A new random real number is returned every time the worksheet is calculated. RAND( ) To generate a random real number between a and b, use: RAND()*(b-a)+a If you want to use RAND to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND() in the formula bar, and then press F9 to change the formula to a random number. Example

19 Integers Use the Excel command =randbetween(#1,#2) To get a random integer between 1 & 6 use =Randbetween(1,6)

20 Logical “IF” Statements in EXCEL Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE. Use IF to conduct conditional tests on values and formulas. IF(logical_test,value_if_true,value_if_false) Logical_test is any value or expression that can be evaluated to TRUE or FALSE. For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100, the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE. This argument can use any comparison calculation operator. Value_if_true is the value that is returned if logical_test is TRUE. For example, if this argument is the text string "Within budget" and the logical_test argument evaluates to TRUE, then the IF function displays the text "Within budget". If logical_test is TRUE and value_if_true is blank, this argument returns 0 (zero). To display the word TRUE, use the logical value TRUE for this argument. Value_if_true can be another formula. Value_if_false is the value that is returned if logical_test is FALSE. For example, if this argument is the text string "Over budget" and the logical_test argument evaluates to FALSE, then the IF function displays the text "Over budget". If logical_test is FALSE and value_if_false is omitted, (that is, after value_if_true, there is no comma), then the logical value FALSE is returned. If logical_test is FALSE and value_if_false is blank (that is, after value_if_true, there is a comma followed by the closing parenthesis), then the value 0 (zero) is returned. Value_if_false can be another formula.

21 Applied to Flip of a Coin Algorithm Random number [0,1] If RN <.5, call it a head Otherwise it is a tail. Count the number of heads and find P(Heads) = number of heads/ total experiments

22 EXCEL Column 1 will be our Random Numbers, =rand(). Copy it down to get N random numbers. Column 2 will be our IF statement; =IF(A2<.5,1,0) Return a 1 if a heads and a 0 is a tail. Sum column of 1 and 0 to get total number of heads. Compute P (heads) = total number of heads/N Also, P(tails)=1-P(heads)

23 EXCEL has limits Only 7 imbedded IF statements can be used. Only a limited number of columns and rows also so that limits variables and the number of trails, N.

24 Example You are investing for your retirement and want to choose a set of investments. Each has an “expected” return, but there is a min and a max return from each investment. You have a limited amount to invest. How do you decide?

25 Monte Carlo Monte Carlo method is a technique that involves using random numbers and probability to solve problems. The system we are looking at depends on chance. The basic experimentation on chance can be explained with random sampling. Our basic steps –Set up a probability distribution for our important variables –Build a cumulative distribution for each variable –Establish random number intervals –Generate the random numbers –Obtain outcomes based on prob. –Simulate the system

26 Example -- Deterministic Model Deterministic – no random inputs (fixed time periods) Example: determine the return on a 5- year investment with an annual interest rate of 7%, compounded monthly. The model is just the equation :

27 Why simulate this? We can quickly do “what ifs”. What if we could invest more money What if the interest rate is now __% What if we can afford to invest for x or y years?

28 Example – Stochastic model Unlike our Deterministic model, model results depend on a distribution…a stochastic model is one that involves probability or randomness.

29 Stochastic Simulations It is important to remember that since probability is based on the law of large numbers that we should run a stochastic simulations lots of times (thousands and thousands of iterations if possible).

30 First – Let’s Organize Use Rows and columns to your advantage Frequency -- shows the number of times that the event has occurred Probability – the chance of an event occurring Cumulative Probability – you add the probabilities of the different events, all sum to “1” Random Number Interval – use your cumulative distribution to determine your random number range (first and last values within a range)

31 Basic Steps – An Example Historical Calculate the Probability Calculate the Cumulative Assign Range

32 Example Demand forCumulativeRandom # Item AFrequencyProbability Interval

33 Probability Table Demand for CumulativeRandom # Item A FrequencyProbabilityProbabilityInterval (0,.1] (.1,.25] (.25,.45] (.45,.70] (.7,.85] (.85,.95] (.95,1.0]

34 Random Numbers Pick a number between LO and HI – that is a RANDOM number In EXCEL: –RAND() -- returns a random number between zero and one. –If you want numbers between zero and five, multiply by five: =5*RAND(). If you want numbers between 3 and 8, use =3+5*RAND(). How would you get a random number between 0 and 50? 0 and 100? –RANDBETWEEN(lo,hi) -- returns a random integer between lo and hi. (for example, RANDBETWEEN(1,9) returns an integer between 1 and 9.

35 Random Numbers

36 Other Distributions Uniform as we have seen Normal  norminv(rand(), mean, SD) Integer  round(norminv(rand(), mean, SD)) Exponential  (-1/mean)*ln(rand())

37 The Basic Statistics Sample Size (n): =COUNT(G:G) Sample Mean: =AVERAGE(G:G) Median: =MEDIAN(G:G) Sample Standard Deviation (σ): =STDEV(G:G) Maximum: =MAX(G:G) Minimum: =MIN(G:G) Skewness: =SKEW(G:G) Kurtosis: =KURT(G:G) A positive skewness indicates that the distribution has a longer right-hand tail (skewed towards more positive values). Positive kurtosis indicates a more peaked distribution.

38 Sample Size The sample size, n, is the number of observations or data points from a single simulation. Because the Monte Carlo method is stochastic, if we repeat the simulation, we will end up calculating a different set of summary statistics. The larger the sample size, the smaller the difference will be between the repeated simulations. Better to have a large sample size.

39 More Stats Page If you repeat your simulation and record the sample mean each time, the distribution of the sample mean would end up following a Normal distribution. This is the Central Limit Theorem. Confidence Interval -- We can be 95% confident that the true mean of the population falls somewhere between the lower and upper limits."