Prescriptive Modeling


Lecture 10

October 6, 2025

Review of Previous Classes

Monte Carlo

  • Stochastic simulation of \(Y = f(X)\)
  • Useful to compute expected values of quantities (integrals)
  • Monte Carlo Estimate of \(\mu = \mathbb{E}[Y]\): \[\tilde{\mu}_n = \frac{1}{n}\sum_{i=1}^n f(Y_i)\]

Why Monte Carlo Works

  • Unbiased estimates (across multiple samples)
  • Convergence of single sample:
    • Law of Large Numbers

Monte Carlo Standard Error

  • Standard error: \(\sigma_Y / \sqrt{n} \approx \tilde{\sigma}_{\hat{Y}_n} / \sqrt{n}\)
  • Central Limit Theorem: \[\tilde{\mu}_n - \mu \sim \mathcal{N}\left(0, \frac{\sigma_Y^2}{n}\right)\]

Monte Carlo Confidence Intervals

  • Construct CIs using this normal approximation: \[\tilde{\mu}_n \pm \Phi^{-1}\left(1 - \frac{\alpha}{2}\right) \frac{\sigma_Y}{\sqrt{n}}.\] For example, the 95% confidence interval is \[\tilde{\mu}_n \pm 1.96 \frac{\sigma_Y}{\sqrt{n}}.\]

CI Interpretation: Mean of \(N(0.4, 2)\)

Code
# set up distribution
mean_true = 0.4
n_cis = 100 # number of CIs to compute
dist = Normal(mean_true, 2)

# use sample size of 100
samples = rand(dist, (100, n_cis))
# mapslices broadcasts over a matrix dimension, could also use a loop
sample_means = mapslices(mean, samples; dims=1)
sample_sd = mapslices(std, samples; dims=1) 
mc_sd = 1.96 * sample_sd / sqrt(100)
mc_ci = zeros(n_cis, 2) # preallocate
for i = 1:n_cis
    mc_ci[i, 1] = sample_means[i] - mc_sd[i]
    mc_ci[i, 2] = sample_means[i] + mc_sd[i]
end
# find which CIs contain the true value
ci_true = (mc_ci[:, 1] .< mean_true) .&& (mc_ci[:, 2] .> mean_true)
# compute percentage of CIs which contain the true value
ci_frac1 = 100 * sum(ci_true) ./ n_cis

# plot CIs
p1 = plot([mc_ci[1, :]], [1, 1], linewidth=3, color=:deepskyblue, label="95% Confidence Interval", title="Sample Size 100", yticks=:false, legend=:false)
for i = 2:n_cis
    if ci_true[i]
        plot!(p1, [mc_ci[i, :]], [i, i], linewidth=2, color=:deepskyblue, label=:false)
    else
        plot!(p1, [mc_ci[i, :]], [i, i], linewidth=2, color=:red, label=:false)
    end
end
vline!(p1, [mean_true], color=:black, linewidth=2, linestyle=:dash, label="True Value") # plot true value as a vertical line
xaxis!(p1, "Estimate")
plot!(p1, size=(500, 500)) # resize to fit slide

# use sample size of 1000
samples = rand(dist, (1000, n_cis))
# mapslices broadcasts over a matrix dimension, could also use a loop
sample_means = mapslices(mean, samples; dims=1)
sample_sd = mapslices(std, samples; dims=1) 
mc_sd = 1.96 * sample_sd / sqrt(1000)
mc_ci = zeros(n_cis, 2) # preallocate
for i = 1:n_cis
    mc_ci[i, 1] = sample_means[i] - mc_sd[i]
    mc_ci[i, 2] = sample_means[i] + mc_sd[i]
end
# find which CIs contain the true value
ci_true = (mc_ci[:, 1] .< mean_true) .&& (mc_ci[:, 2] .> mean_true)
# compute percentage of CIs which contain the true value
ci_frac2 = 100 * sum(ci_true) ./ n_cis

