Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 42

Simulations

PROBABILITY RECAP
What is a probability?
• The probability of an event refers to the
likelihood that the event will occur.

• EXAMPLE. The probability of winning your


sports game this weekend is 0.7
• What does that mean
Remember

EXAMPLE: Sports game this weekend > Probability = 0.7

The last 10 times you have played this team you have won
7 of the games

 70%  0.7
Convert these probabilities
FRACTION (simplify) DECIMAL PERCENTAGE

4/10
0.6
10%
1/5
0.75
FRACTION DECIMAL PERCENTAGE
4/10 0.4 40%
3/5 0.6 60%
1/10 0.1 10%

1/5 0.2 20%


3/4 0.75 75%
What are the probabilities of these
events?
• Getting a head when you flip a coin?
• Waking up on a day of the week that begins with T
• Waking up on a weekday
• Waking up on a day where you need to go to school
• Rolling an even number on a dice
• Rolling an odd number on a dice
What is a simulation
• Simulation is a way to model random events,
such that simulated outcomes closely match
real-world outcomes.
• By observing simulated outcomes, researchers
gain insight on the real world.
Why use simulation?
• Some situations do not lend themselves to
precise mathematical treatment.
• Others may be difficult, time-consuming, or
expensive to analyse.
• In these situations, simulation may
approximate real-world results; yet, require
less time, effort, and/or money than other
approaches.
Remember
• A simulation is useful only if it closely mirrors
real-world outcomes.
Example

On average, Freddy sinks a 3 pointer


in basketball once in every 10 shots,
and suppose he gets exactly two
opportunities to shoot in every
game. Using simulation, estimate
the likelihood that she will land two
three pointer in a single game.
Simulations
This is an experiment in which the conditions of
a real life situation is reproduced

We need to use a random number generator


(calculator, dice, cards etc) in order to carry out
the experiment.
Notes: How to design a simulation
TTRC
TOOL:
How will you generate random numbers? What does the digit
represents? Decimal points?
TRIALS:
Trial consist of? A successful trial? How many trials? (should always
do at least 30)
RESULTS:
TABLE
CALCULATION:
Calculate probability or the mean to answer the question
How to use the “tool”
How can we use a pack of cards to represent a die?

Sally goes to the bathroom 4 times during a 6 hour


work period

KFC gives out 7 toy figurines

10% of all batteries are faulty


Describe the best tool to represent…
1. 75% of students pass Maths
2. 10% of buses are late
3. 1 out of 10 people have hazel eyes, 3 have blue
and the rest are brown
4. Half of students parents are still married
5. 1 out of 6 sheep give birth to triplets, 2 give
birth to twins and the rest have singles.
6. Flipping two coins
Example to describing
1. Mr Peppers Dog “fluffy” will go toilet inside 2%
of the time a day. Find how many times Fluffy will
go toilet inside in a week?
Describe how you would model these
situations
1. A battery factory distributes batteries in packs
of 5. 5% of batteries are faulty. How many do
you expect to be faulty in each pack?
2. The school bus is late 20% of the time. How
many times will it be late in a 5 day week?
3. Coca-Cola has a cash reward going. You must
collect all the letters (C.A.S.H) that appear
under the cap to win. Each letter is equally
likely. How many Coca-Cola’s will you have to
buy to win
Notes: Example:
Patrick is collecting a set of 3 different plastic toys from
McDonalds, which are available for 6 weeks. Patrick only visits
McDonalds once a week and will always receive a toy. The toys
are distributed randomly and have the following probabilities
TOY 1 2 3
Prob 0.3 0.2 0.5

1. Design a simulation to find the number of weeks Patrick will


