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:
red_marble <- 54
white_marble <- 9
blue_marble <- 75
round((red_marble+blue_marble)/(red_marble+blue_marble+white_marble),4)
## [1] 0.9348
The probability of it’s red or blue is 0.9348.
Answer:
green_ball <- 19
red_ball <- 20
blue_ball <- 24
yellow_ball <- 17
total <- green_ball + red_ball + blue_ball + yellow_ball
round( red_ball/total,4)
## [1] 0.25
The probability o fbeing red is 0.25.
data.frame(Housing= c("Apartment","Dorm","With Parent(s)","Sorority/Fraternity House","Other"),Males= c(81,116,215,130,129),Females= c(228,79,252,97,72))
## Housing Males Females
## 1 Apartment 81 228
## 2 Dorm 116 79
## 3 With Parent(s) 215 252
## 4 Sorority/Fraternity House 130 97
## 5 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:
not_male <- 228 + 79 + 252 + 97 + 72
not_live_parent <- 81 + 228 + 116 + 79 + 130 + 97 + 129 + 72
not_male_parent <- 228 + 79 + 97 + 72
total <- 81 + 116 + 215 + 130 + 129 + 228 + 79 + 252 + 97 + 72
ans <- not_male/total + not_live_parent/total - not_male_parent/total
round(ans, 4)
## [1] 0.8463
P(not male or not live with parent) = P(not male)+P(not female) - P(not male and not female) = 0.8463 The probability of not male or female is 0.8463.
Determine if the following events are independent. Going to the gym. Losing weight. Answer: A) Dependent
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: The answer will be multplication of the combination of vegetables, condiments and tortilla.
choose(8,3)*choose(7,3)*choose(3,1)
## [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: B) Independent
Answer: 14 permutation 8 will be the answer.
factorial(14)/factorial(14-8)
## [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.
Answer:
favouravle <- choose(9,0)*choose(4,1)*choose(9,3)
total_outcome <- choose(22,4)
round(favouravle/total_outcome,4)
## [1] 0.0459
factorial(11)/factorial(7)
## [1] 7920
10.Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34.
Answer: 33% of subscribers to a fitness magzaine are below the age of 34 years.
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: The coin toss follows binomial distribution with size 4, probability 0.5 and the number of wins 3. Step 1
win_prob <- dbinom(3, size = 4, prob = 0.5)
loss_prob <- 1 -win_prob
win_prob * 97 + loss_prob*-30
## [1] 1.75
Expected value to win is 1.75.
Step 2 Playing 559 times the expected win is
559 * 1.75
## [1] 978.25
Answer: Step 1.
win_prob <- dbinom(4, size = 9, prob = 0.5) + dbinom(3, size = 9, prob = 0.5)+ dbinom(2, size = 9, prob = 0.5)+ dbinom(1, size = 9, prob = 0.5)+ dbinom(0, size = 9, prob = 0.5)
loss_prob <- 1 -win_prob
expected <- win_prob * 23 + loss_prob*-26
expected
## [1] -1.5
The expected value is -1.5. Step 2
expected * 994
## [1] -1491
The expected loss of 994 time playing is -1491.
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.)
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.)
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:
sensitivity <- 0.59
specificiity <- 0.90
liar <- 0.2
(sensitivity * liar)/(sensitivity*liar + (1-specificiity)*(1-liar))
## [1] 0.5959596
(specificiity * (1-liar))/((1-sensitivity)*liar+ specificiity*(1-liar))
## [1] 0.8977556
0.2 + 0.59 - 0.59*0.2
## [1] 0.672
The probability is 0.672.