128 65 2MB
English Pages 322 Year 2019
Solutions to Probability and Bayesian Modeling Jim Albert and Monika Hu February 2020
Contents Chapter 1 - Probability: A Measure of Uncertainty
1
Chapter 2 - Counting Methods
12
Chapter 3 - Conditional Probability
20
Chapter 4 - Discrete Distributions
35
Chapter 5 - Continuous Distributions
60
Chapter 6 - Joint Probability Distributions
80
Chapter 7: Learning About a Binomial Probability
96
Chapter 8: Modeling Measurement and Count Data
136
Chapter 9: Simulation by Markov Chain Monte Carlo
158
Chapter 10: Bayesian Hierarchical Modeling
184
Chapter 11: Simple Linear Regression
235
Chapter 12 Bayesian Multiple Regression and Logistic Models
267
Chapter 13 Case Studies
298
Chapter 1 - Probability: A Measure of Uncertainty Exercise 1. Probability Viewpoints In the following problems, indicate if the given probability is found using the classical viewpoint, the frequency viewpoint, or the subjective viewpoint. a. Joe is doing well in school this semester { he is 90 percent sure that he will receive an A in all of his classes. subjective b. Two hundred raffle tickets are sold and one ticket is a winner. Someone purchased one ticket and the probability that her ticket is the winner is 1/200. classical
1
c. Suppose that 30% of all college women are playing an intercollegiate sport. If we contact one college woman at random, the chance that she plays a sport is 0.3. frequency d. Two Polish statisticians in 2002 were questioning if the newBelgium Euro coin was indeed fair. They had their students flip the Belgium Euro 250 times, and 140 came up heads. frequency e. Many people are afraid of flying. But over the decade 1987-96, the death risk per flight on a US domestic jet has been 1 in 7 million. frequency f. In a roulette wheel, there are 38 slots numbered 0, 00, 1, . . . , 36. There are 18 ways of spinning an odd number, so the probability of spinning an odd is 18/38. classical
Exercise 2. Probability Viewpoints In the following problems, indicate if the given probability is found using the classical viewpoint, the frequency viewpoint, or the subjective viewpoint. a. The probability that the spinner lands in the region A is 1/4. classical b. The meteorologist states that the probability of rain tomorrow is 0.5. You think it is more likely to rain and you think the chance of rain is 3/4. subjective c. A football fan is 100% certain that his high school football team will win their game on Friday. subjective d. Jennifer attends a party, where a prize is given to the person holding a raffle ticket with a specific number. If there are eight people at the party, the chance that Jennifer wins the prize is 1/8. classical e. What is the chance that you will pass an English class? You learn that the professor passes 70% of the students and you think you are typical in ability among those attending the class. frequency f. If you toss a plastic cup in the air, what is the probability that it lands with the open side up? You toss the cup 50 times and it lands open side up 32 times, so you approximate the probability by 32/50 frequency
Exercise 3. Equally Likely Outcomes For the following experiments, a list of possible outcomes is given. Decide if one can assume that the outcomes are equally likely. If the equally likely assumption is not appropriate, explain which outcomes are more likely than others. a. A bowl contains six marbles of which two are red, three are white, and one is black. One marble is selected at random from the bowl and the color is observed.
2
Outcomes: {red, white, black} not equally likely – white are more likely to be chosen b. You observe the gender of a baby born today at your local hospital. Outcomes: {male, female} equally likely c. Your school’s football team is playing the top rated school in the country. Outcomes: {your team wins, your team loses} not equally likely – your team is more likely to lose d. A bag contains 50 slips of paper, 10 that are labeled “1”, 10 labeled “2”, 10 labeled “3”, 10 labeled “4”, and 10 labeled “5”. You choose a slip at random from the bag and notice the number on the slip. Outcomes: {1, 2, 3, 4, 5} equally likely
Exercise 4. Equally Likely Outcomes For the following experiments, a list of possible outcomes is given. Decide if one can assume that the outcomes are equally likely. If the equally likely assumption is not appropriate, explain which outcomes are more likely than others. a. You wait at a bus stop for a bus. From experience, you know that you wait, on average, 8 minutes for this bus to arrive. Outcomes: {wait less than 10 minutes, wait more than 10 minutes} not equally likely – more likely to wait less than 10 minutes b. You roll two dice and observe the sum of the numbers. Outcomes: {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} not equally likely – some sums (7) are more likely to come up c. You get a grade for an English course in college. Outcomes: {A, B, C, D, F} not equally likely — relatively unlikely for D or F d. You interview a person at random at your college and ask for his or her age. Outcomes: {17 to 20 years, 21 to 25 years, over 25 years} not equally likely – students are relatively unlikely to be over 25 years
Exercise 5. Flipping a Coin Suppose you flip a fair coin until you observe heads. You repeat this experiment many times, keeping track of the number of flips it takes to observe heads. Here are the numbers of flips for 30 experiments. 131211261211113211215217333123 a. Approximate the probability that it takes you exactly two flips to observe heads. P(2 flips) = 7/30
3
b. Approximate the probability that it takes more than two flips to observe heads. P(more than 2 flips) = 9/30 c. What is the most likely number of flips? most likely number of flips is 1
Exercise 6. Driving to Work You drive to work 20 days, keeping track of the commuting time (in minutes) for each trip. Here are the twenty measurements. 25.4, 27.8, 26.8, 24.1, 24.5, 23.0, 27.5, 24.3, 28.4, 29.0 29.4, 24.9, 26.3, 23.5, 28.3, 27.8, 29.4, 25.7, 24.3, 24.2 a. Approximate the probability that it takes you under 25 minutes to drive to work. 8 days you took less than 25 minutes, so probability would be approximately 8/20 b. Approximate the probability it takes between 25 and 28 minutes to drive to work. 7/20 c. Suppose one day it takes you 23 minutes to get to work. Would you consider this unusual? Why? I would consider 23 minutes unusual since probability of 23 minutes or smaller is 1/20.
Exercise 9. Frequency of Vowels in Huckleberry Finn Suppose you choose a page at random from the book Huckleberry Finn by Mark Twain and find the first vowel on the page. a. If you believe it is equally likely to find any one of the five possible vowels, fill in the probabilities of the vowels below. Vowel
a
e
i
o
u
Probability
1/5
1/5
1/5
1/5
1/5
b. Based on your knowledge about the relative use of the different vowels, assign probabilities to the vowels. Vowel
a
e
i
o
u
Probability
(You should give certain vowels like e high probabilities.) c. Do you think it is appropriate to apply the classical viewpoint to probability in this example? (Compare your answers to parts a and b. No, it would not be appropriate to apply theclassical viewpoint of probability here. d. On each of the first fifty pages of Huckleberry Finn, your author found the first five vowels. Here is a table of frequencies of the five vowels: Vowel
a
e
i
o
u
Frequency
61
63
34
70
22
4
Use this data to find approximate probabilities for the vowels. Vowel
a
e
i
o
u
Frequency
61/250
63/250
34/250
70/250
22/250
Exercise 10. Purchasing Boxes of Cereal Suppose a cereal box contains one of four different posters denoted A, B, C, and D. You purchase four boxes of cereal and you count the number of posters (among A, B, C, D) that you do not have. The possible number of “missing posters” is 0, 1, 2, and 3. a. Assign probabilities if you believe the outcomes are equally likely. Number of missing posters
0
1
2
3
Probability
1/4
1/4
1/4
1/4
b. Assign probabilities if you believe that the outcomes 0 and 1 are most likely to happen. Number of missing posters
0
1
2
3
Probability
(Assign the values 0 and 1 high probabilities.) c. Suppose you purchase many groups of four cereals, and for each purchase, you record the number of missing posters. The number of missing posters for 20 purchases is displayed below. For example, in the first purchase, you had 1 missing poster, in the second purchase, you also had 1 missing poster, and so on. 1, 1, 1, 2, 1, 1, 0, 0, 2, 1, 2, 1, 3, 1, 2, 1, 0, 1, 1, 1 Using these data, assign probabilities. Number of missing posters
0
1
2
3
Probability
3/20
12/20
4/20
1/20
d. Based on your work in part c, is it reasonable to assume that the four outcomes are equally likely? Why?
Exercise 11. Writing Sample Spaces For the following random experiments, give an appropriate sample space for the random experiment. You can use any method (a list, a tree diagram, a two-way table) to represent the possible outcomes. a. You simultaneously toss a coin and roll a die. one sample space would be H1, H2, H3, H4, H5, H6, T1, T2, T3, T4, T5, T6 b. Construct a word from the five letters a, a, e, e, s. words are arrangements of letters like aaees, aeaes, aeeas, aeesa, . . .
5
c. Suppose a person lives at point 0 and each second she randomly takes a step to the right or a step to the left. You observe the person’s location after four steps. location after 4 steps could be {-4, -2, 0, 2, 4} d. In the first round of next year’s baseball playoff, the two teams say the Phillies and the Diamondbacks play in a best-of-five series where the first team to win three games wins the playoff. If P denotes event that Phillies win a game and D denotes event that Diamondbacks win, then possible outcomes are PPP, DDD, DPPP, DDPPP, etc. e. A couple decides to have children until a boy is born. You could record the total number of children – outcomes are 1, 2, 3, . . . f. A roulette game is played with a wheel with 38 slots numbered 0, 00, 1, . . . , 36. Suppose you place a $10 bet that an even number (not 0) will come up in the wheel. The wheel is spun. Outcome could be the result of your bet: you win or you lose. g. Suppose three batters, Marlon, Jimmy, and Bobby, come to bat during one inning of a baseball game. Each batter can either get a hit, walk, or get out. One outcome would be HWH (Marlon gets a hit, Jimmy walks, Bobby gets a hit) or WHH (Marlon gets a walk, Jimmy walks, Bobby gets a hit), etc. Other outcomes are HHH, WWW, OWH, etc.
Exercise 12. Writing Sample Spaces For the following random experiments, give an appropriate sample space for the random experiment. You can use any method (a list, a tree diagram, a two-way table) to represent the possible outcomes. a. You toss three coins. one possible sample space is HHH, HHT, HTH, etc where you are recording the result of each flip b. You spin the spinner (shown below) three times. if you record location of each spin, outcomes are AAA, AAB, ABC, . . . c. When you are buying a car, you have a choice of three colors, two different engine sizes, and whether or not to have a CD player. You make each choice completely at random and go to the dealership to pick up your new car. one outcome would be first color, engine size 1, and no cd player. There are 2 x 2 x 2 = 8 possible outcomes d. Five horses, Lucky, Best Girl, Stripes, Solid, and Jokester compete in a race. You record the horses that win, place, and show (finish first, second, and third) in the race. one outcome would be the horses finishing in order Lucky, Best Girl, Stripes (Lucky is first). There are 5 x 4 x 3 = 60 possible outcomes. e. You and a friend each think of a whole number between 0 and 9. one outcome would be person 1 chooses 2 and person 2 chooses 3 or (23). There are 100 possible outcomes. f. On your computer, you have a playlist of 4 songs denoted by a, b, c, d. You play them in a random order. outcome would be arrangement of songs like abcd or acbd, etc. There are 24 possible outcomes. g. Suppose a basketball player takes a “one-and-one” foul shot. (This means that he attempts one shot and if the first shot is successful, he gets to attempt a second shot.) could record the number of shots made: outcomes would be 0, 1, 2
6
Exercise 13. Writing Sample Spaces For the following random experiments, give an appropriate sample space for the random experiment. You can use any method (a list, a tree diagram, a two-way table) to represent the possible outcomes. a. Your school plays four football games in a month. your team can win (W) or lose (L) each game. Outcome could be number of games won (0, 1, 2, 3, 4). Or outcome could be result of each game, like WLWW – then there are 16 possible outcomes. b. You call a “random” household in your city and record the number of hours that the TV was on that day. number of hours of TV watched could be 0, 1, 2, 3, Ö, 24 (assuming answer is recorded to nearest hour) c. You talk to an Ohio resident who has recently received her college degree. How many years did she go to college? number of years attending college = 3, 4, 5, 6, . . . , 10 d. The political party of our next elected U.S. President. political party: republican, democratic, independent e. The age of our next President when he/she is inaugurated. age of next President: 35, 36, 37, . . . , 75 (or some other reasonable upper limit) f. The year a human will next land on the moon. year next human lands on moon: 2020, 2021, . . .
Exercise 14. Writing Sample Spaces For the following random experiments, give an appropriate sample space for the random experiment. You can use any method (a list, a tree diagram, a two-way table) to represent the possible outcomes. a. The time you arrive at your first class on Monday that begins at 8:30 AM. time arriving to class: 8:20, 8:21, . . . , 8:45 b. You throw a ball in the air and record how high it is thrown (in feet). height of ball in feet: continuous value between 2 and 12 feet c. Your cost of textbooks next semester. cost of textbooks: 0, $1, . . . , $300 d. The number of children you will have. number of children: 0, 1, 2, 3,. . . , 20 e. You take a five question true/false test. number of questions correct: 0, 1, 2, 3, 4, 5 f. You drive on the major street in your town and pass through four traffic lights. could record the number of lights where you hit a red light; outcomes 0, 1, 2, 3, 4
7
Exercise 15. Probability Assignments Give reasonable assignments of probabilities based on the given information. a. In the United States, there were 4058 thousand babies born in the year 2000 and 1980 thousand were girls. Assign probabilities to the possible genders of your next child. Gender
Boy
Girl
Probability
2078/4056
1980/4056
b. Next year, your school will be playing your neighboring school in football. Your neighboring school is a strong favorite to win the game. Winner of Game
Your school
Your neighboring school
Probability
small
large
c. You have an unusual die that shows 1 on two sides, 2 on two sides, and 3 and 4 on the remaining two sides. Roll
1
2
3
4
5
6
Probability
2/6
2/6
1/6
1/6
0
0
Exercise 16. Probability Assignments Based on the given information, decide if the stated probabilities are reasonable. If they are not, explain how they should be changed. a. Suppose you play two games of chess with a chess master. You can either win 0 games, 1 game, or 2 games, so the probability of each outcome is equal to 1/3. This is not reasonable – not likely that you’d win 2 games against a chess master, so “2 games” should get a small probability. b. Suppose 10% of cars in a car show are Corvettes and you know that red is the most popular Corvette color. So the chance that a randomly chosen car is a red Corvette must be larger than 10 %. This is not reasonable. P(red Corvette) can’t be larger than P(Corvette) since “red Corvette” is a subset of “Corvette”. c. In a Florida community, you are told that 30% of the residents play golf, 20% play tennis, and 40% of the residents play golf and tennis. These are reasonable probabilities. d. Suppose you are told that 10% of the students in a particular class get A, 20% get B, 20% get C, and 20% get D. That means that 30% of the class must fail the class. These are reasonable probability statements.
Exercise 17. Finding the Right Key Suppose your key chain has five keys, one of which will open up your front door of your apartment. One night, you randomly try keys until the right one is found.
8
Here are the possible numbers of keys you will try until you get the right one: 1 key, 2 keys, 3 keys, 4 keys, 5 keys (a) Circle the outcome that you think is most likely to occur. 1 key, 2 keys, 3 keys, 4 keys, 5 keys (b) Circle the outcome that you think is least likely to occur. 1 key, 2 keys, 3 keys, 4 keys, 5 keys (c) Based on your answers to parts a and b, assign probabilities to the six possible outcomes. The answers here will depend on the choices for (a) and (b).
Exercise 18. Playing Roulette One night in Reno, you play roulette five times. Each game you bet $5 – if you win, you win $10; otherwise, you lose your $5. You start the evening with $25. Here are the possible amounts of money you will have after playing the five games. $0, $10, $20, $30, $40, $50 . (a) Circle the outcome that you think is most likely to occur. $0, $10, $20, $30, $40, $50 . (b) Circle the outcome that you think is least likely to occur. $0, $10, $20, $30, $40, $50 . (c) Based on your answers to parts a and b, assign probabilities to the six possible outcomes. The answers here will depend on the choices for (a) and (b).
Exercise 19. Cost of Your Next Car Consider the cost of the next new car you will purchase in the future. There are five possibilities: • • • • •
cheapest: the car will cost less than $5000 cheaper: the car will cost between $5000 and $10,000. moderate: the car will cost between $10,000 and $20,000 expensive: the car will cost between $20,000 and $30,000 really expensive: the car will cost over $30,0000
(a) Circle the outcome that you think is most likely to occur. cheapest, cheaper, moderate, expensive, really expensive (b) Circle the outcome that you think is least likely to occur. cheapest, cheaper, moderate, expensive, really expensive (c) Based on your answers to parts a and b, assign probabilities to the five possible outcomes. The answers here will depend on the choices for (a) and (b).
9
Exercise 20. Flipping a Coin Suppose you flip a coin twice. There are four possible outcomes (H stands for heads and T stands for tails). HH, HT, T H, T T (a) Circle the outcome that you think is most likely to occur. HH, HT, T H, T T (b) Circle the outcome that you think is least likely to occur. HH, HT, T H, T T (c) Based on your answers to parts a and b, assign probabilities to the four possible outcomes. The answers here will depend on the choices for (a) and (b).
Exercise 21. Playing Songs in Your iPod Suppose you play three songs by Jewell (J), Madonna (M), and Plumb (P) in a random order. (a) Write down all possible ordering of the three songs. JM P, JP M, M JP, M P J, P JM, P M J (b) Let M = event that the Madonna song is played first and B = event that the Madonna song is played before the Jewell song. Find P (M ) and P (B). P (M ) = 2 / 6, P (B)= 3 / 6 (c) Write down the outcomes in the event M ∩ B and find the probability P (M ∩ B). M ∩ B = {M JP, M P J}, P (M ∩ B) = 2/6 ¯ (d) By use of the complement property, find P (B). ¯ = 1 − P (B) = 1 − 3/6 P (B) (e) By use of the addition property, find P (M ∪ B). P (M ∪ B) = P (M ) + P (B) − P (M ∩ B) = 2/6 + 3/6 − 2/6 = 3/6
Exercise 22. Student of the Day Suppose that students at a local high school are distributed by grade level and gender. Freshmen
Sophomores
Juniors
Seniors
TOTAL
25 20 45
30 32 62
24 28 52
19 15 34
98 95 193
Male Female TOTAL
Table of grade level and gender. Suppose that a student is chosen at random from the school to be the “student of the day”. Let F = event that student is a freshmen, J = event that student is a junior, and M = event that student is a male. (a) Find the probability P (F¯ ). 88 / 193
10
(b) Are events F and J mutually exclusive. Why? Yes, a student can’t be both a freshman and a junior. (c) Find P (F ∪ J) . 45 / 193 + 52 / 193 = 97 / 193 (d) Find P (F ∩ M ). 25 / 193 (e) Find P (F ∪ M ). 45 / 193 + 98 / 193 - 25 / 193 = 118 / 193
Exercise 23. Proving Properties of Probabilities Given the three probability axioms and the properties already proved, prove the complement property ¯ = 1 − P (A). An outline of the proof is written below. P (A) ¯ (a) Write the sample space S as the union of the sets A and A. By properties of sets, S = A ∪ A¯ (b) Apply Axiom 3. ¯ By Axiom 3, since A and A¯ are mutually exclusive, P (S) = P (A) + P (A) (c) Apply Axiom 2. ¯ which gives result. By Axiom 2, P (S) = 1, so 1 = P (A) + P (A)
Exercise 24. Proving Properties of Probabilities Given the three probability axioms and the properties already proved, prove the addition property P (A ∪ B) = P (A) + P (B) − P (A ∩ B). A Venn diagram and an outline of the proof are written below. (a) Write the set A ∪ B as the union of three sets that are mutually exclusive. ¯ A ∪ B = (A ∩ B) ∪ (A¯ ∩ B) ∪ (A ∩ B) (b) Apply Axiom 2 to write P (A ∪ B) as the sum of three terms. Since these three sets are mutually exculsive, we can apply Axiom 3: ¯ P (A ∪ B) = P (A ∩ B) + P (A¯ ∩ B) + P (A ∩ B) (c) Write the set A as the union of two mutually exclusive sets. ¯ A = (A ∩ B) ∪ (A ∩ B) (d) Apply Axiom 2 to write P (A) as the sum of two terms. Since these two sets are mutually exculsive, we can apply Axiom 3: ¯ P (A) = P (A ∩ B) + P (A ∩ B) (e) By writing the set B as the union of two mutually exclusive sets and applying Axiom 2, write P (B) as the sum of two terms. By similar work, we can show P (B) = P (A ∩ B) + P (A¯ ∩ B) (f) By making appropriate substitutions to the expression in part b, one obtains the desired result. 11
¯ P (A ∪ B) = P (A ∩ B) + P (A¯ ∩ B) + P (A ∩ B) P (A ∪ B) = P (A ∩ B) + [P (B) − P (A ∩ B)] + [P (A) − P (A ∩ B)] and we obtain P (A ∪ B) = P (A) + P (B) − P (A ∩ B)
Chapter 2 - Counting Methods Exercise 1: Constructing a Word Suppose you select three letters at random from {a, b, c, d, e, f} to form a word. a. How many possible words are there? 120 b. What is the probability the word you choose is fad? 1/120 c. What is the probability the word you choose contains the letter “a”? 60/120 d. What is the chance that the first letter in the word is “a”? 20/120 e. What is the probability that the word contains the letters “d”, “e”, and “f”? 1/20
Exercise 2. Running a Race There are seven runners in a race { three runners are from Team A and four runners are from Team B. a. Suppose you record which runners finish first, second, and third. Count the number of possible outcomes of this race. 7 P 3 = 7 x 6 x 5 = 210 b. If the runners all have the same ability, then each of the outcomes in a. are equally likely. Find the probability that Team A runners finish first, second, and third. 3! / 120 = 6/120 c. Find the probability that the first runner across the finish line is from Team A. 7 possible winners, of which 3 are from Team A – prob = 3/7
Exercise 3. Rolling Dice Suppose you roll three fair dice. a. How many possible outcomes are there? 6ˆ3 = 216 b. Find the probability you roll three sixes.
12
1/216 c. Find the probability that all three dice show the same number. 6/216 d. Find the probability that the sum of the dice is equal to 10. different ways 1 + 3 + 6, 1 + 4 + 5, 2 + 2 + 6, 2 + 3 + 5, 2 + 4 + 4, 3 + 3 + 4 prob = (6 + 6 + 3 + 6 + 3 + 3)/216 = 27/2163.
Exercise 4. Ordering Hash Browns When you order Waffle House’s world famous hash browns, you can order them scattered (on the grill), smothered (with onions), chunked (with ham), topped (with chili), diced (with tomatoes), and peppered (with peppers). How many ways can you order hash browns at Waffle House? 2ˆ6 = 64
Exercise 5. Selecting Balls from a Box A box contains 5 balls – 2 are white, 2 are black, and one is green. You choose two balls out of the box at random without replacement. a. How many outcomes do you if the order that you choose balls is not important? 10 b. Find the probability that you choose two white balls. 1/10 c. Find the probability you choose two balls of the same color. 2/10
Exercise 6. Dividing into Teams Suppose that ten boys are randomly divided into two teams of equal size. Find the probability that the three tallest boys are on the same team. Number of ways of choosing teams = 10 C 5 = 252 Prob = (3 C 3 x 7 C 2 + 3 C 0 x 7 C 5)/10 C 5 = 42 / 252
Exercise 7. Choosing Numbers Suppose you choose three numbers from the set {1, 2, 3, 4, 5, 6, 7, 8} (without replacement). a. How many possible choices can you make? 8 C 3 = 56 b. What is the probability you choose exactly two even numbers? (4 C 2 x 4 C 1)/(8 C 3) = 24 / 56 c. What is the probability the three numbers add up to 10? 4 / 8 C 3 = 4 / 56 13
Exercise 8. Choosing People Suppose you choose two people from three married couples. a. How many selections can you make? 6 C 2 = 15 b. What is the probability the two people you choose are married to each other? 3/15 c. What is the probability that the two people are of the same gender? (3 + 3) / 15 = 6 / 15
Exercise 9. Football Plays Suppose a football team has five basic plays, and they will randomly choose a play on each down. a. On three downs, find the probability that the team runs the same play on each down. 5 / 125 b. Find the probability the team runs three different plays on the three downs. 5 x 4 x 3 / 125 = 60 / 125
Exercise 10. Playing the Lottery In a lottery game, you make a random guess at the winning threedigit number (each digit can be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9). You win $200 if your guess matches the winning number, $20 if your guess matches in exactly two positions and $2 if your guess matches in exactly one position. Find the probabilities of winning $200, winning $20, and winning $2. Win $200 with probability 1/1000 Win $20 with probability 27/1000 Win $2 with probability 243/1000
Exercise 11. Dining at a Restaurant Suppose you are dining at a Chinese restaurant with the menu given on the previous page. You decide to order a combination meal where you get to order one soup or appetizer, one entree (seafood, beef, or poultry), and a side dish (either fried rice or noodles). a. How many possible combination meals can you order? 8 x 14 x 10 = 1120 b. If you are able to go to this restaurant every day, approximately how many years could you order different combination meals? about 3 years c. Suppose that you are allergic to seafood (this includes crab, shrimp, and scallops). How many different combination meals can you order? 6 x 9 x 9 = 486
14
d. Suppose your friend orders two different entrees completely at random. How many possible dinners can she order? What is the probability the two entrees chosen contain the same meat? 14 C 2 = 91, [5 C 2 + 4 C 2 + 5 C 2] / 91 = 26 / 91
Exercise 12. Ordering Pizza If you buy a pizza from Papa John’s, you can you order the following toppings: ham, bacon, pepperoni, Italian sausage, sausage, beef, anchovies, extra cheese, baby portabella mushrooms, onions, black olives, Roma tomatoes, green peppers, jalapeno peppers, banana peppers, pineapple, grilled chicken. a. If you have the option of choosing two toppings, how many different two topping pizzas can you order? 17 C 2 = 136 b. Suppose you want your two toppings to be some meat and some peppers. How many two-topping pizzas are of this type? 6 x 3 = 18 c. If you order a “random” two-topping pizza, what is the chance that it will have peppers? (3 C 2 14 C 0 + 3 C 1 14 C 1) / 136 = 45 / 136 d. If you are able to order at most four toppings, how many different pizzas can you order? 14 C 0 + 14 C 1 + 14 C 2 + 14 C 3 + 14 C 4 = 1471
Exercise 13. Mixed Letters You randomly mix up the letters “s”, “t”, “a”, “t”, “s”. a. Find the probability the arrangement spells the word “stats”. Number of ways is 5! / (2! 2! 1) = 30 P(spell ‘stats’) = 1 / 30 b. Find the probability the arrangement starts and ends with “s”. P(s***s) = 3 / 30
Exercise 14. Arranging CDs Suppose you have three Madonna cds and three Jewel cds sitting on a shelf as follows. The cds are knocked off of the shelf and you place them back on the shelf completely at random. a. What is the probability that the mixed-up cds remain in the same order? 1 / (6 P 3) = 20 b. What is the probability that the first and last cds on the shelf are both Jewel music? 0.2 c. What is the probability that the Jewel cds stay together on the shelf? 0.2
15
Exercise 15. Playing a Lottery Game The Minnesota State Lottery has a game called Daily 3. A three digit number is chosen randomly from the set 000, 001, . . . , 999 and you win by guessing correctly certain characteristics of this three digit number. The lottery website lists the following possible plays such as First Digit, Front Pair, etc. Find the probability of winning for each play. • • • • •
First Digit: Pick one number. To win, match the first number drawn. Front Pair: Pick 2 numbers. To win, match the first 2 numbers drawn in exact order Straight: Pick 3 numbers. To win, match all 3 numbers drawn in exact order. 3-Way Box: Pick 3 numbers, 2 that are the same. To win, match all three numbers drawn in any order. 6-Way Box: Pick 3 different numbers. To win, match all 3 numbers drawn in any order.
First digit 1/10 Front pair 1/100 Straight 1/1000 3-Way Box 3/1000 6-Way Box 6/1000
Exercise 16. Booking a Flight Suppose you are booking a flight to San Francisco on Orbitz. To save money, you agree to either leave Monday, Tuesday, or Wednesday, and return on either Friday, Saturday, or Sunday. Assume that Orbitz randomly assigns you a day to leave and randomly assigns you a day to return. a. What is the probability you leave on Tuesday and return on Saturday? 1/9 b. What is the chance that your trip will be exactly three days long? 1/9 c. What is the most likely trip length in days? 5 days d. Do you think that the assumptions about Orbitz are reasonable? Explain. Assumptions are probably not reasonable.
Exercise 17. Assigning Grades A math class of ten students takes an exam. a. If the instructor decides to give exam grades of A to two randomly selected students, how many ways can this be done? 10 C 2 = 45 b. Of the remaining eight students, three will receive B’s and the remaining will receive C’s. How many ways can this be done? 8 C 3 = 56 c. If the instructor assigns at random, two A’s, three B’s and five C’s to the ten students, how many ways can this be done?
16
(10 C 2) (8 C 3) = 2520 d. Under this grading method, what is the probability that Jim (the best student in the class) gets an A? (9 C 1) / (10 C 2) = 9/ 56
Exercise 18. Choosing Officers A club consisting of 8 members has to choose three officers. a. How many ways can this be done? 8 C 3 = 56 b. Suppose that the club needs to choose a president, a vice president, and a treasurer. How many ways can this be done? 8x7x6 c. If the club consists of 4 men and 4 women and the officers are chosen at random, Find the probability the three officers are all of the same gender. (4 C 3 + 4 C 3) / 56 d. Find the probability the president and the vice-president are different genders. (4 C 1 x 4 C 1) / (8 C 2) = 16/28
Exercise 19. Playing Yahtzee Find the number of ways and the corresponding probabilities of getting all of the following patterns in Yahtzee. Here are some hints for the different patterns. • Four of a kind: The pattern here is x, x, x, x, y, where x is the number that appears four times and y is the number that appears once. (1) choose (x, y): 6 x 5 (2) mix up orderings: 5 (3) Total number = 6 x 5 x 5 = 150 • Large straight: (1) can either contain 1, 2, 3, 4, 5 or 2, 3, 4, 5, 6 (2) mix up five numbers (3) Total number = 2 * 5! = 2 x 120 = 240 • Small straight: This roll will either include the numbers 1, 2, 3, 4, the numbers 2, 3, 4, 5, or the numbers 3, 4, 5, 6. If the numbers 1, 2, 3, 4 are the small straight, then the remaining number can not be 5 (otherwise it would be a large straight). (1) (2) (3) (4)
1234? 120 + 4 x 60 2345? 4 x 60 3456? 120 + 4 * 60 Total = 360 + 360 + 240 = 960 (720 have one-pair)
• Full house: The pattern here is x, x, x, y, y, where x is the number that appears three times and y is the number that appears twice. (1) Choose x and y: 6 x 5 (2) Mix up numbers: (5 choose 2) = 10 (3) Total number = 30 * 10 = 300
17
• Three of a kind: The pattern here is x, x, x, y, z, where x is the number that appears three times, and y and z are the numbers that appear only once. (1) choose x, y, z: 6 x (5 choose 2) = 60 (2) mix up numbers: 5! / 3! = 20 (3) Total number = 60 * 20 = 1200 • Two pair: The pattern here is x, x, y, y, z. I obtained that there are 1800 rolls of this type. • One pair: The pattern here is x, x, w, y, z, where x is the number that appears two times, and w, y and z are the numbers that appear only once. NOTE: I have to subtract the number of small straights in this group. (1) 6 * (5 choose 3) = 60 (2) 5! / 2! = 60 (3) Total = 60 x 60 - 720 = 2880 • Nothing: This is the most difficult number to count directly. Once the number of each of the remaining patterns is found, then the number of “nothings” can be found by subtracting the total number of other patterns from the total number of rolls (7776). I obtained there are 320 ‘nothings’.
Exercise 20. Sampling Letters The built-in vector letters contains the 26 lower-case letters of the alphabet. a. Using the sample() function, take a sample of 10 letters without replacement from letters. sample(letters, size = 10, replace = FALSE) ##
[1] "m" "a" "f" "z" "g" "e" "s" "x" "h" "r" b. Using the sample() function, take a sample of 10 letters with replacement from letters.
sample(letters, size = 10, replace = TRUE) ##
[1] "h" "i" "i" "q" "c" "l" "y" "m" "r" "i"
Exercise 21. Sampling Letters (continued) a. Write a function to take a sample of 10 letters without replacement from letters. letters_sample