HW6

  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. Answer: Total marbles = 54 + 9 + 75 = 138

Probability of red when drawn = 54/1380 = 0.39

Probability of blue when drawn = 75/138 = 0.54

Now, probability of red or blue = 0.39 + 0.54 = 0.93

  1. 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. Answer: Total balls = 19 + 20 + 24 + 17 = 80

Probability of red = 20 / 80 = 0.25

  1. 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 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. Answer: Let, NM represent not male and NP represent doe not live parents

P(NM or NP) = P(NM) + P(NP) - P(NM and NP)

P(NM) = Total Not Males/Total Customers = (228 + 79 + 252 + 97 + 72) / 1399 = 728/1399

P(NP) = Total Not Parents/Total Customers = (81 + 228 + 116 + 79 + 130 + 97 + 129 + 72)/1399 = 932/1399

P(NM and NP) = (228 + 79 + 97 + 72)/1399 = 476/1399

P(NM or NP) = 728/1399 + 932/1399 - 476/1399 = 1184/1399

Therefore, the answer is = 0.8463

  1. Determine if the following events are independent. Going to the gym. Losing weight.

Answer: A) Dependent B) Independent

The answer is A) Dependent because by going to the gym and working out leads to losing weight.

  1. 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? Answer:
Wraps <- choose(8,3) * choose(7,3) * choose(3,1)
Wraps
## [1] 5880

There are total 5880 different kinds of wraps that can be made from this combination.

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

Here, The events are independent, there is no connection between any of these events.

  1. 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? Answer:
total_spots <- 8
candidates <- 14

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

There are total 121080960 ways the members can be appointed.

  1. 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. Answer:
red_jb <- 9
orange_jb <- 4
green_jb <- 9

red_jb <- factorial(red_jb)/(factorial(red_jb - 0)*factorial(0))
orange_jb <- factorial(orange_jb)/(factorial(orange_jb - 1)*factorial(1))
green_jb <- factorial(green_jb)/(factorial(green_jb-3)*factorial(3))
total_jb <- factorial(22)/(factorial(22 - 4)*factorial(4))

round((red_jb * orange_jb * green_jb)/total_jb, 4)
## [1] 0.0459

The answer is 0.0459.

  1. Evaluate the following expression. 11! / 7!

Here, fraction = 11! / 7! = (11 * 10 * 9 * 8 * 7!) / 7!
= 7920

  1. Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34. Answer: This means that 33% of the subscribers to a fitness magazine are younger than 34 years.

  2. If you throw exactly thre 11. e 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. Answer:

total <- 2^4
zero_heads <- factorial(4)/(factorial(4-0)*factorial(0))/total
one_heads <- factorial(4)/(factorial(4-1)*factorial(1))/total
two_heads <- factorial(4)/(factorial(4-2)*factorial(2))/total
three_heads <- factorial(4)/(factorial(4-3)*factorial(3))/total
four_heads <- factorial(4)/(factorial(4-4)*factorial(4))/total

heads_probability <- data.frame(c(zero_heads, one_heads, two_heads, three_heads, four_heads))
gamble <- c(-30,-30,-30, 97,-30)
(expected_value <- sum(gamble * heads_probability[,1]))
## [1] 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.) Answer: since the value is positive in above calculation

win <- 559 * expected_value
win
## [1] 978.25
  1. 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.

Answer:

for (i in 0:4){
  value <- choose(9, i)
  value <- value + value
}

four_tails_or_less <- round(value/(2^9), 2)
five_tails_or_more <- 1-four_tails_or_less

(exp_value <- sum(four_tails_or_less * 23, five_tails_or_more * -26))
## [1] -1.99

Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.) Answer: since, the value is negative in above calculation

loss <- 994 * exp_value
loss
## [1] -1978.06
  1. 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.
  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.)

Answer:

liar <- 0.59
truth_teller <- 0.9
percent_will_lie <- 0.20

prob_liar_detected <- (liar * percent_will_lie)/(((1-percent_will_lie) * (1-truth_teller)) + (percent_will_lie * liar))

round(prob_liar_detected, 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.) Answer:
liar <- 0.59
truth_teller <- 0.9
percent_will_lie <- 0.20

prob_truth_detected <- ((truth_teller) * (1 - percent_will_lie))/(((1 - liar) * (percent_will_lie)) + (truth_teller * (1 - percent_will_lie)))

round(prob_truth_detected, 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. Answer:
percent_will_lie <- .2
liar <- 0.59
prob_liar_detected <- 0.596

liar_or_identified <- (liar + percent_will_lie) - prob_liar_detected
liar_or_identified
## [1] 0.194