Box Model and Chance Variability Explained
Box Model and Chance Variability Explained
Box Model
MODULE 3: SAMPLING DATA
2025-04-07
1
In this lecture
• Data Story I Coin tossing in WWII
• Part 1: Law of Averages
■ Chance Variability
■ Law of Large Numbers
■ Kerrich's experiment over time
■ Introducing the box model
• Part 2: The Box Model
■ Modelling the Sum of a Sample
■ Modelling the Mean of a Sample
■ Modelling the Sum/Mean of a Sample using the Normal Distribution
■ Using the Box Model for Binary Outcomes
• Part 3: The Normal Approximation
■ Why is the Normal curve so common?
■ Types of histograms
■ The Central Limit Theorem
■ Sample Size vs Replicates
■ Extension
2
Learning outcome
L06 Use the box model to describe chance and chance variability, including sample
surveys and the central limit theorem.
3
Data Story I Coin tossing in WWII
5
Coin tossing in WWII
• Recall John Edmund Kerrick (1903-1985) who was a mathematician noted for a
series of experiments in probability which he conducted while interned in Nazi-
occupied Denmark (Viborg, Midtjylland) in the 1940s.
• With a fellow internee Eric Christensen, Kerrich set up a sequence of experiments
demonstrating the empirical validity of a number of fundamental laws of
probability.
Q They tossed a (fair) coin 10,000 times and counted the number of heads.
• How many heads would you expect them to get?
• How many heads did they actually get (observe)?
6
•
9
Chance Variability
® Chance Processes
Every time you perform a chance process, there is chance variability.
10
Law of Large Numbers
CD Law of Large Numbers (or Law of Averages)
The Law of Large Numbers states that the proportion of heads becomes more
stable as the length of the simulation increases and approaches a fixed number
cal led the relative frequency.
That is the chance error in the number of heads is likely to be large in absolute
size, but small relative to the number of tosses.
11
Law of Large Numbers
For a fair coin:
• Even if we observe 100 heads in a row, the next throw P(Tail) == 0.5
12
Kerrich's experiment over time
Cumulative proportion of heads
0.6
0.5
0.4
+ rI
10 1
I l r ' I 'I
r
10 2
I ' I
l I
10 3
I I I I I I I rillI
10 4
Number of tosses
Q)
(.)
....a3 80
~
□
Q) 40
>
:.:;
~
:::l
~ o-1- -
0 r~~rw n
,..-., 55
~
0
C
0
t0
Cl.
0 ~--...._,..-_
0:: 50
Q)
>
:.:;
~
:::l
E
:::l
O 45
0 2500 5000 7500 10000
Index of Tosses
14
Introducing the box model
CD The box model
The box model is a simple way to describe many chance processes.
• We need to know:
■ the distinct numbers that go in the box ("tickets").
■ the number of each kind of tickets in the box.
■ the number of draws from the box.
15
Why the box model?
We'll be using the box model for the rest of the course as a simple way to visualise a
chance process.
1. Think of the box as a summary of the population (what's in there, and in what
proportions).
2. Take draws from the box to create the sample.
3. Consider the Sum or Mean of the sample.
• what is the expected value (EV)?
• what is the observed value (OV)?
• The chance error is OV - EV, which is modelled by the standard error (SE).
16
Applying the Box Model: A Three-Sided Die Thrown 5 Times
popu lation = "box" = ...
/'
I
I
I
I replace
\
\
n =s
\
\
'
• EV== 10
■ mean of box x n of draws== 2 x 5
• ov == 3 + 1 + 2 + 2 + 3 == 11
• CE == 11 - 10, Hence the chance error is 1.
17
Applying the Box Model to Gambling
CD Box model for Gambling
For a box model for gambling games:
• the tickets represent the amount won(+) and lost(-) in each play.
• the chance of drawing a particular ticket, is the chance of winning that amount
in 1 play.
• the number of draws is the number of plays.
The net gain is the sum of the draws from the box (sample).
18
Example: A Simple Die Game
• Suppose it costs $1 to play a game.
• If you roll a "6", you get back your $1, plus win another dollar.
• If you get any other number, you lose your $1.
• Play 25 times. What is your net gain/loss?
I
I • The distinct tickets are 1,2,3,4,5,6,
I representing the 6 unique faces of the
I replace
\ n = 25 dice.
\
\
• There is 1 of each ticket, as the dice is
'' fair.
19
Example: A Simple Die Game
• Suppose it costs $1 to play a game.
• If you roll a "6", you get back your $1, plus win another dollar.
• If you get any other number, you lose your $1.
• Play 25 times. What is your net gain/loss?
20
Example: Roulette on red
The Star Casino 00 roulette wheel has 38 pockets, numbered 0 (green), 00 (green)
and 1-36 {alternate red and black).
21
population = "box" = ...
;--
/
I
I
I replace
\ n = 10
\
\
''
• The distinct tickets are $1 and -$1, representing the "win" and "loss".
• There are 18 tickets with $1 (equivalent to landing on a red), and 20 tickets with
-$1 (equivalent to landing on a black or green).
22
Example: Roulette on a single number
• You bet on a single number, which costs $1. This is called "Straight Up".
■ If you win, you get $35 plus the dollar back.
~
• The distinct tickets are $35 and -$1,
/
I representing the "win" and "loss".
I
I
I replace • There is 1 ticket with $35 (equivalent
\ n =100
\ to landing on the chosen number), and
\
23
Example: Multiple Choice Quiz
• A quiz has 25 multiple choice questions, with 5 answers each.
■ You get 4 points for a correct answer.
■ You lose 1 point for an incorrect answer.
• If you haven't studied and guess each answer, what is your expected score?
1 Ticketx4 4 tickets x -1
~
• The distinct tickets are 4 and -1,
/
I representing "correct answer" and
I
I
I replace
"incorrect answer".
\
\ • There is 1 tickets with 4 (equivalent to
\
\
the correct answers), and 4 tickets
' with -1 (equivalent to the 4 incorrect
answers).
24
Part 2: The Box Model
Coin tossing in WWII
Kerrich and Christensen's experiment can be described a simple Box Model.
population = "box" = ...
1 (Head) 0 (Tail)
/ •
I
I
I
I replace
I n= 10,000
\
\
e
\
Now we more formally define the box model, so we can model the chance error by
the standard error (SE).
27
Modelling the Sum of a Sample
® Sum of random draws from a box model with replacement
where:
28
How to work out the SD of a box?
• As the box represents a population, the SD of the box is the population SD.
• We could call it SDpop, but in this context will will simply use SD.
29
Example: Coin tossing
Step 1: Draw the box model Step 2: Calculate the mean and SD of the box
i'
I
I
I • Or using the short cut, the SD is
I replace
\ n= 10,000
\
\ 1 1
(1 - 0) - X - == 0.5
'' 2 2
30
Example cont.
Step 3: Calculate the EV and SE of the Sum of the Sample
• The EV of the Sum of the draws is 10000 x 0.5 == 5000.
• The SE of the Sum of the draws is Jl0000 x 0.5 == 50.
Step 4: Conclusion
• We would expect a Sample Sum of 5000 (EV) with SE 50.
• Note: We observed a Sample Sum of 5067 (OV) with chance error 67.
31
Modelling the Mean of a Sample
As the Mean of the Sample is just the the Sum of the Sample divided by the number
of the draws, we get an equivalent result as follows.
For the Mean of random draws from a box model with replacement,
where:
32
Example: Coin tossing
Step 1: Draw the box model Step 2: Calculate the mean and SD of the box
Step 4: Conclusion
• We would expect a Sample Mean of
0.5 (EV) with SE 0.005.
33
Modelling the Sum/Mean of a Sample using the Normal
Distribution
• For large number of draws from the box, the Sum/Mean of the draws can be
modelled with a normal distribution with mean= EV and sd = SE, or N(EV, SE 2 )
• This is due to Central Limit Theorem, which we will formally define in the next part.
Model of Sample
EV= n mean
N(
34
Example (based on WWII)
A coin is tossed 100 times. What is the chance of getting between 40 and 60 heads?
Step 1: Draw the box model Step 2: Calculate the mean and SD of the box
'
35
Example cont.
Step 3: Calculate the EV and SE of the Sum of the Sample
• The EV of the Sum of the draws is 100 x 0.5 == 50.
• The SE of the Sum of the draws is Jioo x 0.5 == 5.
Step 4: Conclusion
• We would expect a Sample Sum of 50 {EV) with SE 5.
36
Example cont.
Step 5: Draw the Normal curve
Sample Sum ~ N(50, 52)
30 40 50 60 70
-4 -2 0 2 4
37
Using the Box Model for Binary Outcomes
• We can model binomial outcomes with Binomial Theorem (Topic 6)
• Or, we can approximate the answer using the Box Model
Example: Toss a die 100 times and count the number of 6s.
• The box would have a 1 (representing "6") and 5 x O (representing non "6").
38
Binary Example: Keno Classic
In Keno Classic, there are 80 balls numbered 1 to 80. 20 balls are chosen at random
without replacement.
• You pick 1 single number from the 80, and win if your number is equal to one of
the 20 chosen numbers.
■ If you win, you get your dollar back plus $2.
39
Binary Example cont.
Preliminary set up (draw 20 numbers from 80, Step 1: Draw the box model (for game)
without replacement)
◄
I
I
I
I
I replace
n= 20 \ n= 100
\
\
\
'
40
Binary Example cont.
Step 2: Calculate the mean and SD of the box
4
• The mean of the box is 2 - 1 1- 1 == -0.25.
41
Binary Example cont.
Step 5: Draw the Normal curve using EV and SE.
3um
-80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30
score
-4 .23 -3.46 -2.69 -1.92 -1.15 -0.38 0.38 1.15 1.92 2.69 3.46 4.23
43
Binary Example cont.
Step 2: Calculate the mean and SD of the box
• The mean of the box is i+o+o!o+o+o == 1/6.
• The SD of the box is (1 - 0) ✓5/6 x 1/6 == 0.372678.
Step 3: Calculate the EV and SE of the Sum of the Sample
• The EV is 60 x 1/6 == 10.
• The SE is J 60 X 0.372678 ~ 2.89.
Step 4: Conclusion
Hence, in 60 plays we would expect to see 10 6's with a SE of around 3.
44
Binary Example: Star Casino
The Star Casino 00 roulette wheel has 38 pockets, numbered 0 (green), 00 (green)
and 1-36 {alternate red and black).
• If 10,000 different players play over a month, what is the house's expected gain?
45
Why is the Normal curve so common?
Access the CLT App here. This video demonstrates 30 draws each with a sample
size of 10.
48
Types of histograms
Data histogram
The data histogram represents the amount of data by area.
0.020
0.015
-
>,
·;:n
C
(1)
O 0.010
0.005
0.000
0 25 50 75 100
Age (years)
49
Probability histogram
The probability histogram represents chance by area.
50
Simulation histogram
The simulation histogram represents chance by area, for a simulation of a chance
process.
Example: Toss a pair of dice and calculate the sum.
Here we study the simulation histogram for the sum of 2 draws with different
number of replicates.
I I
2 3 4 5 6 7 8 9 10 11 12
Sum
51
Relationship between Probability and Simulation
Histograms
(]) Convergence of simulation histograms
52
A crazy resu It?
Simulation from different boxes
Consider 4 very different boxes:
Box 1 Box 2 Box 3 Box 4
0, 1 9x0, 1 1,2,3 1,2, 9
1. Sample 100 times from each box, and plot the results
Box 1 Box 2 Box 3 Box 4
- ,...._
~
75 30 - 30
>-
(_')
40
C
Q) 50
:, 20 20
O"
~ 20
IL
25 10 10
0 0 0 0
0.0 0.4 0.8 0.0 0.4 0.8 1.0 1.5 2.0 2.5 3.0 2.5 5.0 7.5 10.0
Distribution of draws
0.06
0.02
0.04
0.01
0.02
I
I
I
I I I II I I
I
0.00 0.00 ~ - - - - - ~ - - - ~ - - - ~ - - - ~
>,
:!:: 460 480 500 520 540 80 90 100 110 120
(/)
C
Q.)
Histogram of box 3 Histogram of box 4
0
0.015
0.004
0.010 0.003
0.002
0.005
0.001
I I
0.000 ~ - - - ~ - - - - ~ - - - - ~ - - - ~ 0.000 ~ - ~ - - ~ - - ~ - - - ~ - - ~ - - -
I I
1960 2000 2040 2080 3800 3900 4000 4100 4200
Distribution for the sum of 100 repeats
Q Notice the simulation histograms of the sums all seem to look "normal". Why?
54
The Central Limit Theorem
® The Central Limit Theorem (CLT)
When drawing at random with replacement from a box, if the sample size for the
sum (or average) is sufficiently large, then
• the probability histogram or distribution of chance for the sum (or average) will
closely fallow the normal curve
• even if the contents of the box does not
Method 1: Approximate the area from the data histogram (approximating the probability
histogram)
Histogram of 10,000 sums
15
en
en
.8 10
s....
Q)
a.
';ft. 5
0
2 3 4 5 6 7 8 9 10 11 12
Sum
57
Method 2: Model the sum of the sample using the box model
Histogram of sim4
~
"O
-
C
:::J n:J
Q.)
( /) ..c
I,...
I,...
Q.) Q.)
0 0
sums
2 3 4 5 6 7 8 9 10 11 12
Z score
-2.07 -1.65 -1 .23 -0.82 -0.4 0.02 0.43 0.85 1.26 1.68 2.1
58
CD The Continuity Correction (cc)
• To approximate a discrete distribution by the Normal distribution (continuous),
we need to adjust the endpoints by 0.5. This is called the continuity correction.
• To work out whether to add or minus 0.5, draw a sketch of the histogram.
using pnorm, P(5.5 < X < 8.5) == 0.47, which is closer to the result of Method 1.
59
Sample Size vs Replicates
It is important to distinguish between the effect of sample size n and replicates N.
Consider taking the mean of a sample from a skewed box. What is the effect of
increasing the sample size (going across the rows)? What is the effect of increasing
the number of replicates (going down the columns).
sample size n= 1 sample size n= 10 sample size n= 100 sample size n= 1000
11
5
Un [ Jh
4
al
"O
3 en
n □ DD
z
~ n
.!!.
d 111
0
Box 0
n~n ~
30
AIL
al
~
"O
en
>, 20 z
n
(.)
C .!!.
□D
0
10 0
o D
j
Al
300
~
al
DD~ ~
"O
en
200 z
1 2 3 4 5
.!!.
□ D
0
100 0
Ticket 0
_;ffii_ Al
3000 al
nn~ ~
"O
en
2000 z
.!!.
0
1000 0
0
nn 0
0
60
Extension
CD The Central Limit Theorem
Let Xi, X2, X3, ... Xn be iid (independent and identically distributed) random
variables with population mean µ and variance a 2 > 0 Then as n ---+ oo,
61