260 likes | 278 Views
Chapter 11 Randomness. Randomness. Random outcomes Tossing coins Rolling dice Spinning spinners They must be fair. Randomness. Random outcomes Tossing coins Rolling dice Spinning spinners They must be fair Nobody can guess the outcome before it happens. Randomness. Random outcomes
E N D
Randomness • Random outcomes • Tossing coins • Rolling dice • Spinning spinners • They must be fair
Randomness • Random outcomes • Tossing coins • Rolling dice • Spinning spinners • They must be fair • Nobody can guess the outcome before it happens
Randomness • Random outcomes • Tossing coins • Rolling dice • Spinning spinners • They must be fair • Nobody can guess the outcome before it happens • Usually some underlying set of outcomes will be equally likely
Result It is not easy to be random!
It’s Not Easy Being Random • Computers have become a popular way to generate random numbers. • Even though they often do much better than humans, computers can’t generate truly random numbers either. • Since computers follow programs, the “random” numbers we get from computers are really pseudorandom. • Fortunately, pseudorandom values are good enough for most purposes.
Example • A cereal manufacturer puts pictures of famous athletes on cards in boxes of cereal in the hope of boosting sales • 20% of the boxes contain a picture of Tiger woods • 30% for Lance Armstrong • 50% for Serena Williams • Get a lottery ticket when all three pictures are collected
How many boxes do we need to buy? • If you are lucky, • If you are very unlucky,
How many boxes do we need to buy? • If you are lucky, three boxes • If you are very unlucky, infinitely many
How many boxes do we need to buy? • If you are lucky, three boxes • If you are very unlucky, infinitely many • But on average, how many? • Go ahead and buy, then count (too costly) • A cheaper solution • Use a random model • Assume that pictures are randomly placed in the boxes • Assume that the boxes are randomly distributed to stores
Practical Randomness • We need an imitation of a real process so we can manipulate and control it. • In short, we are going to simulate reality.
Then what? • Use the model to generate random values • Simulate the outcomes to see what happens • We call each time we obtain a simulated answer to our question a trial • How do we generate the outcomes at random?
Random numbers • How to generate random numbers? • Computer software • Pseudorandom numbers • Computers follow programs! • The sequence of pseudorandom numbers eventually repeat itself • But virtually indistinguishable from truly random numbers • Books of random numbers • Not an interesting book, perhaps
How do we get random integers in TI-83? • MATH PRB • 5:randInt( • randInt(left,right, #) • This allows repetition of the same integer • randInt (0,9,100) produces 100 random digits • randInt (0,57,3) produces three random integers between 0 and 57 • Remark: The textbook’s comments are wrong. Using this function, you can possibly get (14, 41, 14), which is not suitable for the dorm room example.
Back to cereal boxes • How to model the outcome? • 20%, Woods (0,1) • 30% Armstrong (2,3,4) • 50% Williams (5,6,7,8,9) • 0 to 9 are equally likely to occur • How to simulate the trial? • Open cereal boxes till we have one of each picture • Opening one box is the basic building block, called a component of our simulation. • For example, ‘29240’ corresponds to the following outcomes:
Back to cereal boxes • How to model the outcome? • 20%, Woods (0,1) • 30% Armstrong (2,3,4) • 50% Williams (5,6,7,8,9) • 0 to 9 are equally likely to occur • How to simulate the trial? • Open cereal boxes till we have one of each picture • Opening one box is the basic building block, called a component of our simulation. • For example, ‘29240’ corresponds to the following outcomes: Armstrong, Williams, Armstrong, Armstrong, Woods
Cereal (continue) • Response variable • What we are interested in • How many boxes it takes to get all three pictures • Length of the trial • ‘29240’ corresponds to 5 boxes • Run more trials • 89064: 5 boxes • 2730: 4 boxes • 8645681: 7 boxes • 41219: 5 boxes • 822665388587328580: 18 boxes • How many boxes do we expect to buy? • Take an average • Based on the first 5 trials: the average is 7.8 boxes • To get an objective estimate: run infinitely many trials
Cautions • Simulation is different from the reality because • Model may not be 100% precise • Only limited number of trials • Run enough trials before you draw conclusions
Simulation Steps • Identify the component to be repeated. • Explain how you will model the component’s outcome. • State clearly what the response variable is. • Explain how you will combine the components into a trial to model the response variable. • Run many trials. • Collect and summarize the results of all the trials. • State your conclusion.
Lottery for a dorm room • 57 students participated in a lottery for a particularly desirable dorm room • A triple with a fireplace and private bath in the tower • 20 participants were members of the same varsity team • When all three winners were members of the team, the other students cried foul
Is it really a foul? • Whether an all-team outcome could reasonably be expected to happen if every one is equally likely to be selected? • Simulation • Component: selection of a student • 00-56: one number for one student • 00-19: 20 varsity applicants • 20-56: the other 37 applicants • Trial: randomly select three numbers from 00-56 • Note we can’t put the same person in the room twice • If selecting the second person, the first selected person should be excluded from the lottery • Response variable: ‘all varsity’ or not • Draw conclusions by counting how often ‘all varsity’ occurs • The textbook gives 10% (only 10 trials) • If doing infinitely many trials, it should be 3.896104%
What Can Go Wrong? • Don’t overstate your case. • Beware of confusing what really happens with what a simulation suggests might happen. • Model outcome chances accurately. • A common mistake in constructing a simulation is to adopt a strategy that may appear to produce the right kind of results. • Run enough trials. • Simulation is cheap and fairly easy to do.