# plot CIs
p2 = plot([mc_ci[1, :]], [1, 1], linewidth=3, color=:deepskyblue, label="95% Confidence Interval", title="Sample Size 1,000", yticks=:false, legend=:false)
for i = 2:n_cis
    if ci_true[i]
        plot!(p2, [mc_ci[i, :]], [i, i], linewidth=2, color=:deepskyblue, label=:false)
    else
        plot!(p2, [mc_ci[i, :]], [i, i], linewidth=2, color=:red, label=:false)
    end
end
vline!(p2, [mean_true], color=:black, linewidth=2, linestyle=:dash, label="True Value") # plot true value as a vertical line
xaxis!(p2, "Estimate")
plot!(p2, size=(500, 500)) # resize to fit slide

display(p1)
display(p2)
(a) Sample Size 100
(b) Sample Size 1,000
Figure 1: Display of 95% confidence intervals

Questions?

Poll Everywhere QR Code

Text: VSRIKRISH to 22333

URL: https://pollev.com/vsrikrish

See Results

Prescriptive Modeling

Prescriptive Modeling

If we want to design a treatment strategy, we are now in the world of prescriptive modeling.

Recall: Precriptive modeling is intended to specify an action, policy, or decision.

  • Descriptive modeling question: “What happens if I do something?”
  • Prescriptive modeling question: “What should I do?”

Decision Models

To make a decision, we need certain pieces of information which:

  • define decision options (or alternatives);
  • provide one or more objectives to assess performance;
  • specify constraints to tell us what decisions are possible or acceptable.

Be Careful…

The optimal solution of a model is not an optimal solution of a problem unless the model is a perfect representation of the problem, which it never is.

— Ackoff, R. L. (1979). “The Future of Operational Research is Past.” The Journal of the Operational Research Society, 30(2), 93–104. https://doi.org/10.1057/jors.1979.22

Objectives

Typical objectives can include:

  • Minimizing costs (or maximizing profits);
  • Minimizing environmental impacts;
  • Maximizing some other performance metric.

Approaches to Optimization

Generalized Search Algorithms

Function with Multiple Minima

Most search algorithms look for critical points to find candidate optima. Then the “best” of the critical points is the global optimum.

Generalized Search Algorithms

Function with Multiple Minima

Two common approaches:

  • Gradient-based methods
  • Evolutionary algorithms

Gradient Descent

Find estimate of gradient near current point and step in positive/negative direction (depending on max/min).

\[x_{n+1} = x_n \pm \alpha_n \nabla f(x_n)\]

Gradient Descent: Challenges

  1. Need to tune stepsize for convergence; some use adaptive methods;
  2. May not have information about the gradient.

The second is more problematic: in some cases, methods like stochastic gradient approximation or automatic differentiation can be used.

Random Search with Constraints

Can also incorporate constraints into search.

Drawbacks of Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if step sizes aren’t set correctly

waiting model evaluation meme

Generalized Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if step sizes aren’t set correctly

waiting model evaluation meme

Generalized Search Algorithms

These methods work pretty well, but can:

  • require a lot of evaluations;
  • may get stuck at local optima;
  • may not converge if not tuned well.

waiting model evaluation meme

Mathematical Programming

It can be convenient (and sometimes appropriate!) to formulate problems where we can guarantee finding a solution is a reasonable amount of time.

These approaches are called mathematical programs.

We will spend the next few weeks talking about linear programming and its variants.

Key Takeaways

Prescriptive Modeling

  • Prescriptive modeling involves decision models.
  • Key components of a decision model:
    • Decision Variables;
    • Objectives;
    • Constraints.
  • Need to bring to bear relevant engineering, economic, and environmental information to formulate these.

Approaches to Optimization

  • General approaches can be computationally expensive or we may not be able to guarantee convergence.
  • An alternative is mathematical programming: can often guarantee ability to find solutions but at the expense of needing very specific problem formulations.

Upcoming Schedule

Next Classes

Wednesday: Prelim 1, does not include material from today’s lecture.

Monday: Fall Break

Next Wednesday: Linear Programming

Assessments

HW3: Due next Thursday (10/16) at 9pm.