pscm 7217.1.1 data analytics · origin the modern version of the monte carlo method was invented in...

36
* Reference - Business Analytics: Methods, Models, and Decisions (1 st edition, James R. Evans, Pearson) PSCM_7217.1.1 Data Analytics Excel Functions and Simulation Sang Jo Kim July 4, 2015

Upload: others

Post on 04-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

* Reference - Business Analytics: Methods, Models, and Decisions (1st edition, James R. Evans, Pearson)

PSCM_7217.1.1 Data Analytics

Excel Functions and Simulation

Sang Jo Kim

July 4, 2015

Page 2: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Excel PivotTable and PivotChart

Excel vlookup()

Monte Carlo Simulation

Contents

Page 3: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Excel Menu: Insert - Tables - PivotTable

Then, follow wizard steps.

PivotTables allow:

Quick creation of cross tabulations

Numerous custom-made summary tables and charts

Exploring Data Using PivotTables

Page 4: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

3-4

* PivotTable and vlookup.xlsx- The data table must have column titles.

Page 5: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

PivotTable Field List

Select the fields for:

Report Filter Column Labels Row Labels Σ Values

Or, before choosing PivotTable, you can select a cell in the data and let Excel prepare a default PivotTable.

Exploring Data Using PivotTables

Page 6: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

First Mission using

PivotTable

Page 7: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

7

2nd Mission using

PivotTable

3rd Mission using

PivotTable

Page 8: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

PivotChart Click the PivotTable you

created Choose “Option – PivotChart” from the menu

8

0

1000

2000

3000

4000

5000

6000

East North South West

Book

DVD

Page 9: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

vlookup() ≈ Database

Search

VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) lookup_value: The value you want to lookup

table_array: The range of cells that VLOOKUP will search for the Lookup_value and the return value. The first column in the cell range must contain the Lookup_value.

col_index_num: The column number (starting with 1 for the left-most column of table_array) that contains the return value.

range_lookup (optional)

• FALSE: searches for the exact value in the first column.

• TRUE: assumes the first column in the table is sorted either numerically or alphabetically, and will then search for the closest value. This is the default method if you don't specify one.

9

(range_lookup= FALSE)

Page 10: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

vlookup() ≈ Database Search

10

(range_lookup = TRUE)

* Returns the closest number smallerthan the value* The first column should be sorted!

Page 11: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Simulation and Risk Analysis

Spreadsheet Models with Random Variables

Monte Carlo Simulation Using Risk Solver

Newsvendor Model

Monte Carlo Simulation

Page 12: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Origin The modern version of the Monte Carlo method was invented in the late 1940s by

Stanislaw Ulam, while he was working on nuclear weapons projects at the Los Alamos National Laboratory. It was named by Nicholas Metropolis, after the Monte Carlo Casino (in Monaco), where Ulam's uncle often gambled. Immediately after Ulam's breakthrough, John von Neumann understood its importance and programmed the ENIAC computer to carry out Monte Carlo calculations.

Typical procedure Define a domain of possible inputs.

Generate inputs randomly from a probability distribution over the domain.

Perform a deterministic computation on the inputs.

Aggregate the results.

Monte Carlo Simulation

* Source: Wikipedia

Page 13: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Outsourcing Decision Model Base model: What if the “Production volume” (Demand)

= 1,500?

Spreadsheet Models with Random Variables* Monte Carlo Simulation.xlsx

Page 14: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Outsourcing Decision Model Suppose production volume is uncertain ~ N(1000,1002) Replace cell B12 (Prod. volume) with

=ROUND(NORM.INV(RAND(),1000,100),0)

Spreadsheet Models with Random Variables

* Press F9to recalculate

=ROUND(NORM.INV(RAND(),1000,100,true),0)

* Monte Carlo Simulation.xlsx

Page 15: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Outsourcing Decision Model: Simulation solely using standard Excel functions

Spreadsheet Models with Random Variables

* Limitation: How many trials would be sufficient? Law of Large Numbers!

Page 16: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Law of Large Numbers

The Law: The average of the results obtained from a large number of trials should be close to the expected value, and will tend to become closer as more trials are performed.

(ex) Die casting• SJ: Bets on {1,2}• SP: Bets on {3,4,5,6}

Who will win from a die casting?

(ex) Newsvendor problem We are maximizing the “expected” profit

The expected profit for a given ordering quantity can be closely achieved only after a “Large Number” of trials!

Page 17: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Steps for Simulating with the Risk Solver Platform

1. Develop a spreadsheet model. (Deterministic)

2. Determine probability distributions for uncertain input variables.

3. Identify output variables you want to predict.

4. Choose the number of trials and replications.

5. Run the simulation.

6. Interpret the results.

