Skip to Content
Hands-On Prescriptive Analytics
book

Hands-On Prescriptive Analytics

by Walter R. Paczkowski
October 2024
Intermediate to advanced
412 pages
11h 1m
English
O'Reilly Media, Inc.
Content preview from Hands-On Prescriptive Analytics

Chapter 8. Simulation Examples

I provide five extensive examples of stochastic simulations in this chapter by building on and extending the material in Chapter 7. I will gradually make the examples more complicated, beginning with a simple coin toss problem and progressing to the hotel investment decision tree problem. More examples and explanations are in Paczkowski (2023).

The leading questions for this chapter are:

  • How do you specify a simulation?

  • How do you analyze a simulation’s results?

Example 1: Coin Toss

I discussed a simple coin toss experiment in Chapter 4 to introduce frequency-based probabilities. I simply noted that most people are familiar with the basic probability concept from tossing a coin. The assertion is that the probability of a heads-up on a toss of a fair coin is 0.50. I demonstrated where this number comes from in Chapter 4. But this does not mean it is correct in the real world. I also noted that probabilities are interpreted in terms of infinite series giving them a “long-run” interpretation. Of course, we cannot do something (e.g., flipping a coin) an infinite number of times. The question is then: “Can we devise an experiment to determine if, in the long-run (however defined), on the average, the probability is indeed 0.50?” You can do this with a simulation.

I provide a script in Figure 8-1 for simulating a coin toss. I first set some simulation parameters in Lines 4 to 11. A random seed is set at 42 followed by the number of coin tosses in ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Augmented Analytics

Augmented Analytics

Willi Weber, Tobias Zwingmann
Advanced Analytics with PySpark

Advanced Analytics with PySpark

Akash Tandon, Sandy Ryza, Uri Laserson, Sean Owen, Josh Wills

Publisher Resources

ISBN: 9781098153168Errata Page