Problem 1

A box contains 54 red marbles, 9 white marbles, and 75 blue marbles. If a marble is randomly selected from the box, what is the probability that it is red or blue? Express your answer as a fraction or a decimal number rounded to four decimal places.
red <- 54
white <- 9
blue <- 75
prob_red_or_blue = round((red +  blue) / (red + white + blue), 4)
prob_red_or_blue
## [1] 0.9348

The probability of randomly selecting a red or blue marble from the box is 0.9348.

Problem 2

You are going to play mini golf. A ball machine that contains 19 green golf balls, 20 red golf balls, 24 blue golf balls, and 17 yellow golf balls, randomly gives you your ball. What is the probability that you end up with a red golf ball? Express your answer as a simplified fraction or a decimal rounded to four decimal places.
green <- 19
red <- 20
blue <- 24
yellow <- 17
prob_red <- round(red / (green + red + blue + yellow), 4)

The probability of randomly getting a red golf ball is 0.25.

Problem 3

A pizza delivery company classifies its customers by gender and location of residence. The research department has gathered data from a random sample of 1399 customers. The data is summarized in the table below.

Gender and Residence of Customers

Location of residence Males Females
Apartment 81 228
Dorm 116 79
With Parent(s) 215 252
Sorority/Fraternity House 130 97
Other 129 72
What is the probability that a customer is not male or does not live with parents? Write your answer as a fraction or a decimal number rounded to four decimal places.

First I did this the complicated way below…

prob_not_male <- 1-((81 + 116 + 215 + 130 + 129) / 1399)
prob_not_lives_w_parents <- 1-((215 + 252) / 1399)
prob_not_both <- prob_not_male + prob_not_lives_w_parents - (1-215/1399)
prob_either_or <- prob_not_male + prob_not_lives_w_parents - prob_not_both
prob_either_or
## [1] 0.8463188

Then I realized that the probability that a customer is not male OR that they do not live with parents is the same as the inverse of the probability that they are male AND live with their parents…

prob_male_and_lives_w_parents <- 215 / 1399
prob_not_male_or_not_lives_w_parents <- round((1-prob_male_and_lives_w_parents), 4)
prob_not_male_or_not_lives_w_parents
## [1] 0.8463

The probability that a customer is not male or does not live with parents is 0.8463.

Problem 4

Determine if the following events are independent. Going to the gym. Losing weight.
Answer: A) Dependent B) Independent

The two events are dependent because the probability of losing weight will presumably change based on whether or not you are going to the gym.

Problem 5

A veggie wrap at City Subs is composed of 3 different vegetables and 3 different condiments wrapped up in a tortilla. If there are 8 vegetables, 7 condiments, and 3 types of tortilla available, how many different veggie wraps can be made?
vegetables <- 8
condiments <- 7
tortillas <- 3

veggie_combos <- choose(vegetables, 3)
condiment_combos <- choose(condiments, 3)
wraps <- veggie_combos * condiment_combos * tortillas
wraps
## [1] 5880

There are 5880 different veggie wraps can be made.

Problem 6

Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news.
Answer: A) Dependent B) Independent

The events that Jeff runs out of gas on the way to work and Liz watches the evening news are independent because the outcome of one in no way influences the probability of the other.

Problem 7

The newly elected president needs to decide the remaining 8 spots available in the cabinet he/she is appointing. If there are 14 eligible candidates for these positions (where rank matters), how many different ways can the members of the cabinet be appointed?
permutations <- function(n, r){
  return (factorial(n)/factorial(n - r))
}

cabinet <- permutations(14, 8)
cabinet
## [1] 121080960

There are 121080960 different ways the president can appoint the remaining 8 spots in his cabinet.

Problem 8

