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 probabilitiesFRACTION (simplify) DECIMAL PERCENTAGE
4/100.6
10%1/5
0.75
FRACTION DECIMAL PERCENTAGE4/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 simulationTTRC
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 describing1. 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
1. Design a simulation to find the number of weeks Patrick
will go to McDonalds2. 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?
TOY 1 2 3
Prob 0.3 0.2 0.5
TTRCTool: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 14, 5 will represent toy 26, 7, 8, 9, 10 will represent toy 3Trial: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.
TTRCResults:Complete tableThe average number of visits to McDonalds is the mean number of weeksCalculation:Answer question…
Ran # Toy 1 Toy 2 Toy 3 Weeks Y/N
Trial 1,2,3 4,5 6,7,8,9,10
1
2
3
4
5
6
7
8
9
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.
ExercisesWhen 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.
• 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
Camel Horse Frog
0.1 0.5 0.4
When you play angry birds your chances of getting to the next level are:Getting there on first shot: 0.8Getting there on second shot: 0.4Getting there on third shot is 0.3Getting 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.
1. Design and describe a simulation2. 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
Robbing a house Prob. of getting caughtProb. of being successful 0.4 0.5Prob. of unsuccessful 0.6 0.5