0% found this document useful (0 votes)
8 views57 pages

Box Model and Chance Variability Explained

This document discusses the concept of chance variability and the box model in the context of sampling data, emphasizing the Law of Averages and the Law of Large Numbers. It includes historical examples, particularly John Edmund Kerrich's coin-tossing experiments during WWII, to illustrate these principles. The document also covers how to model the sum and mean of samples using the box model and the normal distribution, along with practical applications in gambling and quizzes.

Uploaded by

sangamshakya300
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views57 pages

Box Model and Chance Variability Explained

This document discusses the concept of chance variability and the box model in the context of sampling data, emphasizing the Law of Averages and the Law of Large Numbers. It includes historical examples, particularly John Edmund Kerrich's coin-tossing experiments during WWII, to illustrate these principles. The document also covers how to model the sum and mean of samples using the box model and the normal distribution, along with practical applications in gambling and quizzes.

Uploaded by

sangamshakya300
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Topic 7: Chance Variability and The

Box Model
MODULE 3: SAMPLING DATA

Copyright: Di Warren; DATA 1001 /DATA 1901 curriculum team

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

Part 1: Law of Averages


~ - - - ..
-----:::-.:~
Q Read each of these statements: is it true or false?
• After a sequence of 4 heads in a row, the chance of getting a tail increases.
• In the long run, eventually the number of heads and tails evens out.
• In the long run, the size of the difference between the number of heads and the
expected number decreases.
• In the long run, the size of the difference between the percentage of heads and
50% decreases.

9
Chance Variability
® Chance Processes
Every time you perform a chance process, there is chance variability.

Observed Value== Expected Value+ Chance Error

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

CD Misunderstanding this, leads to the Gambler's Fallacy.

• As the number of tosses increases


■ the absolute size of the chance error increases D
■ the absolute percentage size of the chance error decreases 0
■ the proportion of the event will converge to the theoretical or expected
proportion.

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 When did it get close to 0.5?


13
Simulation of Kerrich's experiment
10,000 Coin tosses

Q)
(.)

....a3 80

~

Q) 40
>
:.:;
~
:::l
~ o-1- -
0 r~~rw n

0 2500 5000 7500 10000


Index of Tosses

,..-., 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
\
\
'

Consider the Sum of the sample:

• 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?

population = "box" = ...


Box Model of 1 toss of dice
2 5
Note the composition of the box:

I

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?

population = "box" = ...


Box Model of 1 play of the game
Note the composition of the box:
I •
I • The distinct tickets are $1 and -$1,
I
I representing the "win" and "loss".
I replace
\ n = 25
\ • There is 1 ticket with $1 (equivalent to
\
\ tossing a "6"), and 5 tickets with -$1
' (equivalent to tossing 1-5).

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).

• Suppose you place a bet on red. This costs $1.


• The croupier spins the wheel until a ball lands in a pocket.
■ If it lands on a red, you get your $1 back plus an extra $1.

■ If it doesn't land on red, you lose your $1.

• You play 10 times. What is your expected net gain/loss?

21
population = "box" = ...

18 Tickets x $1 20 tickets x -$1

;--
/
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.

■ If you lose, you lose $1.

• You play 100 times. What is your expected net gain/loss?

population = "box" = ...

1 Ticket x $35 37 tickets x -$1

~
• 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
\

'' 37 tickets with -$1 (equivalent to


landing on the other numbers).

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?

population = "box" = ...

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
\

Q Consider the following


How many heads do we expect? How many heads did they observe? How big was
the chance error?

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

observed value== expected value+ chance error

where:

expected value (EV)== number of draws x mean of the box

standard error (SE) == Jnumber of draws x SD of the box

Q How does chance error relate to standard error?


An OV is likely to be around its EV, with a chance error similar to the SE. OV's are
rarely more than 2 or 3 SE's away from the expected value.

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.

CD 3 ways to calculate the SD of the box


1. Formula: RMS(gaps) = Root of the Mean of the Squared gaps.
2. R: popsd() with package rafal ib
3. Short cut (for simple binary boxes)
• If a box only contains 2 different numbers ("big" and "small"), then

SD == (big - small) ✓ proportion of big x proportion of small

29
Example: Coin tossing
Step 1: Draw the box model Step 2: Calculate the mean and SD of the box

population = "box" = ... • The mean of the box is 0 1 == ! 0.5


• The SD of the box is
1 (Head} 0 (Tail}

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.

(]) Mean of draws from a box model

For the Mean of random draws from a box model with replacement,

observed value== expected value+ chance error

where:

expected value (EV) == mean of the box


SD of the box
standard error (SE) == - - - - - - -
✓ number of draws

32
Example: Coin tossing
Step 1: Draw the box model Step 2: Calculate the mean and SD of the box

population = "box" = ... !


