A box contains 54 red marbles, 9 white marbles, and 75 blue marbles. A marble is randomly selected from the box what is the probability that it is red or blue?
num_red = 54
num_white = 9
num_blue = 75
(prob = (num_red + num_blue ) / (num_red + num_white + num_blue))
## [1] 0.9347826
The answer is \[93.48\% = \frac{129}{138}= \frac{43}{46}\]
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.
The chance of a red ball is the frequency of red balls amongst all balls. This can be expressed as a fraction:
num_red = 20
num_all = 19 + 20 + 24 + 17
(prob = num_red/num_all)
## [1] 0.25
The answer is the probability \(p\) of a red golf ball is \[p = \frac{20}{80} = \frac{1}{4}\]
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.
residence = c("Apartment", "Dorm", "With Parent(s)", "Sorority/Fraternity House", "Other")
males = c( 81, 116, 215, 130, 129)
females = c( 228, 79, 252, 97, 72)
cust = data.frame( residence = residence, males = males, females = females )
kable(cust) %>% kable_styling(bootstrap_options=c("striped", "hover"))
| residence | 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.
(count_females = sum(cust$females) )
## [1] 728
(count_males_not_w_parents = sum(cust$males) - 215 )
## [1] 456
(count_total = sum( cust$males + cust$females ))
## [1] 1399
( prob_female_or_not_w_parents =
(count_females + count_males_not_w_parents ) /
count_total )
## [1] 0.8463188
Define the event \(A=\{ x \in \text{Females} \}\) and the event \(B=\{ x \in \text{ Males AND not living with parents} \}\)
The desired probability \(p\) is therefore equal to \[p=\frac{|A| + |B|}{ 1399 } = \frac{ 728 + 456 }{1399} = 84.63\%\]
Determine if the following events are independent. Going to the gym. Losing weight. Answer: A) Dependent B) Independent
The answer is A- dependent. The conditional probability of losing weight given that the person is going to the gym is greater than the unconditional probability of losing weight. This means the events are not independent.
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?
The number \(n\) of veggie wraps is the product of three independent counts corresponding to the three choices:
\[ n = \text{ vegetable choices} \cdot \text{ condiment choices} \cdot \text{ tortilla choices} = {8 \choose 3} \times {7 \choose 3} \times { 3 \choose 1 } \]
(n = choose(8,3) * choose( 7, 3 ) * choose( 3, 1))
## [1] 5880
Thus there are \(n = 5880\) possible veggie wraps.
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
The answer is B - Independent. There is no evidence that the conditional probability that Jeff runs out of gas on the way to work changes whether Liz watches the evening news. Likewise, there is no evidence the conditional probability that Liz watches the evening news changes given that Jeff runs out of gas on the way to work.
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?
The number \(n\) of appointments depends on the order of the selected subset.
Thus each set of appointments is a permutation of 14 candidates into 8 labelled spots.
(n = choose(14, 8) * factorial(8))
## [1] 121080960
Thus, there are \(n=121,080,960\) ways to choose appointments.
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.
I approach this problem by labelling every jellybean with a unique mark. Then a permutation is the arrangement of all 22 marked jellybeans in a row of consecutive slots 1..22.
We regard a draw of 4 jellybeans from the bag as a permutation of all 22 marked beans where only the first 4 slots 1..4 are observed.
The desired probability \(p = A/B\) is the ratio of permutations in the numerator \(A\) and denominator \(B\) respectively. The denominator \(B\) is the of all labelled permutations irrespective of color of the 22 jellybeans. \[B = 22! \text{ permutations }\]
The numerator \(A\) counts of the subset of valid permutations of the 22 beans where a permutation is valid if the first 4 slots are occupied by exactly one orange and three green jellybeans.
\[ \begin{align} A & = & X Y Z W \\ X & = &\text{position of orange bean in slots 1..4 } &=& 4 \\ Y & = &\text{label of orange bean in assigned slot } &=& 4 \\ Z & = &\text{permutations of 9 into 3 cells } & = & {9\choose 3} 3! \\ W & = &\text{permutations of rest of beans in slots 5..22} & = & 18! \\ \end{align} \]
This implies the probability \(p\) is \[p = \frac{A}{B} = \frac{ 4 \times 4 \times { 9 \choose 3 } \times 3! \times 18!}{22!} = \frac{{4\choose 1}{9\choose 3} }{22 \choose 4}\]
We calculate \(p\) numerically using the above combinatorial identity on the RHS:
(p = choose(4,1) * choose(9,3) / choose( 22, 4) )
## [1] 0.04593301
This implies the probability is 4.593%.
Evaluate the following expression. \[\frac{11!}{7!}\]
\[\frac{11!}{7!} = \frac{ 11 \cdot 10 \cdot 9 \cdot 8 \cdot 7!}{7!} = 11 * 10 * 9 * 8 = 11 * 10 * 72 = 11 * 720 = 7920 \]
Describe the complement of the given event. 67% of subscribers to a fitness magazine are over the age of 34. ## Solution
33% of subscribers to a fitness magazine are of age 34 or under.
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.)
There are \(2^4 = 16\) equally likely outcomes of 4 coin tosses. 4 of the outcomes give 3 heads and one tail.
This gives the expected value \(X\) of the proposition as:
\[ X = \frac{4}{16}\cdot 97 + \frac{12}{16} \cdot (-30) = \frac{1}{4}(97) + \frac{3}{4}(-30) \]
(X = 0.25 * 97 + 0.75 * -30)
## [1] 1.75
The expected value of the proposition is 1.75.
If we play this game 559 times we expect to win
(Y = 559 * X)
## [1] 978.25
If we play 559 times, we expect to win $978.25 since expected value is additive.
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.
Step 2. If you played this game 994 times how much would you expect to win or lose? (Losses must be entered as negative.)
There are \({n\choose k}\) ways to get \(k\) tails in \(n\) coin tosses.
Therefore, to get 4 or less tails by flipping a coin 9 times we calculate there are \(A\) ways to do this:
\[ A = {9 \choose 0} + {9 \choose 1} + {9 \choose 2} + {9 \choose 3} + {9 \choose 4} \]
(A = choose(9,0) + choose(9,1) + choose(9,2) + choose( 9, 3) + choose(9,4) )
## [1] 256
The expected value Y of the proposition (to you) is:
\[ Y = \frac{A}{2^9} (23) + (1 - \frac{A}{2^9})(-26) \]
(Y = (A/2**9) * 23 + (1 - A/(2**9)) * -26 )
## [1] -1.5
The expected value of the proposition is to lose 1.5 dollars per game. The expected value of playing the game is to lose 1491 on average.
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.
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.
Denote the event of picking a truth-teller as \(T\). Denote the event of picking a liar as \(L\). Denote the result of the polygraph test for a person \(x\) as \(g(x)\) where \(g(x) = \tau\) means detecting a truth teller and \(g(x)=\lambda\) means detecting a liar.
We are told \(P(L) = 0.2\) and therefore \(P(T) = 0.8\). Sensitivity of 0.59 means
\[ P\left[ g(x) = \lambda | x \in L \right] = 0.59 \implies P\left[ (g(x) = \lambda ) \cap ( x \in L ) \right] = 0.59 \cdot 0.2 = 0.118 \]
Since we can decompose the set of liars by their response to the polygraph results as follows, we can solve for the intersection of liars and polygraph true results (i.e. false negatives)
\[ \begin{align} P\left[ x \in L \right] & = & 0.2 \\ & = & P\left[ ( g(x)=\lambda) \cap ( x \in L \right)] + P\left[ (g(x) = \tau) \cap (x \in L \right)] \\ 0.2 & = & 0.59 \cdot 0.2 + P\left[ (g(x) = \tau) \cap (x \in L \right)] \\ 0.2 ( 1-0.59) = 0.082 & = & P\left[ (g(x) = \tau) \cap (x \in L \right)] \\ \end{align} \]
The specificity tells us: \[ P\left[ g(x) = \tau | x \in T \right] = 0.90 \implies P\left[ g(x) = \tau \cap x \in T \right] = 0.90 \cdot .80 = 0.72 \]
Using the specificity of the polygraph we solve for the false positives (i.e. the intersection of truth tellers and polygraph lie results): \[ \begin{align} P\left[ x \in T \right] & = & 0.80 \\ & = & P\left[ ( g(x)=\tau) \cap ( x \in T \right)] + P\left[ (g(x) = \lambda) \cap (x \in T \right)] \\ 0.8 & = & 0.90 \cdot 0.8 + P\left[ (g(x) = \lambda) \cap (x \in T \right)] \\ 0.8 ( 1-0.90) = 0.08 & = & P\left[ (g(x) = \lambda) \cap (x \in T \right)] \\ \end{align} \]
From the derivations above, we solve for the conditional probability below by using the component probabilities of the 4 intersections.
\[ P\left[ x \in L | g(x) = \lambda \right] = \frac{ P\left[ ( x \in L ) \cap (g(x)=\lambda ) \right]}{ P\left[ ( x \in L ) \cap (g(x)=\lambda ) \right] + P\left[ ( x \in T ) \cap (g(x)=\lambda ) \right] } = \frac{ 0.118 }{ 0.118 + 0.08} = \frac{ .118 }{.198 } = .5959 \]
The probability that a person is actually a liar given that the polygraph detected him as such is 59.59%.
\[ P\left[ x \in T | g(x) = \tau \right] = \frac{ P\left[ (x \in T) \cap (g(x) = \tau ) \right]}{ P\left[ g(x) = \tau \right] } = \frac{ P\left[ (x \in T) \cap (g(x) = \tau )\right]}{ P\left[ (g(x) = \tau ) \cap (x \in L) \right] + P\left[ (g(x) = \tau ) \cap (x \in T) \right] } = \frac{ 0.72}{ 0.082 + 0.72} = 0.89776 \]
The probability that a person is a truth-teller given the the polygraph detected him as such is 89.776%.
The probability that a randomly selected person is either a liar or identified as a liar by the polygraph is equivalent to the complement of the set of people for whom the polygraph detected a truth teller and the person was a truth-teller.
Algebraically, the answer is \[ 1 - P\left[ g(x) = \tau \cap x \in T \right] = 1 - .72 = 0.28\]
In other words, the probability is 28%.