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.
Ans)
RED_MBL <- 54
WHITE_MBL <- 9
BLUE_MBL <- 75
X <- (RED_MBL+BLUE_MBL)/(RED_MBL+BLUE_MBL+WHITE_MBL)
round(X,4)
## [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.
Ans)
GREEN_BALL <- 19
RED_BALL <- 20
BLUE_BALL <- 24
YELLOW_BALL <- 17
(TOTAL <- GREEN_BALL + RED_BALL + BLUE_BALL + YELLOW_BALL)
## [1] 80
PROB_REDBALL<- RED_BALL/TOTAL
round(PROB_REDBALL,4)
## [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.
data.frame(Housing= c("Apartment","Dorm","With Parent","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 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.
Ans)
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
4) Determine if the following events are independent.Going to the gym. Losing weight. Answer: A) Dependent B) Independent
Ans) Dependent events.(Here one event occur will effect the occurance of other event)
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?
Ans) We need to use combinations, because order does not matter.
C(n,k)=n!/(n−k)!k!
vegetables <- factorial(8)/(factorial(8-3)*factorial(3))
condiments <- factorial(7)/(factorial(7-3)*factorial(3))
tortilla <- factorial(3)/(factorial(3-1)*factorial(1))
(total <- vegetables*condiments*tortilla)
## [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
Ans) These events are independent.(Here one event occur will not effect the occurance of other event)
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?
Ans)
#Function defining
v <- function(n, r){
factorial(n)/factorial(n-r)
}
#Function calling
(permutation <- v(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.
Ans)
Total = 9 Red + 4 Orange + 9 Green =22
4 is with drawn out of 22 = 22C4 ways
Select 4 jelly beans in a way that there are 0 red and 3 green and 1 orange.
(X <- (choose(4,1) * choose(9,3)) / choose((9+4+9),4))
## [1] 0.04593301
round(X,4)
## [1] 0.0459
9) Evaluate the following expression.11!/7!
Ans)
(X <- 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.
Ans)
complement <- 100 - 67
print(paste(complement, "under 34 years of age"))
## [1] "33 under 34 years of age"
33% of subscribers are under 34 years of age.
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.
Ans)
p_3heads <- 1/4
p_not_3heads <- 3/4
(x <- (p_3heads*97) - (p_not_3heads*30))
## [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.)
Ans)
(result <- 559 * x)
## [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
Ans)
v <- pbinom(4, 9, .5)
( expect_value <-(v*23) - ((1-v)*26))
## [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.)
Ans)
(result <- expect_value*994)
## [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 forthe screening polygraph will lie.
sensitivity <- 0.59
specificiity <- 0.90
liar <- 0.2
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.)
Ans)
(sensitivity * liar)/(sensitivity*liar + (1-specificiity)*(1-liar))
## [1] 0.5959596
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.)
Ans)
(specificiity * (1-liar))/((1-sensitivity)*liar+ specificiity*(1-liar))
## [1] 0.8977556
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.
Ans)
#P(liar or identified as liar) = P(liar) + P(identified as liar) - P(liar and identified as liar)
(X <- 0.2 + 0.59 - 0.59*0.2)
## [1] 0.672