Homework 6

Question 1

A bo* contains 54 red marbles, 9 white marbles, and 75 blue marbles. If a marble is randomly selected from the bo, what is the probability that it is red or blue? Epress your answer as a fraction or a decimal number rounded to four decimal places.

round((54+75)/(54+75+9), digits = 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? E*press your answer as a simplified fraction or a decimal rounded to four decimal places.
round((20)/(19+24+17+20), digits = 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.
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.

Since we are being asked to provide NOT male or Does not live with parents, we are looking at two sets which are then added together (NO Male; Not with parents)

female <- round((228+79+97+72+252)/(1399), digits = 4)
male <- round((81+116+215+130+129)/(1399), digits = 4)
Noparents <- round((1399-215-252)/(1399), digits = 4)

round(female+Noparents/1399, digits = 4)
## [1] 0.5209

Question 4

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

ANSWER: A) If we assume they are linked events, then the dependent. Loosing weight “can” be dependent on going to the gym.

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?
# 8 different veggies where we choose 3
veggies <- choose(8,3)
# 7 different condiments where we choose 3
condiments <- choose(7,3) 
# 1 types of tortilla where we choose 1
tortilla <- choose(3,1)

# combining all of them to get the answer
veggies*condiments*tortilla
## [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.
1. Jeff runs out of gas
2. Liz watches the evening news

Answer: B) Independent - there is no link between Jeff running out of gas and Liz watching the news. If Jeff ran out of gas, had an accident and Liz was watching the news for updates, then they would be dependent.

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?
factorial(14)/factorial(14-8)
## [1] 121080960

However, Rank matters. I am not sure how to calculate this with RANK.

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.
# out of 9 reds we want 0
red_jelly <- choose(9,0)
# out of 4 orange we want 1
orange_jelly <- choose(4,1)
# out of 9 green we want 3
green_jelly <- choose(9,3)
# if choice was free
all <- choose((9+4+9),4)
# probability pull
pull <- red_jelly*orange_jelly*green_jelly

round(pull/all, 4)
## [1] 0.0459

Question 9

Evaluate the following expression.

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

The Factorial of 11 would be equal to \(11*10*9*8*7*6*5*4*3*2*1\) The Factorial of 7 would be equal to \(7*6*5*4*3*2*1\)

factorial(11)/factorial(7)
## [1] 7920

Question 10

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

If 67% of the magazine are greater than age of 34 then the reverse or complement of this would be all users less than 34 years old.

age34 <- 0.67

1-age34
## [1] 0.33

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.
(a <- pbinom(3, size = 4, prob = .5)-pbinom(2, size = 4, prob = .5))
## [1] 0.25
Step 2. If you played this game 559 times how much would you expect to win or lose? (Losses must be entered as negative.)
n <- 1-a
games <- 559

games*((a*97)-(n*30))
## [1] 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.
(a <- pbinom(4, size= 9, prob = .5))
## [1] 0.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.)

n <- 1-a
games <- 994
games*((a*23)-(n*26))
## [1] -1491

If the payout amount is higher than the win amount, the result will always be a loss to the player. If the win amount is higher than the payout amount, there is a good chance the player will take the profit.

If we reverse the numbers where I will pay you $26. Otherwise you pay me $23, you get:

n <- 1-a
games <- 994
games*((a*26)-(n*23))
## [1] 1491

If you reduce the amount of games but keep i pay you $23. Otherwise you pay me $26. You still get a loss:

n <- 1-a
games <- 2
games*((a*23)-(n*26))
## [1] -3

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.
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 <- .20
truth <- 1-liar
detect_lie<- liar * .59
detect_truth <- truth *.90

answer_tbl <- data.frame(Detect_lies = c(detect_lie, truth-detect_truth),
                        Detect_truths = c(liar-detect_lie, detect_truth),
                        row.names = c("Lies", "Truths"))

answer_tbl
##        Detect_lies Detect_truths
## Lies         0.118         0.082
## Truths       0.080         0.720
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.)
round(answer_tbl$Detect_truths[2]/(answer_tbl$Detect_truths[1]+answer_tbl$Detect_truths[2]),4)
## [1] 0.8978
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.
(answer_tbl$Detect_lies[1]+answer_tbl$Detect_lies[2])+((answer_tbl$Detect_lies[1]+answer_tbl$Detect_truths[1])-answer_tbl$Detect_lies[1])
## [1] 0.28