The smaller exercises embedded in the other Lecture 13 notebooks, from About Simulation Optimization to Gradient Methods, check what you just read. This notebook collects the larger exercises for Lecture 13: independent problems worth more time.
In a simulation setting, the number of experiments is typically large enough that the -distribution with degrees of freedom is very close to the normal distribution. The exercises below therefore use the inverse standard normal distribution as an approximation for the inverse -distribution, via these common critical values:
| confidence level | critical value |
|---|---|
| 0.90 | 1.645 |
| 0.95 | 1.96 |
| 0.99 | 2.575 |
Homework Exercises¶
Solution to Exercise 1 #
a. Number the investments 1-4 and let binary if investment is chosen. The ILO is
b. Compute the total return and budget spend of the chosen policy. Simulate a budget realization from : if the simulated return is , if it is . Repeat this simulation many times; the sample average of the simulated returns approximates the expected return.
c. The 95% confidence interval is
Since 0 lies in this interval, we cannot conclude with 95% confidence that one policy is significantly better than the other.
d. Run more simulations, or use common random numbers (the same simulated budget realizations for both policies) to reduce variance.
Solution to Exercise 2 #
a. The 95% confidence interval is
Since 0 is not in this interval, we can conclude with 95% confidence that A is significantly different from (better than) B.
b. Scenario A has the larger sample standard deviation, so adding simulations there reduces the confidence interval width the most: with the extra 200 on A, the width becomes approximately ; with them on B, approximately . So the extra simulations should go to A.
c. Test : B is not worse than A, and : C is not worse than A, both at significance level (adjusted for testing two comparisons at once), whose corresponding critical value is approximately 1.96. If both null hypotheses are rejected, A is significantly better than both B and C.
Since , is rejected. Since , is also rejected. So, with 95% confidence, A is better than both B and C.
Solution to Exercise 3 #
a. Let be the two experiments’ outcomes, with samples each, and let . By the central limit theorem,
approximately, with and, since and are independent, . So the difference of sample averages is approximately : mean 0.9, standard deviation .
b. Using part a, the 95% confidence interval is
c. Test the three null hypotheses that experiment 2, 3, or 4 (respectively) has a higher outcome than experiment 1. With three simultaneous comparisons, adjust the confidence level to , with critical value approximately 2.12. All three null hypotheses must be rejected to conclude experiment 1 has the significantly highest outcome.
The first test asks whether ; working out the right-hand side gives , which is false, so this null hypothesis cannot be rejected already. We therefore cannot conclude that experiment 1 has the significantly highest outcome (the other two comparisons, and , would in fact have been rejected, but that no longer matters once one comparison fails).
Solution to Exercise 4 #
Rather than splitting the whole budget of 2000 evenly across all 21 candidate values of , use a two-phase ranking-and-selection approach. In an orientation phase, simulate every candidate a smaller number of times (e.g. 30 each, spending of the budget) and use a conservative -test (accounting for the number of comparisons made) to discard candidates that are significantly worse than some other candidate. In a second phase, divide the remaining budget ( simulations) over only the candidates that were not discarded.
Many problems have candidates that are clearly worse than the top few; identifying and discarding these early frees up simulation budget to more precisely compare the remaining, more promising candidates in the second phase. This concentrates statistical power where it matters, increasing the chance of correctly identifying the true best compared to spreading the budget uniformly over all 21 candidates from the start.
Solution to Exercise 5 #
a. y holds the average profit of each order size after the first round, s
the sample standard deviation , and m0 the number of runs of every
order size in the first round. With order sizes,
.
b. beta is about 2.27, and since all standard deviations are equal, every comparison
uses the same margin . An order size is
discarded if its average is at least 0.48 below the average of another order
size. The highest average is 1.55 (order size 8), so order sizes with an average
at most are discarded: 4 (0.98) and 12 (0.45). The code prints
[6, 8, 10].
c. With equal standard deviations the margin is the same for every pair. If an order size is beaten by some other order size, so , then it is certainly beaten by the order size with the highest average, because that average is at least . So comparing with that one order size gives the same result.
d. Remember the order size that beats it, and print it after the inner loop:
for order in y:
discard = False
for other in y:
if other != order:
margin = beta * np.sqrt(s[order] ** 2 + s[other] ** 2) / np.sqrt(m0)
if y[order] <= y[other] - margin:
discard = True
beaten_by = other
if discard:
print(order, "is beaten by", beaten_by)
else:
survivors.append(order)e. Replace the line beta = stats.t.ppf(1 - alpha_star, m0 - 1) by
beta = stats.t.ppf(1 - alpha, m0 - 1). Then beta is about 1.66, the margin is
, and order sizes with an average of at most
are discarded: 4, 10 and 12. This is not a good idea because
each order size is tested against four others: even if it is the best one, the
probability that at least one of the four tests discards it by chance is then
larger than 5%.
f. The first round used runs, so 900 runs are left:
budget = 1400
n_each = (budget - k * m0) // len(survivors)
print(n_each)With three survivors, each gets 300 extra runs.
References¶
Koole, G. (2019). An Introduction to Business Analytics. §8.1, §8.2, §8.3.