go to McDonalds
2. Carry out the simulation 30 times.
3. What is the probability that Patrick will collect all toys within
the 6 weeks?
4. Are there any assumptions you need to make?
TTRC
Tool:
I will generate random numbers between 1 and 10 on my calculator
(10RAN# +1), and I will ignore all decimals. The numbers will
represent the following:
1,2,3 will represent toy 1
4, 5 will represent toy 2
6, 7, 8, 9, 10 will represent toy 3
Trial:
I will generate 6 random numbers from 1 to 10 to represent the 6
weeks McDonalds will have the toys available. The trial will finish
after 6 weeks or when all 3 toys have been collected. A successful
trial will be when all 3 toys are obtained. I will complete 30 trials.
TTRC
Ran # Toy 1 Toy 2 Toy 3 Weeks Y/N
Results: Trial 1,2,3 4,5 6,7,8,9,10
Complete table 1

The average number 2


3
of visits to 4
McDonalds is the 5
mean number of 6
weeks 7
8
Calculation:
9
Answer question… 10
11
12
13
14
15
Assumptions in TTRC??
• The Toys are randomly distributed (customer
does not get to choose)
• All Toys are available at any one time
• The probability of getting one toy does not
effect the chance of getting another toy, i.e.
they are independent
• Patrick goes to McDonalds once a week only
• Patrick will get a toy every week
Standard assumptions (notes)
• Probability remains the same at all times
• Random distribution
• Availability
• Time frame
Conclusion
You need to answer the question!!
What is the number of visits require to collect all
toys?? 4.7 visits
What is the probability that he will collect all 3
toys?? 67%

WRITE IN CONTEXT AND SENSIBLE ROUNDING


Sampling Variability
• Your simulation only produces an estimate of
what is actually happening so..

If you did a another simulation you are likely to


get a different estimate
Improvements
• A better estimate would be to repeat the
simulation several times and calculate the
mean of all the estimates.

• Increasing the number of trials – would give a


better estimate of the mean number as any
variations in results will have less impact on
the overall estimate.
Potential Issues of Accuracy
This depends on the distributing process. As if it
is not randomly distributed then there will be
bias.

In terms of McDonalds – it would depend on


how the workers at McDonalds distributed the
toys.
Example:
Things to think about..
• Colours/size/packaging?
• Favouritism?
• Unethical behaviour?
• Advertising?
• Other people decisions influence
• Anything else????

How would these effect our simulation?? The


probabilities may change, or ….
State some assumptions, improvements and
potential issues

• Every time you go to the movies you collect a


sticker. You need 4 stickers to get a free movie
pass which lasts for 12 weeks. Assuming that
Dan goes to the movies once a week, calculate
the average amount of weeks Dan will go to
the movies, and the probability he will get a
free movie pass.
Exercises
When Dingle Mouse is running his tail catches on
fire 60% of the time. His ears catch on fire 20% of
the time, and his whiskers 10% of the time. He
never gets more than one thing on fire – that would
be dangerous.
Design a Simulation for Dingle Mouse and carry it
out 30 times.
1. Use the results to estimate the
probability that Dingle Mouse
not catch fire?
Bad Jelly speeds on her broomstick 80% of the time to
get to work. Mud Wiggle the worm sees 60% of the
speeding offences and he writes a formal complaint
letter. Bad Jelly knows that if Mud Wiggle has to write
more than 2 letters she has successfully annoyed her.
• Design and simulate this situation to find out how
many times Bad Jelly needs to ride her broomstick to
annoy Mud Wiggle.
• Use your results to write a recommendation
• What are the assumptions and limitations
• What is the prob. that Bad Jelly only has to ride twice
to annoy Mud Wiggle
Bad Jelly has 3 different animals that she can ride to work on
a five-day week. Bad Jelly is happy when she gets to ride her
Frog at least once a week.
Camel Horse Frog
0.1 0.5 0.4

• Design and describe a simulation


• On average how many times will she get to ride her frog to
work a week?
• Are there any assumptions or limitations?
• Find the prob. that bad jelly will be happy
• Use theoretical prob. to show how well your simulation
works
When you play angry birds
your chances of getting to
the next level are:
Getting there on first shot:
0.8
Getting there on second
shot: 0.4
Getting there on third shot
is 0.3
Getting there on fourth
shot is 0.2
Robert has just lost his job and is worried about having enough money
to feed his family. He considers the following option – stealing. If he
gets caught he loses what he stole. Robert thinks this solution will work
if he doesn’t get caught four times.
Robbing a house Prob. of getting caught
Prob. of being successful 0.4 0.5
Prob. of unsuccessful 0.6 0.5

1. Design and describe a simulation


2. Using your results write a recommendation about how many times
Robert will have to rob a house to feed his family and whether this
will work as a solution.
3. What are the assumptions of this simulations, how can you improve
this?
4. What is the probability that Robert will only need to steal four times.
5. Use theoretical probability to show how well your simulation worked
Problem

As a part of Christmas advertising a petrol station gives


away one of 6 Lego toys to each customer who
purchases $20 or more of fuel.

Calculate how many visits to the petrol station a


customer would need to make on average to collect all
6 Lego toys.

Assumption: The likelihood of one Lego toy being


handed out is independent of another.
Solution (suggestion)
Tool: Generate random numbers between 1 & 6 (inclusive), each number
stands for each toy.
Trial: One trial will consist of generating random numbers till all
numbers from 1 to 6 have been generated.
Count the number of random numbers need to get one full set
Results:
Trial Toy1 Toy2 Toy3 Toy4 Toy5 Toy6 Tally Total Visits
1 Y Y Y Y Y Y 10
2 Y Y Y Y Y Y 19

Number of Trials needed: 30 would be sufficient


Calculation:
Average number of visits = Total visits
Number of trials
Problem:
Mary has not studied for her Biology test.
She does not know any of the answers on a
three-question true-false test, and she
decides to guess on all three questions
Design a simulation to estimate the
probability that Mary will ‘Pass’ the test.
(i.e. guess correct answers to at least 2 of
the 3 questions)
Calculate the theoretical probability that
Mary will pass the test.
Solution (suggestion)
Tool: The probability that Mary guesses a question true is one
half.
First digit using calculator 1 + 10Ran#
1to 5 stands for ‘correct answer’
6 to 10 stands for ‘incorrect answer’
Trial: One trial will consist of generating 3 random numbers to
simulate Mary answering one complete test.
A successful outcome will be getting at least 2 of the 3
random numbers
Trial
between 1 and
Outcome of Trial
5.
Result of Trial
Results: 1 122 Successful trial
2 167 Unsuccessful trial

Number of Trials needed: 30 would be sufficient


Calculation: Estimate of probability of ‘passing’
Number the’ results
of ‘ successful exam =
Number of trials
Problem:
Mary has not studied for her history test. She does
not know any of the answers on an eight-question
true-false test, and she decides to guess on all
eight questions
Design a simulation to estimate the probability
that Mary will ‘Pass’ the test. (i.e. guess correct
answers to at least 4 of the eight questions)
Solution (suggestion)
Tool: The probability that Mary guesses a question true is one half.
First digit using calculator 1 + 10Ran#
1to 5 stands for ‘correct answer’
6 to 10 stands for ‘incorrect answer’
Trial: One trial will consist of generating 8 random numbers to simulate Mary
answering one complete test.
A successful outcome will be getting at least 4 of the 8 random
numbers between 1 and 5.
Results: Trial Outcome of Trial Result of Trial
1 12236754 Successful trial
2 13672987 Unsuccessful trial

Number of Trials needed: 30 would be sufficient


Calculation:
Number of ‘ successful ’ results
Estimate of probability of ‘passing’ the exam =
Number of trials
Problem:
Lotto 40 balls and to win you must select 6 in
any order. In this mini Lotto, there are only 6
balls and you win when you select 2 numbers
out of the 6.
Design and run your own simulation to
estimate the probability of winning (i.e.
selecting 2 numbers out of the 6)
Calculate the theoretical probability of winning.
Solution (suggestion)
Tool: Two numbers (between 1 and 6) will need to be selected first (say 2 & 4)
First digit using calculator 1 + 6Ran#, ignore the decimals.
Trial: One trial will consist of generating 2 random numbers
Discard any repeat numbers
A successful outcome will be getting 2 of the 6 random numbers generated
Results: Trial Outcome of Trial Result of Trial
1 24 Successful trial
2 13 Unsuccessful trial

Number of Trials needed: 50 would be sufficient


Calculation:
Estimate of probability of ‘winning’ = Number of ‘successful’ outcome
Number of trials
Theoretical probability in this case is 1/15

You might also like