Data 605 Assignment 6

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.

probability (red or blue):

red <- 54
white <-9
blue <- 75
Sum <- red + white + blue

Prob <- round((red + blue)/Sum, 4)
Prob
## [1] 0.9348

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.

probability (red):

greeng <- 19
redg <-20
blueg <- 24
yellowg <- 17
Sumg <- greeng + redg + blueg + yellowg

Probg <- round((redg /Sumg), 4)
Probg
## [1] 0.25

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.

P(M∪P)=1-P(M∩P)

Sum2 <- 81+116+215+130+129+228+79+252+97+72

ProbMP <- 215 / Sum2
ProbMOP <- round(1-ProbMP, 4)
ProbMOP
## [1] 0.8463

4) Determine if the following events are independent.

Going to the gym. Losing weight. Answer: B) Independent

Going to gym with losing weight is dependent, it will burn energy during exercise.

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?

vegetablesC <- choose(8, 3)
condimentsC <- choose(7, 3)
tortillaC <- choose(3, 1)

Veggie <- vegetablesC * condimentsC * tortillaC
Veggie
## [1] 5880

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

It is independent between the relationships jeff’s rununing out of gas and Liz watching everning news.

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?

Using Permutation:

ways <- factorial(14)/factorial(14-8)
ways
## [1] 121080960

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.

jellybeans <- round(choose(9,0)*choose(4,1)*choose(9,3)/choose(22,4), 4)
jellybeans
## [1] 0.0459

9) Evaluate the following expression.

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

=11???10???9???8 =7920

Test:

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

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

The other 33% of subscribers to a fitness magazine are 34 or younger than.

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.

win <- choose(4,3) / 2^4
win
## [1] 0.25
loss <- 1-win
loss
## [1] 0.75
Expected <- 0.25 * 97 + 0.75 *-30
Expected
## [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.)

Expected value x Times =

# expected value is positive  1.75
Expectedwin <- Expected * 559
Expectedwin
## [1] 978.25

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.

Probwin <- pbinom(4, size=9, prob=0.5)
Probwin
## [1] 0.5
Probloss <- 1- Probwin
Probloss
## [1] 0.5
Expect <- Probwin*23 + Probloss*-26
Expect
## [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.)

Expected value x Times =

# expected value is negative - 1.5
Expectedloss <- Expect * 994
Expectedloss
## [1] -1491

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

Prob_lie <-0.2
Prob_truth <- 0.8

Prob_possitive_lie <- 0.59 * Prob_lie
Prob_negative_lie <- 0.41 * Prob_lie

Prob_possitive_truth <- 0.9 * Prob_truth
Prob_negative_truth <- 0.1 * Prob_truth

lier <- round(Prob_possitive_lie /(Prob_possitive_lie + Prob_negative_truth), 4)
lier
## [1] 0.596

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

truth <- round( Prob_possitive_truth / (Prob_negative_lie + Prob_possitive_truth) , 4)
truth
## [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.

P(AUB) = 1- P(Notliar N possitive_truth)

AUB <- 1-Prob_possitive_truth
AUB
## [1] 0.28