Monte Carlo Simulation Using Risk Solver

Page 18: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using Risk Solver Platform Probability Distribution Functions

For the Outsourcing Decision Model, assume that two inputs are uncertain – demand and unit cost.

Demand (production volume) is normally distributed with a mean of 1000 and standard deviation of 100 units.

Unit cost has a triangular distribution with a minimum of $160, most likely value of $175, and a maximum of $200.

Monte Carlo Simulation Using Risk Solver

Page 19: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using Risk Solver Platform Probability Distribution Functions

=PsiNormal(1000,100,PsiTruncate(0, 1E+30))

=PsiTriangular(160,175, 200)XX

Monte Carlo Simulation Using Risk Solver

Page 20: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using the Distributions Button in Risk Solver PlatformSelect cell B12.Risk SolverDistributionsCommonNormal

Mean=1000Stdev=100

Select cell B10and enter unitcost distribution.

Monte Carlo Simulation Using Risk Solver

Page 21: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using the Distributions Button in Risk Solver Platform

Normal Distribution dialog for Demand in cell B12

Monte Carlo Simulation Using Risk Solver

“Truncated” Normal Distribution

X 0

Page 22: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using the Distributions Button in Risk Solver Platform

Triangular Distribution dialog for Unit Cost in cell B10.

Monte Carlo Simulation Using Risk Solver

Page 23: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Defining Uncertain Cells in Risk Solver Define worksheet cells for the output variables

you want to predict using the Results button in the Simulation Model group.

Risk Solver calls these uncertain cells. Uncertain cells must be numeric. The values of these cells will be computed using

the randomly generated input values. There will be one value of each uncertain cell

generated on each trial of the simulation.

Monte Carlo Simulation Using Risk Solver

Page 24: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using the Results Button in Risk Solver Platform

Select cell B19.Risk SolverResultsOutputIn Cell

Risk Solver then modifies cell B19 (you can do this manually as well).

=B16-B17+PsiOutput()xx

Monte Carlo Simulation Using Risk Solver

Page 25: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Running a Simulation Options, All Options Simulation Tab Trials per Simulation

Use at least 5000 trials. Simulations to Run

Use more than 1 run ifyou want to examine variation between runs.

Simulation Random SeedChoose a nonzero numberif you want to reproduce theexact same results.

Sampling MethodUse Monte Carlo for more randomized sampling.

Monte Carlo Simulation Using Risk Solver

Page 26: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Run and View Simulation Results in Risk Solver Choose Simulate, Run Once

Frequency tab displays a histogram and summary statistics for the output variable.

Chart Statistics support risk analysis via changes to upper/lower cutoffs.

Click the down arrow next to Statistics to change the results displayed.

Double click on any uncertain output cell to view

its results.

Monte Carlo Simulation Using Risk Solver

Page 27: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Monte Carlo Simulation Using Risk Solver

Analyzing Simulation Results for the Outsourcing Decision Model

Page 28: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Analyzing Simulation Results for the Outsourcing Decision Model

Monte Carlo Simulation Using Risk Solver

Page 29: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

A small candy store sells Valentine’s Day gift boxes that cost $12 and sell for $18.

In the past, at least 40 boxes have sold by Valentine’s Day but the actual amount is unknown.

After the holiday, boxes are discounted 50%.

Determine net profit on the gift boxes.

C = 12, R = 18, S = 9

Net profit = R(min{Q,D}) + S(max{0,Q−D}) − CQ

=18(min{Q,D}) + 9(max{0,Q−D}) − 12Q

Newsvendor Model

Page 30: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Newsvendor Model

Suppose the store owner kept records for the past 20 years on number of boxes sold.

Original Newsvendor ModelHistorical data on boxes sold

* Monte Carlo Simulation - Newsvendor.xlsx

Page 31: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Newsvendor Model

Page 32: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Simulating the Newsvendor Model Using Resampling

Newsvendor Model

Generate candy sales by resampling from the 20 historical values.

Set demand in B11 as a random variable.

“Distributions” –“Distribution Wizard”

Set profit in B17 as the uncertain output.

Page 33: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Simulating the Newsvendor Model Using Resampling

Newsvendor Model

Page 34: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Using a Fitted Distribution for Monte Carlo Simulation

Newsvendor Model

Generate candy sales by fitting a probability distribution to the 20 historical sales values.

Page 35: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Use the function structure: Concavity or convexity, etc.

Systematically choose the decision variable values and observe the objective function values

Choose the decision variable values closer to the optimal zone you guess

Optimization Using Simulation

Page 36: PSCM 7217.1.1 Data Analytics · Origin The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects

Questions & Discussions ?

© Copyright Malaysia Institute for Supply Chain Innovationwww.misi.edu.my

36