HEG Genève APPLIED STATISTICS · WEEK 3 ← Course
This week
0%
Course
0%
Week 3 · Applied Statistics · HEG Genève

Will we run out of dough on Friday?

Weeks 1–2 described what already happened. From this week on, the pizzeria has to plan on chances: how many Margheritas will a Friday bring, what is an insurance premium worth, how likely is a sell-out? This week builds the language for that — probability rules, random variables, their mean and standard deviation, and the first workhorse distribution, the binomial. This is the textbook's chapter 4, opened with the rules from chapter 3 it relies on.

The session is three hours in two parts. Part 1 (~1 h) is the lesson: your instructor presents the deck and you follow the same numbered sections here — every slide names its section. Part 2 (~2 h) is ten exercises taken straight from the textbook, worked together; solutions open as your instructor reveals them.

🏫 In class: 3 h · lesson ~1 h, then exercises ~2 h · bring a calculator 📖 Textbook: Saylor, ch. 4 (with the rules of ch. 3) ▶ The Lecture button (top-right) shows the deck we use in class

By the end of Week 3 you will be able to

  • Read probabilities off a two-way table — complement, union, intersection, conditional — and test whether two events are independent.
  • Tell a discrete random variable from a continuous one.
  • Check that a table is a valid probability distribution, and compute its mean µ = Σ x·P(x) and standard deviation σ.
  • Use the expected value to price a bet, a lottery ticket or an insurance policy.
  • Recognise a binomial situation, compute P(X = k), and its mean np and standard deviation √(npq).
  • Turn "what is the chance we sell out?" into a number the pizzeria can plan on.

Resources — tick them off as you go

✓Lecture deck — the ▶ Lecture button above; presented in class in Week 3.
✓Saylor ch. 3 — Basic Concepts of Probability ↗ — only what §3.2 of this page uses: complements, unions, intersections (§3.2) and conditional probability & independence (§3.3). About 20 minutes.
✓Saylor ch. 4 — Discrete Random Variables ↗ — §4.1 random variables · §4.2 probability distributions, mean, standard deviation · §4.3 the binomial. About 40 minutes; read a section after doing its screen here.
✓Part 2 · the exercise set — ten exercises from chapters 3 and 4 of the textbook, word for word, ~110 min, worked with your instructor in the second half. Section 3.7 below. Bring a calculator.
✓Week 3 homework — thirteen more exercises from the same chapters: two-way tables, distributions, expected value, the binomial. With hints and worked solutions.
✓The shape of uncertainty — which distribution, when. Open the binomial and play with n and p.
← Course page
A reset link lives at the bottom of section 3.9.
Section 3.1 · The hook

Will we run out of dough?

Your estimate

Friday night. 140 customers. 120 dough balls.

On a Friday the pizzeria expects 140 customers. Each of them, independently, orders a Margherita with probability 0.8. The kitchen prepares 120 dough balls for Margheritas in the morning, and dough cannot be made during service. What is the chance we run out?

Your estimate of P(sell-out)
30%
What the week is for

You cannot answer that yet — and that is the point.

The number of Margheritas ordered on Friday is not known in advance. It is a random variable: a number that depends on chance. To say how likely 121 or more is, you need its whole probability distribution — every possible value and its probability. Section 3.6 writes that distribution down, and the answer comes back at the end of it.

Description told you what happened. Probability tells you what to prepare for.

Section 3.2 · The probability rules you need

Chances from counting

A two-way table

Last month: 400 delivery orders, counted two ways.

Every order is classified by what was ordered and where it went. When every order is equally likely to be picked, a probability is simply a count divided by 400. Choose an event A (a row) and an event B (a column) and read off every rule of chapter 3.

Pick A and B
—
P(A)
—
P(B)
—
P(A ∩ B)
—
P(A ∪ B)
—
P(A | B)
The five rules, in one place

Everything in Part 2's first two exercises is one of these.

P(Aᶜ) = 1 − P(A)  ·  P(A ∪ B) = P(A) + P(B) − P(A ∩ B)  ·  P(A | B) = P(A ∩ B) ÷ P(B)
  • Complement Aᶜ — "not A". Often the fastest route: P(at least one) = 1 − P(none).
  • Union A ∪ B — "A or B or both". Subtract the overlap, or you count it twice.
  • Intersection A ∩ B — "A and B". A single cell of the table.
  • Conditional P(A | B) — "A, given that B happened": shrink the table to column B and count again.
  • Mutually exclusive: A ∩ B is empty — they cannot both happen. Independent: knowing B does not change the chance of A, P(A | B) = P(A), or equivalently P(A ∩ B) = P(A) · P(B).

Mutually exclusive and independent are not the same thing — they are nearly opposites. If A and B cannot happen together, learning that B happened tells you A did not.

Try it

Independent, mutually exclusive, or neither?

Independent · Mutually exclusive · Neither
Section 3.3 · Random variables

A number attached to chance

Definition

A random variable assigns a number to each outcome of a chance experiment.

"How many Margheritas will Friday bring?" has an answer only after Friday. Before it, the count is a random variable — written with a capital letter, X, while a particular value it takes is a lower-case x.

  • Discrete — the possible values can be listed: 0, 1, 2, 3… You count them. Number of orders, of no-shows, of late deliveries.
  • Continuous — the possible values fill a whole interval. You measure them. Weight of dough, oven temperature, waiting time.

Count → discrete. Measure → continuous. This week is discrete; Week 4 is continuous.

Two traps. A count can be huge and still be discrete — the number of kernels in a bag of popcorn. And money is treated as continuous when it is an amount (the average spent on electricity), because it can take essentially any value in a range.

Try it

Discrete or continuous?

Discrete · Continuous
Section 3.4 · Probability distributions

The whole table of chances

