prob_red_marbles <- 54 / (54 + 9 + 75)
prob_blue_marbles <- 75 / (54 + 9 + 75)
print(paste0("The probability that a marble randomly selected from the box is red or blue is ", round(prob_red_marbles + prob_blue_marbles, 4)))
## [1] "The probability that a marble randomly selected from the box is red or blue is 0.9348"
prob_red_golfball <- 20 / (19 + 20 + 24 + 17)
print(paste0("The probability that you end up with a red golf ball is ", round(prob_red_golfball, 4)))
## [1] "The probability that you end up with a red golf ball is 0.25"
n <- 81 + 116 + 215 + 130 + 129 + 228 + 79 + 252 + 97 + 72
prob_not_male <- (228 + 79 + 252 + 97 + 72) / n
prob_not_parents <- (81 + 228 + 116 + 79 + 130 + 97 + 129 + 72) / n
prob_not_male_not_parents <- (228 + 79 + 97 + 72)/ n
print(paste0("The probability that a customer is not male or does not live with parents ", round(prob_not_male + prob_not_parents - prob_not_male_not_parents, 4)))
## [1] "The probability that a customer is not male or does not live with parents 0.8463"
Determine if the following events are independent. Going to the gym. Losing weight.
Going to the gym and losing weight are (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?
veggie <- choose(8, 3)
condim <- choose(7, 3)
torti <- choose(3, 1)
print(paste0(veggie * condim * torti, " different veggie wraps can be made."))
## [1] "5880 different veggie wraps can be made."
Determine if the following events are independent. Jeff runs out of gas on the way to work. Liz watches the evening news.
Jeff runs out of gas on the way to work and Liz watches the evening news are (B)independent
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?
x <- factorial(14) / factorial(14-8)
print(paste0(x, " different ways can the memmbers of the cabinet be appointed"))
## [1] "121080960 different ways can the memmbers of the cabinet be appointed"
red <- choose(9, 0)
orange <- choose(4, 1)
green <- choose(9, 3)
four_jellybeans <- choose(9 + 4 + 9, 4)
x <- red * orange * green / four_jellybeans
print(paste0("The probability of reaching into the bag and randomly withdrawing 4 jellybeans ", round(x, 4)))
## [1] "The probability of reaching into the bag and randomly withdrawing 4 jellybeans 0.0459"
factorial(11) / factorial(7)
## [1] 7920
Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34.
33% of subscribers to a fitness magazine are 34 or younger.
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.)
#Step 1
three_heads <- 0.25
not_three_heads <- 0.75
x <- 97 * three_heads - 30 * not_three_heads
print(paste0("The expected value of the proposition is $", round(x, 2)))
## [1] "The expected value of the proposition is $1.75"
#Step 2
print(paste0("If I played this game 559 times, I would expect to win $", x*559))
## [1] "If I played this game 559 times, I would expect to win $978.25"
#Step 1
four_tails <- pbinom(4, size = 9, prob = 0.5)
x <- 23*four_tails - 26*four_tails
print(paste0("The expected value of the proposition is ", round(x, 2)))
## [1] "The expected value of the proposition is -1.5"
#Step 2
print(paste0("If I played this game 994 times, I would expect to lose ", x*994))
## [1] "If I played this game 994 times, I would expect to lose -1491"
prob_liar <- 0.2
prob_truth <- 0.8
prob_sensitivity <- 0.59
prob_specificity <- 0.90
a <- (prob_liar * prob_sensitivity) / ((prob_liar * prob_sensitivity) + (prob_truth * (1 - prob_specificity)))
print(paste0("The probability that an individual is actually a liar given that the polygraph detected him/her as such is ", round(a, 4)))
## [1] "The probability that an individual is actually a liar given that the polygraph detected him/her as such is 0.596"
b <- (prob_truth * prob_specificity) / ((prob_truth * prob_specificity) + (prob_liar * (1 - prob_sensitivity)))
print(paste0("The probability that an individual is actually a truth-teller given that the polygraph detected him/her as such is ", round(b, 4)))
## [1] "The probability that an individual is actually a truth-teller given that the polygraph detected him/her as such is 0.8978"
c <- prob_liar + (1 - prob_specificity) * prob_truth
print(paste0("The probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph is ", round(c, 4)))
## [1] "The probability that a randomly selected individual is either a liar or was identified as a liar by the polygraph is 0.28"