Answer: Probability that the marble selected is a red or blue marble = (number of red or blue marbles) / total number of marbles
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
((54 + 75) / (54 + 75 + 9)) %>% round(4)
## [1] 0.9348
Answer: Probability of getting a red ball = (number of red balls available) / (total number of balls)
(20 / (19 + 20 + 24 + 17)) %>% round(4)
## [1] 0.25
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.
Answer: P(customer is not a male or does not live with parents) - As this is an or, that means this event is same as : either the customer is a female OR the customer does not live with parents, which is equivalent to: all customers from the table MINUS males living with parents = 1399 - 215
((1399 - 215) / 1399) %>% round(4)
## [1] 0.8463
If the question was for: probability that a customer is neither male nor does the customer live with parents, then this event would be equivalent to: all female customers MINUS females living with parents
((228 + 79 + 97 + 72) / 1399) %>% round(4)
## [1] 0.3402
Determine if the following events are independent. Going to the gym. Losing weight Answer: These are dependent events.
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:
choose(8, 3) * choose(7, 3) * choose(3, 1)
## [1] 5880
Answer: Tese are independent events.
Answer: As the rank matters here, this will be the Permutation instead of the Combination.
factorial(14) / factorial(14 - 8)
## [1] 121080960
Answer: Total number of ways of withdrawing 4 jellybeans:
(9 + 4 + 9) %>% choose(4)
## [1] 7315
Number of ways to withdraw : 1 orange and 3 green ones:
choose(4, 1) * choose(9, 3)
## [1] 336
Probability of withdrawing 1 orange and 3 green ones = (Number of ways to withdraw : 1 orange and 3 green ones) / (Total number of ways of withdrawing 4 jellybeans)
((choose(4, 1) * choose(9, 3)) / ((9 + 4 + 9) %>% choose(4))) %>% round(4)
## [1] 0.0459
11! / 7!
Answer: 11! / 7! = (11.10.9.8.7!) / 7! = 11.10.9.8 = 7920
Alternatively using R:
factorial(11) / factorial(7)
## [1] 7920
Answer: The remaining 33% subscribers of the magazine are 34 or below. As both add up to give 100% or probability of 1, the above is the complement of the even given in the question.
Answer: Let us first find the total number of possible outcomes when 4 coins are tossed. This will give the total number.
total_number_of_ways_11 <- 2^4
total_number_of_ways_11
## [1] 16
Now, the number of ways exactly 3 heads can come:
number_of_ways_3_heads_11 <- choose(4, 3)
number_of_ways_3_heads_11
## [1] 4
Now, probablity of getting exactly 3 heads:
probability_3_heads_11 <- number_of_ways_3_heads_11 / total_number_of_ways_11
probability_3_heads_11
## [1] 0.25
Value of the proposition:
value_of_proposition_11 <- probability_3_heads_11 * 97 + (1 - probability_3_heads_11) * (-30)
value_of_proposition_11
## [1] 1.75
Hence, the value of this proposition is +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.)
Answer: Expected win or loss = value of each possible game (value proposition) X number of games played
expected_win_or_loss_11 <- value_of_proposition_11 * 559
expected_win_or_loss_11
## [1] 978.25
Hence I am expected to win $978.25 if I play 559 games
Answer: Similar to exercise 11, we will first calculate the total number of possible outcomes:
total_number_of_ways_12 <- 2^9
total_number_of_ways_12
## [1] 512
Now we will find the possible number of ways to have 4 tails or less, which will be = Number of ways to have 0 Tails + 1 Tails + 2 Tails + 3 Tails + 4 Tails
number_of_ways_4orless_tails <- 1 + choose(9, 1) + choose(9, 2) + choose(9, 3) + choose(9, 4)
number_of_ways_4orless_tails
## [1] 256
probability_4orless_tails <- number_of_ways_4orless_tails / total_number_of_ways_12
probability_4orless_tails
## [1] 0.5
value_of_proposition_12 <- probability_4orless_tails * 23 + (1 - probability_4orless_tails) * (-26)
value_of_proposition_12
## [1] -1.5
Value of proposition = -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.)
Answer:
expected_win_or_loss_12 <- value_of_proposition_12 * 994
expected_win_or_loss_12
## [1] -1491
Value of expected_win_or_loss_12 is -1491, which is a negative value. So, I am expected to lose 1491, if I play this game 994 times.
Answer: Assigning the given values to variables:
p_liar = 0.2
p_detect_liar_a_liar = 0.59
p_detect_truthteller_a_truthteller = 0.9
p_truthteller = 1 - p_liar
Calculating the absolute values now:
p_liar_detected_liar = p_liar * p_detect_liar_a_liar
p_liar_detected_truthteller = p_liar * (1 - p_detect_liar_a_liar)
p_truthteller_detected_liar = p_truthteller * (1 - p_detect_truthteller_a_truthteller)
p_truthteller_detected_truthteller = p_truthteller * p_detect_truthteller_a_truthteller
Now calculating this answer:
p_liar_given_detected_liar = (p_liar_detected_liar / (p_liar_detected_liar + p_truthteller_detected_liar)) %>% round(4)
p_liar_given_detected_liar
## [1] 0.596
p_truthteller_given_detected_truthteller = (p_truthteller_detected_truthteller / (p_truthteller_detected_truthteller + p_liar_detected_truthteller)) %>% round(4)
p_truthteller_given_detected_truthteller
## [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. Answer:
p_either_liar_or_detected_liar = (p_liar + p_truthteller_detected_liar) %>% round(4)
p_either_liar_or_detected_liar
## [1] 0.28