Two rules, then two numbers

A probability distribution lists every value x and its probability P(x).

For it to be a valid distribution: every P(x) is between 0 and 1, and the P(x) add up to exactly 1. Nothing else is required — the values x need not be whole numbers.

µ = Σ x · P(x)   ·   σ² = Σ (x − µ)² · P(x) = Σ x² · P(x) − µ²   ·   σ = √σ²

The mean µ is a weighted average: each value weighted by how often it happens. The standard deviation σ is the same idea as in Week 2 — the typical distance from the mean — with probabilities in place of 1/n.

Margherita orders in one hour of Friday service — reshape it
—
Σ P(x)
—
mean µ
—
st. dev. σ
Use − and + under each value to move probability around. µ and σ only mean something while the total is exactly 1.

µ = 2.6 Margheritas an hour. Over a five-hour Friday service that is 13 — the number the morning prep list is built on.

Try it

Is it a valid probability distribution?

Valid · Not valid
Section 3.5 · Expected value

What is a bet worth?

The mean, with money on it

E(X) is what you gain per play, on average, over many plays.

When X is a net gain — winnings minus the price of playing — its mean has a special name, the expected value E(X). It is not a value you expect to see on any single play; it is the long-run average. Insurers, lotteries and casinos set prices by it.

The pizzeria's oven costs CHF 12,000 to replace. An insurer estimates the chance it breaks down within a year at 3%, and sells a one-year policy for a premium C. For the insurer, X takes two values:

outcomeno breakdownbreakdown
x (insurer's net gain)CC − 12,000
P(x)0.970.03
Set the premium

E(X) = C − 360. Below CHF 360 the insurer loses money on average; everything above it pays for staff, risk and profit.

The trap

Build the table from net gains, and check it sums to 1.

A lottery ticket costs $1 and the prize is $1,000: the winner's net gain is $999, not $1,000, and everybody else's is −$1. Forgetting to subtract the stake is the most common mistake in Exercises 5 and 6 of Part 2 — and it moves the answer by exactly the price of the ticket.

Section 3.6 · The binomial distribution

Ten tables, each 30% likely to order dessert

Four conditions

X counts successes in n trials. It is binomial when all four hold:

  1. A fixed number n of trials.
  2. Each trial has two outcomes: success or failure.
  3. The probability of success p is the same on every trial.
  4. The trials are independent.
P(X = k) = C(n, k) · pᵏ · qⁿ⁻ᵏ    with q = 1 − p and C(n, k) = n! ÷ (k! (n − k)!)
µ = np   ·   σ = √(npq)

Read the formula left to right: C(n, k) counts the orders in which k successes can fall among n trials; pᵏ is the chance of k successes; qⁿ⁻ᵏ the chance that the other n − k fail. Ten tables, each ordering dessert with p = 0.3: P(exactly 3) = C(10, 3) · 0.3³ · 0.7⁷ = 120 · 0.027 · 0.0824 = 0.2668.

The binomial, live — click a bar
—
µ = np
—
σ = √(npq)
—
P(X = k)
—
P(X ≤ k)
Click a bar to read P(X = k) and the cumulative P(X ≤ k).
The hook closes

140 customers, p = 0.8, 120 dough balls.

X = number of Margheritas ordered. Fixed n = 140, two outcomes, the same p = 0.8 for everybody, customers deciding independently: X is binomial. We sell out when X ≥ 121, i.e. X > 120.

Try it

Binomial or not?

Binomial · Not binomial
Section 3.7 · Part 2 · Exercises

Ten exercises from the textbook, worked together

The second half of the session

Straight from Saylor, word for word

This week's exercises are not invented: each one is reproduced exactly as it appears at the end of a section of the textbook, and each is labelled with its section and number, so you can find it in the book. Your instructor puts each exercise on the slide; you work it here, by hand, with a calculator. Check marks your number immediately, Hint nudges without giving it away, and the Solution button opens when the room does that exercise together.

About 110 minutes for all ten. Give probabilities to four decimals, as the book does. Parts of an exercise that ask you to explain are answered in the worked solution rather than in a box. Your answers are saved and reach your instructor's dashboard. Nothing here is graded.

Section 3.8 · Checkpoint

Prove it to yourself

Self-check · not graded

Ten questions on this week

One attempt per question, every answer explained. Your score syncs to your instructor's dashboard as a self-check but does not count toward your grade. Have a calculator to hand.

—

Where this goes next

In Week 4 the random variable becomes continuous — dough weight, waiting time — and the bars of this week melt into a curve: the normal distribution. It also answers the sell-out question for a 140-customer Friday in a line, because a binomial with large n looks normal. Before that, the Week 3 homework: thirteen more exercises from the book, by hand.

Section 3.9 · Workshop

How many dough balls?

Probability → decision

Pick the prep level; see the risk you are buying.

140 customers, each ordering a Margherita with p = 0.8. Every dough ball prepared and not used is thrown away at closing; every Margherita you cannot make is a disappointed customer. Move the slider and see the chance of selling out against the expected number of dough balls wasted.

Friday prep
—
P(sell-out)
—
expected balls wasted

There is no risk-free number. Statistics does not choose for you — it tells you exactly what each choice costs.

Week 3 · the pizzeria file

Four entries, in your own words

📎 Everything saves automatically and reaches your instructor's dashboard. This is the third instalment of the individual project.

1.An event that matters to your pizzeria, with its probability — and one event it is, or is not, independent of. Say how you would know.
2.A discrete random variable from your pizzeria, its distribution (at least four values), and its mean.
3.A binomial question about your pizzeria: say what n and p are, check the four conditions, and give the answer.
4.How many dough balls do you prepare on Friday, from the slider above — and why that number?
Fill in all four fields to complete this section.