Data_605_Week_6

Question One - Box of Marbles

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.

Total number of marbles = 54+9+75 = 138

Probabilty of red marble = 54/138 Probabilty of blue marble = 75/138

Probability or red or blue marble = 54/138+75/138=43/46

Answer = 0.9348

rm <- 54
wm <- 9
bm <- 75
am <- sum(rm,wm , bm)

(rbm <- round((rm/am + bm/am),4) )
## [1] 0.9348

Queston Two - Golf Balls

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.

Total number of balls = 19+20+24+17 = 80

Probabilty of red ball = 2080

Answer = 0.2500

gb <- 19
rb <- 20
bb <- 24
yb <- 17
ab <- sum(gb, rb, bb, yb)
(prb <- round((rb/ab),4))
## [1] 0.25

Question Three - Pizza Delivery

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.

f <-c(228,79,252,97,72)
m <-c(81,116,215,130,129)
lwp <-c(215,252)
sf <-sum(f)
sm <-sum(m)
(stotal <-sum(sf,sm))
## [1] 1399
male_and_parents <- 215

(answer <- 1-(male_and_parents/stotal))
## [1] 0.8463188

The probability that the person is either not male or does not live with their parents is equal to : (1 - P(is male and lives with parents)) = .8463

Question Four - Gym and Losing Weight

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

Going to the gym and losing weight are dependent, you are more likely to lose weight if you go to the gym assuming that is one of your goals

Question Five - Veggie Wrap

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?

(Combinations <- choose(8,3) * choose(7,3) * choose(3,1))
## [1] 5880

Question Six - Gas and News Dependency

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

These events are independent. If we assume that Liz and Jeff do not impact each others’ lives in any sort of way

Question Seven - Cabinet Candidates

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?

spots <- 8
candidates <- 14

(permutations<- factorial(spots) / factorial(candidates-spots))
## [1] 56

Question Eight Jelly Beans

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.

Total possible combinations = 22C4

Probability of 1 orange = 4C1 / 22C4

Probability of 3 green = 9C3/22C4

total <- choose(22,4)

(Prob = choose(4,1) * choose(9,3) / total)
## [1] 0.04593301

Question 9 - Factorials

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

Question Ten - Complement

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

33% of subscribers are 34 or younger

Question Eleven

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

Prob3 <- dbinom(3, size=4, prob=0.5)
Not3 <- 1 - Prob3

expValue = (Prob3 * 97) - (Not3 * 30) 
expValue
## [1] 1.75
(559 * expValue)
## [1] 978.25

Question Twelve

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

Prob4 <- pbinom(4, size=9, prob=0.5)
Not4 <- 1- Prob4

expvalue = (23 * Prob4) - (26*Not4)
expvalue
## [1] -1.5
(994 * expValue)
## [1] 1739.5

Question Thirteen

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.

p_liar = 0.2
p_truther = 1-p_liar
p_liar_and_detect = p_liar * 0.59
p_truther_and_detect = p_truther * 0.90

cont_tbl <- data.frame(Detected_Lie = c(p_liar_and_detect, p_truther-p_truther_and_detect), 
                       Detected_Truth = c(p_liar-p_liar_and_detect, p_truther_and_detect), 
                       row.names = c("Liar", "Truth_Teller"))
cont_tbl
##              Detected_Lie Detected_Truth
## Liar                0.118          0.082
## Truth_Teller        0.080          0.720
  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.)
.118/(.118+.082)
## [1] 0.59
  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.)
.72/(.72+.082)
## [1] 0.8977556
  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

1 - P(not a liar and was not detected as liar)

1 - .72
## [1] 0.28

Corey Arnouts

March 10, 2019