• The mean of the box is 0 1 == 0.5
• The SD of the box is 0.5
1 (Head} 0 (Tail}
Step 3: Calculate the EV and SE of the Mean
of the Sample
i'
I
I • The EV of the Mean of the draws is 0.5
I
I replace • The SE of the Mean of the draws is
\ n= 10,000
\ 0.5
\ - - - == 0.005
'' ✓ 10000

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

Sample Sum / 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

population = "box" = ... !


• The mean of the box is 0 1 == 0.5
• The SD of the box is
1 (Head) 0 (Tail)
1 1
I
.. (1 - 0) - X - == 0.5
I 2 2
I
I
I replace
\ n= 100
\
\
\

'

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.

CD So now model the Sample Sum by a Normal, with

Sample Sum rv N(50, 52)

36
Example cont.
Step 5: Draw the Normal curve
Sample Sum ~ N(50, 52)

P(40< Sample Sum < 60)

30 40 50 60 70

-4 -2 0 2 4

Step 6: Calculate the chance

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").

CD Box model for classifying {binary box)


If you want to classify and count the draws from a box model:

• mark 1 on the tickets you are counting;


• mark O on the others.

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.

■ If you lose, the house keeps your dollar.


• If you play 100 times, how much would you expect to win/lose?
• What is the chance you will have a net loss? (Assume a Normal curve).

39
Binary Example cont.
Preliminary set up (draw 20 numbers from 80, Step 1: Draw the box model (for game)
without replacement)

population = "box" = . . . population = "box" = . . .

1 2 3 4 ... 80 1 ticket x $2 3 tickets x -$1


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.

• The SD of the box is (2 - (-1)) ✓ ~ x ! = 1.299038.


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.25 == -25.
• The SE of the sum of draws is Jioo x 1.299038 == 12.99.
Step 4: Conclusion
• In 100 plays of Classic Keno we expect to lose $25 {EV) with a SE of $13.
• Hence, it would be very common to lose between $12 and $38.

41
Binary Example cont.
Step 5: Draw the Normal curve using EV and SE.

Sample Sum rv N(-25, 12.992 )

P(sum of the draws < 0)

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

Step 6: Work out the chance


• The Normal curve has EV -25 and SE 12.99
• The x value is 0
. 0-(-25)
• The z score Is 12 _99 == 1. 92
• So we expect a net loss approximately pnorm (1. 92) ~ 97% of the time.
42
Binary Example: Die rolls
A die is rolled 60 times. How many 6's do we expect?

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).

• Suppose players only stake $1 on red at each play.


■ If they win, they get $1, plus the $1 back.

■ If they lose, they lose the $1.

• 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.

Histogram for Age of Road Fatalities in Australia: Jan-June 2024

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.

Example: Toss a pair of dice and calculate the sum.


Sum 2 3 4 5 6 7 8 9 10 11 12
Chance 1 2 3 4 5 6 5 4 3 2 1
36 36 36 36 36 36 36 36 36 36 36

Probability histogram of sums


0.15 CD For a probability histogram,
(]) on the horizontal axis,
g 0.10
ro
..c
O o.05
• the EV measures the centre .
• the SE measures the spread.
2 3 4 5 6 7 8 9 10 11 12
Sum

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.

10,000 replicates {Sim 4)


0.15
~
..-
·en 0.10
C
<I.)
0 0.05

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

For repeated simulations of a chance process resulting in a sum, the simulation


histogram of the observed values converges to the probability histogram.

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

Notice the difference between the composition of the boxes.


53
2. Sum up 1000 draws from each box, repeat 100 times, and plot the results
Histogram of box 1 Histogram of box 2

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

Conditions for the CLT


• Sample size. How large? ~ This depends on the shape of the original box.
• More draws are required the greater the shape differs from the normal curve.
• A common convention is the number of draws > 30 (assuming a basically
symmetric distribution with no obvious outliers).
55
Q Toss a pair of dice 10000 times and calculate the sum {Based on Sim 4)
What is the probability of getting a sum between 6 and 8?

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

P(Sum == 6, 7, 8) == 0.1387 + 0.1685 + 0.1478 == 45.5%


56
Method 2: Model the sum of the sample using the box model

• The box represents a dice {1,2,3,4,5,6).


• The mean of the box is 3.5 and the SD of the box=

(1 - 3.5) 2 + ... + (6.3.5) 2


RMS== - - - - - - - - == 1.708
6

• For the sum of 2 tosses of the dice:


■ EV == 2 x 3.5 == 7
■ SE== y'2 x 1.708 == 2.415
• Hence, the number of standard units (red) from 7 to 8 is 2~4175 == 0.414.

57
Method 2: Model the sum of the sample using the box model

Sample Sum rv N(7, 2.415 2 )

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

using pnorm, P(6 < X < 8) == 0.32

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

1 2 3 4 5 2 3 4 5 3.0 3.3 3.6 3.9 3.5 3.6 3.7 3.8

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,

Proof of the CLT

61

You might also like