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.

Solution

# funtion to calc probability of given marble
Prob <- function(m, total) {
  return (m/total)
}

# probability of seleting red marble
P_r <- Prob(54, 138)
# probability of seleting white marble
P_w <- Prob(9, 138)
# probability of seleting blue marble
P_b <- Prob(75, 138)

# probability of seleting red or blue marble
P_r_or_b <- round((P_r + P_b), 4)

P_r_or_b
## [1] 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.

Solution

# Green balls: 19
# Red balls: 20
# Blue balls: 24
# Yellow balls: 17

# Probability of selecting random ball which is 
P_red <- round(20/(19+20+24+17), 4)

P_red
## [1] 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

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

Solution

#                             Males    Females    Total
# Apartment                    81       228       309
# Dorm                         116      79        195
# With Parent(s)               215      252       467
# Sorority/Fraternity House    130      97        227
# Other                        129      72        201

# Probability of being female
P_Not_Male <- (228+79+252+97+72)/1399

# Probability of living with parents
P_LWP <- (215+252)/1399
# Probability of not living with parents
P_NLWP <- 1 - P_LWP

# Probability of being female and not living with parents
P_NMANDNLWP <- (228+79+97+72)/1399

# Probability of being not male or does not live with parents
# P(A or B) = P(A) + P(B) - P(A and B)

P_NMORNLWP <-  P_Not_Male + P_NLWP - P_NMANDNLWP

P_NMORNLWP <- round(P_NMORNLWP, 4)

P_NMORNLWP
## [1] 0.8463

Problem 4

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

Solution

  1. Dependent

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?

Solution

# Number of veggie wraps cane be made
vegwraps <- choose(8,3) * choose(7,3) * choose(3,1)
vegwraps
## [1] 5880

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

Solution

  1. Independent

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?

Solution

spots <- 8
candidates <- 14

factorial(candidates)/factorial(candidates-spots)
## [1] 121080960

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

Solution

# Red: 9
# Orange 4
# Green 9

# probability of selecting 4 jellybeans with red as 0, orange as 1 and green as 3
round((choose(9,0)*choose(4,1)*choose(9,3))/choose(22,4), 4)
## [1] 0.0459

Problem 9

Evaluate the following expression.

\(\frac {11!}{7!}\)

Solution

# by factorial definition
(11*10*9*8*7*6*5*4*3*2*1)/(7*6*5*4*3*2*1)
## [1] 7920
# using factorial function
factorial(11)/factorial(7)
## [1] 7920

Problem 10

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

Solution

Complement would be that (1-0.67) = .33 i.e. 33% of subscribers to a fitness magazine are under or equal to the age of 34.

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. * Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)

Solution

# Step 1. Find the expected value of the proposition. Round your answer to two decimal places.

P_Win <- dbinom(3, size = 4, prob = 0.5)
P_Loss <- 1 - P_Win

exp_prop <- round((97*P_Win+(-30)*P_Loss), 2)
exp_prop
## [1] 1.75
# Step 2. If you played this game 559 times how much would you expect to win or lose? 
round(559*exp_prop, 2)
## [1] 978.25

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. * Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)

Solution

# Step 1. Find the expected value of the proposition. Round your answer to two decimal places.

P_Win <- pbinom(4, size = 9, prob = 0.5)
P_Loss <- 1 - P_Win

exp_prop_val <- round((23*P_Win+(-26)*P_Loss), 2)
exp_prop_val
## [1] -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.)
round(994*exp_prop_val, 2)
## [1] -1491

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.

Solution

    1. 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.)
# Given details
sensitivity <- 0.59
specificity <- 0.90
p_lie <- 0.2
p_truth <- 1 - p_lie

# Calculating true positive, true negative, false positive and false negative
p_detected_liar <- sensitivity*p_lie
p_detected_truth <- specificity*p_truth

p_false_detected_liar <- (1-sensitivity)*p_lie
p_false_detected_truth <- (1-specificity)*p_truth
# probability that an individual is actually a liar given that the polygraph detected him/her as such
round( p_detected_liar/(p_detected_liar+p_false_detected_truth), 4)
## [1] 0.596
    1. 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.)
# probability that an individual is actually a truth-teller given that the polygraph detected him/her as such
round( p_detected_truth/(p_detected_truth+p_false_detected_liar), 4)
## [1] 0.8978
    1. 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.
# probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph

# P(lier or identified liar) = P(lier) + P(identified liar) - P(lier and identified liar)
p_LODL <- p_lie + (p_detected_liar + p_false_detected_truth) - p_detected_liar

round( p_LODL ,4)
## [1] 0.28