Data 605 HW 6
library(knitr)
library(rmdformats)
## Global options
options(max.print="31")
opts_chunk$set(echo=FALSE,
cache=TRUE,
prompt=FALSE,
tidy=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
opts_knit$set(width=31)Q1.
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: P(red or blue) = \(\frac{54 +75}{54+0+138}\)
\[ \begin{multline*} \begin{split} &= \frac{129}{138} \\ &= \frac{43}{46} \\ &\cong .9348 \end{split} \end{multline*} \]
Q2.
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: P (red) = \(\frac{20}{19+20+24+17}\)
\[ \begin{multline*} \begin{split} &= \frac{20}{80} \\ &= \frac{1}{4} \\ \end{split} \end{multline*} \]
Q3.
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.
| 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.
Ans: P(not(male) \(\cup\) not(with parent(s))) = 1 - P(male \(\cap\) with parent(s))
\[ \begin{multline*} \begin{split} & =1 - \frac{215}{81+116+215+130+129+228+79+252+97+72} \\ &= \frac{1184}{1399} \\ &\cong .8463 \end{split} \end{multline*} \]
Q4.
Determine if the following events are independent.
Going to the gym. Losing weight.
Ans: A - Dependent. While there must be a more stringent way to prove there is a causal relationship between the 2 events, namely, i) going to the gym, and ii) losing weight. That is, correlation, time order, and ruling out of alternative explanations. But definitely, needless to substantially prove, the 2 events are correlated. In that sense, they are dependent to each other.
Q5.
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: Let the number of combinations for choosing 3 vegetables be \(C_{1}\), which is nothing but \(\binom{8}{3} = C_{3}^{8}\) ,
the number of combinations for choosing 3 condiments be \(C_{2}\), which is nothing but \(\binom{7}{3} = C_{3}^{7}\),
and the number of combinations for choosing 1 tortilla be \(C_{3}\), which is nothing but \(\binom{3}{1} = C_{1}^{3}\)
So the total number of different veggie wraps is: \(C_{1}*C_{2}*C_{3} = C_{3}^{8} * C_{3}^{7} * C_{1}^{3}\)
\[ \begin{multline*} \begin{split} & = \frac{8!}{3!(8-3)!} \times \frac{7!}{3!(7-3)!} \times \frac{3!}{1!(3-1)!} \\ &= 56 \times 35 \times 3 \\ &= 5880 \end{split} \end{multline*} \]
Q6.
Determine if the following events are independent.
Jeff runs out of gas on the way to work. Liz watches the evening news.
Ans: B - Independent. There is no correlations between the 2 events.
Q7.
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: Given that the rank matters in the calculation of the all possible ways the cabinet can be formed, we’re going to have to use permutation to compute the answer.
The number of different ways to appoint the members of the cabinet is: \(P_{8}^{14} = \frac{14!}{(14-8)!} =\) 121,080,960
Q8.
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: The probability of withdrawing 4 jellybeans and of which there are 0 R, 1 O, 3 G is
\[ \begin{multline*} \begin{split} \frac{C_{0}^{9} * C_{1}^{4} * C_{3}^{9}}{C_{4}^{22}} \\ &= \frac{1\times \frac{4!}{1!(4-1)!}\times \frac{9!}{3!(9-3)!}}{\frac{22!}{4!(22-4)!}} \\ &= \frac{48}{1045}\\ & \cong 0.0459 \end{split} \end{multline*} \]
Q9.
Evaluate the following expression.
\(\frac{11!}{7!}\)
Ans: \(\frac{11!}{7!}=11\times10\times9\times8=7920\)
Q10.
Describe the complement of the given event.
67% of subscribers to a fitness magazine are over the age of 34.
Ans: By definition, the complement of A is equal to all possible outcomes minus the given event. The complement of the given event is just 33% of subscribers to a fitness magazine are lower or equal to the age of 34.
Q11.
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.
11.1
Ans:
P(success or win) = \(\frac{C_{3}^{4}}{2^4}=\frac{4}{16}=\frac{1}4{}\)
Expected value of the proposition = \(\frac{1}{4}\times 97+ (1-\frac{1}{4})\times (-30) = \$1.75\).
11.2
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: My expected winnings after (N=) 559 games is: N x p = 559 x 1.75 = $ 978.25.
Q12.
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.
12.1
Ans: P(win) = \(\frac{C_{4}^{9}+C_{3}^{9}+C_{2}^{9}+C_{1}^{9}+C_{0}^{9}}{2^9}=\frac{256}{512} = \frac{1}{2}\)
Thus the expected value of the proposition is \(0.5 \times 23 + 0.5\times (-26)=-\$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.)
12.2
Ans: My expected winnings after 994 games is: \(-\$ 1.5 \times 994 = -\$1,491\). A negative number here means I will incur a loss.
Q13.
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.
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.)
13.a
This is how our 2x2 contingency table looks like right now.
| Response\Outcome | Liar | Truth Teller | Total |
| Liar detected | TP | FP | TP + FP |
| Truth Teller detected | FN | TN | FN + TN |
| Total | TP + FN = .20 | FP + TN = .80 | 1.00 |
As we can plug in the known info., we get
\[ \begin{multline*} \begin{split} Sensitivy = \frac{TP}{TP + FN} \\ 0.59 & = \frac{TP}{.20} \\ TP & = .118 \\ Specificity = \frac{TN}{TN + FP} \\ 0.90 & = \frac{TN}{.80} \\ TN & = .72 \end{split} \end{multline*} \]
Our final response\outcome table becomes the following.
| Response\Outcome | Liar | Truth Teller | Total |
| Liar detected | TP = 0.118 | FP = .08 | TP + FP = .198 |
| Truth Teller detected | FN = .082 | TN = .72 | FN + TN = .802 |
| Total | TP + FN = .20 | FP + TN = .80 | 1.00 |
Ans: P (liar | liar detected) = \(\frac{P (liar \space \cap \space liar\space detected)}{P(liar \space detected)}\)
\[ \begin{multline*} \begin{split} & = \frac{.118}{.198} \\ & \cong 0.60 \\ \end{split} \end{multline*} \]
13.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: P (truth teller | truth teller detected) = \(\frac{P (truth \space teller \space \cap \space truth \space teller\space detected)}{P(truth \space teller \space detected)}\)
\[ \begin{multline*} \begin{split} & = \frac{.72}{.802} \\ & \cong 0.90 \\ \end{split} \end{multline*} \]
13.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 \cup liar \space detected) = P(liar) + P(liar \space detected) -P(liar \space \cap \space liar \space detected)\)
\[ \begin{multline*} \begin{split} & = .20 + .198 - .118 \\ & = .28 \\ \end{split} \end{multline*} \]