A bag contains 9 red, 4 orange, and 9 green jellybeans. What is the probability of reaching into the bag and randomly withdrawing 4 jellybeans such that the number of red ones is 0, the number of orange ones is 1, and the number of green ones is 3? Write your answer as a fraction or a decimal number rounded to four decimal places.
red <- 9
orange <- 4
green <- 9
total <- red + orange + green
prob_1orange_3green <- round((choose(red, 0) * choose(orange, 1) * choose(green, 3)) / choose(total,4), 4)
prob_1orange_3green
## [1] 0.0459

The probability of choosing 0 red, 1 orange and 3 green jelly beans is 0.0459.

Problem 9

Evaluate the following expression. \(\frac{11!}{7!}\)
ans <- factorial(11)/factorial(7)
ans
## [1] 7920
ans2 <- 11*10*9*8
ans2
## [1] 7920

\[ \frac{11!}{7!} = 7920 \]

Problem 10

Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34.

Since 67% of subscribers are over the age of 34 the probability of a randomly chosen subscriber being over the age of 34 is 0.67 and the complement of that probability would be 1 - 0.67 or 0.33 probability that a randomly chosen subscriber is 34 or younger.

Problem 11

If you throw exactly three heads in four tosses of a coin you win $97. If not, you pay me $30.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
prob_3_heads <- pbinom(3, size=4, prob=0.5) - pbinom(2, size=4, prob=0.5)
prob_3_heads
## [1] 0.25
comp <- 1 - prob_3_heads
ex_v <- round(prob_3_heads*97 - comp*30, 2)
ex_v
## [1] 1.75

The expected value of the proposition is 1.75.

Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)
winnings <- 559 * (ex_v)
winnings
## [1] 978.25

I would expect to win 978.25 dollars.

Problem 12

Flip a coin 9 times. If you get 4 tails or less, I will pay you $23. Otherwise you pay me $26.
Step 1. Find the expected value of the proposition. Round your answer to two decimal places.
prob_4_or_less_tails <- pbinom(4, size=9, prob=0.5) 
prob_4_or_less_tails
## [1] 0.5
comp <- 1 - prob_4_or_less_tails
ex_v <- round(prob_4_or_less_tails*23 - comp*26, 2)
ex_v
## [1] -1.5

The expected value of the proposition is -1.5.

Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)
losses <- 994 * (ex_v)
losses
## [1] -1491

I would expect to lose -1491 dollars.

Problem 13

The sensitivity and specificity of the polygraph has been a subject of study and debate for years. A 2001 study of the use of polygraph for screening purposes suggested that the probability of detecting a liar was .59 (sensitivity) and that the probability of detecting a “truth teller” was .90 (specificity). We estimate that about 20% of individuals selected for the screening polygraph will lie.
a. What is the probability that an individual is actually a liar given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.)
liar <- 0.2
truth_teller <- 0.80
liar_sensitivity <- 0.59
truth_teller_sensitivity <- 0.90

p_pos_det_liar <- liar * liar_sensitivity
p_false_det_liar <- truth_teller * (1-truth_teller_sensitivity)

p_actually_liar <- p_pos_det_liar/(p_pos_det_liar + p_false_det_liar)
p_actually_liar
## [1] 0.5959596

There is a 0.596 probability that an individual is actually a liar when the polygraph identifies them as a liar.

b. What is the probability that an individual is actually a truth-teller given that the polygraph detected him/her as such? (Show me the table or the formulaic solution or both.)
p_pos_det_truth <- truth_teller * truth_teller_sensitivity
p_false_det_truth <- liar * (1-liar_sensitivity)

p_actually_truth_teller <- p_pos_det_truth/(p_pos_det_truth + p_false_det_truth)
p_actually_truth_teller
## [1] 0.8977556

There is a 0.8978 probability that an individual is actually a “truth teller” when the polygraph identifies them as a “truth teller”.

c. What is the probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph? Be sure to write the probability statement.
liars_or_identified <- liar + p_false_det_liar
liars_or_identified
## [1] 0.28

There is a 0.28 probability that a randomly selected individual is actually a liar whether they are detected or not, or identified as a liar even though they are telling the truth.