Lecture 5
Lecture 5
1
AGENDA
2
RANDOM NUMBER TABLE
3
RANDOM NUMBERS IN EXCEL
4
RANDOM NUMBERS IN EXCEL:
RAND FUNCTION
5
EXPERIMENTING WITH RAND FUNCTION
6
EXPERIMENTING WITH RAND FUNCTION
Develop a frequency table to see how the 500 random number are
distributed.
Enter a column of “bin values” (the upper ends of the categories): 0.1, 0.2,
up to 0.9
Highlight an adjacent range one cell longer than the bin range.
Enter formula =FREQUENCY(data,bin) and press Ctrl-Shift-Enter.
7
EXPERIMENTING WITH RAND FUNCTION
8
FREEZING THE RANDOM NUMBERS
Copy the random numbers on the original sheet to a new sheet with the Paste
Special/Values option.
The pasted copy is now frozen (does not change when F9 key is pressed).
Freezing random numbers is sometimes useful in simulation models, but not
always.
See “Freezing Numbers” worksheet.
9
SIMULATING VALUES FROM PROBABILITY
DISTRIBUTIONS
10
EXAMPLE 1: MONTE CARLO SIMULATION
REVISIT WITH EXCEL
12
STEP 2: DETERMINE RANDOM OBSERVATION
(LOOKUP)
14
STEP 2: VLOOKUP (ALTERNATIVE)
16
VLOOKUP FUNCTION: EXAMPLE
See “Higgins - Vlookup” worksheet
Observe that “Upper limit” = “Cumulative probability” in the last
example Don’t need two different columns.
17
HIGGINS – SALES AND OUT-OF-STOCK
Art sells newspaper. He cannot foretell the daily demand 𝐷 (i.e. the number of
newspapers that he can sell in any day).
Each morning, Art orders 𝑞 newspapers from his wholesaler at $3 each.
Art sells the newspaper at $5 each. If he has unsold units at the end of the day,
he receives $0.50 per scrap (i.e. an unsold piece).
Art wants to maximize his average daily profit. How many newspapers, 𝑞, should
he order each morning?
19
EXAMPLE 2: ART’S NEWSSTAND
Art wants to determine the optimal order quantity to maximize his average
daily profit.
Why focus on average profit?
Taking expectation on Art’s random daily profit yields Art’s average daily profit,
namely:
E5 min 𝑞, 𝐷 0.5 max 𝑞 𝐷, 0 3 𝑞
Maximizing Art’s average daily profit is expressed by
max E 5 min 𝑞, 𝐷 0.5 max 𝑞 𝐷, 0 3 𝑞
21
EXAMPLE 2: ART’S NEWSSTAND
22
EXAMPLE 2: ART’S NEWSSTAND
23
EXAMPLE 2: ART’S NEWSSTAND
Art tells us that the daily demand follows a uniform distribution between 30
pieces and 150 pieces, inclusive.
That is, 𝐷 ~ 𝑈 30,150 and every integer between 30 and 150 occurs with
EQUAL probability.
When we have a uniform distribution between a and b, we can use the
RANDBETWEEN(a,b) function as a shortcut!
24
EX 2, Q1: COMPUTING AVERAGE PROFIT
Average over profits
in Col C
Profit
=5*MIN($B$1,B7)
+0.5*MAX(0,$B$1-B7)
-3*$B$1
25
Simulated Demand
=RANDBETWEEN(30,150)
EXAMPLE 2: ART’S NEWSSTAND
Average Profit as a Function of the Number of Observations, given that the daily
order quantity is 𝑞 80.
26
EX Q2: OPTIMAL ORDER QUANTITY
Q2: How many newspaper should Art order daily to maximize his
average profit?
Method 1: Data table
Method 2: Scenario Manager
27
SUMMARY
28