Question 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 1

r <- 54
w <- 9
b <- 75
total_balls <- r + w + b
p_red <- r/total_balls
p_blue <- b/total_balls

p_red_or_blue <- p_red + p_blue
round(p_red_or_blue, 4)
## [1] 0.9348

Question 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.

Answer 2

green <- 19
red <- 20
blue <- 24
yellow <- 17
total_golf_balls <- green + red + blue + yellow
probability_red <- red / total_golf_balls
round(probability_red, 4)
## [1] 0.25

Question 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.

males <- c(81, 116, 215, 130, 129)
females <- c(228, 79, 252, 97, 72)

customers <- data.frame(males, females)
row.names(customers) <- c("Apartment", "Dorm", "With Parents", "Sorority or Fraternity HOuse", "Other")
customers
##                              males females
## Apartment                       81     228
## Dorm                           116      79
## With Parents                   215     252
## Sorority or Fraternity HOuse   130      97
## Other                          129      72

Answer 3

apartment <- 81 + 228
dorm <- 116 + 79
with_parents <- 215 + 252
sorority_fraternity_house <- 130 + 97
other <- 129 + 72
total_customers <- apartment + dorm + with_parents + sorority_fraternity_house + other
male_and_with_parents <- 215
p_male_and_with_parents <- male_and_with_parents / total_customers
p_not_male_or_not_parents <- (1-p_male_and_with_parents)
round(p_not_male_or_not_parents, 4)
## [1] 0.8463

Question 4

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

Answer 4

They are dependent.

Question 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?

Answer 5

\(\binom{n}{k}\) or \(((n!)/(n-k)!*k!)\) or we can simply use choose function for each combination and multiply the results.

vegatables <- choose(8,3) # 3 out of 8 vegatables 
condiments <- choose(7,3) # 3 out of 7 condiments
tortilla <- choose(3,1) # 1 out of 3 tortilla for the wrap

veggie_wraps <- vegatables * condiments * tortilla
veggie_wraps
## [1] 5880

Question 6

Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news.

Answer 6

They are independent.

Question 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?

Answer 7

\(n!/(n-k)!\)

candidates <- 14
spots <-8

p_ways_cabinet <- factorial(candidates) - factorial((candidates-spots))
p_ways_cabinet
## [1] 87178290480

Question 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.

Answer 8

# probability of combinations of each based on 0 red, 1 orange and 3 green out of each red, orange and green beans. 
red_beans <- choose(9,0)
orange_beans <- choose(4,1)
green_beans <- choose(9,3)
total_beans <- red_beans * orange_beans * green_beans

# 3 out of 9 green, 0 out of 9 red and 1 out of 4 orange. all possible combinations ((3+1+0) out of (9+9+4))

all_combinations <- choose(22,4)

probability <- total_beans / all_combinations
round(probability, 4)
## [1] 0.0459

Question 9

Evaluate the following expression. 11!/7!

ev <- factorial(11)/factorial(7)
ev
## [1] 7920

Question 10

Describe the complement of the given event.

67% of subscribers to a fitness magazine are over the age of 34.

Answer 10

p_above_34 <- 0.67
p_above_34_complement <- 1-0.67
p_above_34_complement
## [1] 0.33

Basically, if the 67% of the subscribers are above 34 years old, complement of this would 33% of the subscribers are not above 34 (which would be less than or equal to 34).

Question 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.)

Answer 11

Step 1

Basically, success is heads and failure is tails. 3 success out of 4 trials. We can calculate probability of 3 success out of 4 trials by using pbinom (binomial distribution)

# probability of having a value *higher* than 3 with 4 trials.
p_higher <- pbinom(q=3, size=4, prob = 0.5)
# probability of having a value *lower* or equal to 2 with 4 trials
p_lower_equal <- pbinom(q=2, size=4, prob = 0.5)
# the difference between these probability will give proability of exact 3 success out of 4 trials.
p_exact <- (p_higher) - (p_lower_equal)
p_exact
## [1] 0.25

Expected value of the proposition. Probability of making $97 is 25% and probability of losing $30 is 75%

win <- p_exact * 97
loose <- (1-p_exact) * 30

value_proposition <- win - loose
value_proposition
## [1] 1.75

The expected value that we can make is 1.75 dollars.

Step 2

We are playing the game for 559 times, so we can expect to make 1.75 * 559 dollars at the end of 559 games.

money <- 1.75 * 559
money
## [1] 978.25

We can make $978.25.

Question 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.).

Answer 12

Step 1

If we say tails is success and heads is failure, we are looking to get 4 or less success to win the game.

# probability of having a value *lower* or equal to 4 with 9 trials
p_win <- pbinom(q=4, size=9, prob = 0.5, lower.tail = TRUE)
p_win
## [1] 0.5

Expected value propositions of making $23 and probability of losing $26.

win_2 <- p_win * 23
loose_2 <- (1-p_win)*26
value_proposition_2 <- win_2 - loose_2
value_proposition_2
## [1] -1.5

The expected value that we can loose 1.5 dollars.

Step 2

money_2 <- 994 * -1.5
money_2
## [1] -1491

We can loose $1491.

Question 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.

  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.)
  2. 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.)
  3. 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 13

(a)

\(P(A)=0.20\) : Probability of Liar \(P(B)=0.80\) : Probability of Truth \(P(C|A)=0.59\) : Probability of Polygraphy telling us that the person is a liar given that the person is actually a liar \(P(D|B)=0.90)\) : Probability of Polygraph tellins us that the person is telling the truth given the person is actually telling the truth

The answer of question a is 0.59 as it is given in the question.

(b)

The answer of question b is $P(D|B) which is 0.90 as it is given in the question.

(c)

\(P(A) or P(C) = P(A) + P(C)\)

\(P(C)=P(C|A)*P(A) + P(A|B^{c})*P(B^{c})\) \(P(C)=P(C|A)*P(A) + P(D|A)*P(A)\)

So, complement of P(A) which is probability of Liar, is P(B) which is probability of Truth.

p_c <- (0.59*0.20) + 0.90*0.20
# probability of either liar or was identified as a liar
P_a_or_c <- 0.20 + p_c
P_a_or_c
## [1] 0.498