Matt's
Tutorials

Spring 2013
course
navigation

Probability Exam

Statistical Methods for Data Analysis - Spring 2013

Jay Sayre

(See the attached .R script for these answers in R, with notes, or else some functions here might not make total sense)
\(\star\) denotes unfinished problem.

1. (a) A group of 35 people (including Bob and Sue) are randomly divided into two teams in a way that one team has 25 people and the other team has 10 people. What is the probability that Bob and Sue will be on the same team?

In order to find the probability that Bob and Sue will be on the same team, we need to figure out the total number of team permutations and then find the total number of permutations in which they can be together. Then, the number of ways to pick 10 people out of 35 total people for the first group will give us the total number of permutations for group selection, given by \( {35\choose 10}\).
Then, the number of permutations where Bob and Sue will be on the 25 person team is given by removing them for the field of selectable players, and then selecting from the remaining players. This gives us that we can choose 10 players from a group of 33, given by \({33\choose 10}\).
Finally, the number of permutations where Bob and Sue will be on the ten person is given by putting them on the team, and asking how many more choices we have to pick from. In this case, we would need 8 more players to pick out of now only 33 people, given by \({33\choose 8}\).
The probability that Bob and Sue will be put on the same team, is given by the likelihood they will be put together over the total number of group permutations, since both team arrangements are mutually exclusive events. Then our answer is given by \(\frac{{33\choose 10}+{33\choose 8}}{{35\choose 10}}=57.98\%\).
#See attached .R file for more extensive code > (choose(33, 10)+choose(33,8))/choose(35,10)

(b) What is the probability that a random permutation of TALLAHASSEE will have all adjacent A's?

In order to find the probability that a random permutation of TALLAHASSEE contains all adjacent A's, we must first start by finding the total number of permutations. Tallahassee contains 11 letters: 1 T, 3 A's, 2 L's, 1 H, 2 S's, and 2 E's. Then the total number of permutations is given by \({11\choose 3,2,2,2,1,1}=\frac{11!}{3!(2!)^3(1!)^2}\) arrangements. Simplified somewhat, this is \(\frac{11!}{48}=831,600\) total permutations. Then, if instead of using individual A's, we claim that \(A\star=AAA=A^3\), we can treat \(A\star\) like its own letter and then use the choose equation again. Then, we have \({9\choose 1,2,2,2,1,1}={9\choose 2^3}=\frac{9!}{2!^3}=45,360\) combinations with all adjacent A's.
Therefore, our probability that a random permutation of TALLAHASSEE will have all adjacent A's is given by \(\frac{45360}{831600}\), or \(5.4\bar5 \%\).
#R-script > total<-factorial(11)/(factorial(3)*factorial(2)^3) > allas<-factorial(9)/(factorial(2)^3) > allas/total

2. In a congressional race, the incumbent republican \(R\) is running against three Democrats \(D_1, D_2, D_3\) seeking the nomination. Political pundits estimate that \(D_1, D_2, D_3\) have probabilities 0.35, 0.40, and 0.25, respectively, of being nominated. Furthermore, they feel that R's chances of winning the general election over \(D_1\) is 20%, over \(D_2\), 35%; and over \(D_3\), 80%. What is the probability that R will win?

Let R be the event that designates that the incumbent republican wins. Similarly, let \(D_1, D_2, D_3\) be the respective chance that each of the democrats wins the nomination.
Then, the probability that the incumbent wins given whether each democratic candidate is nominated is given by \(P(R)=P(R|D_1)P(D_1)+P(R|D_2)P(D_2)+P(R|D_3)P(D_3)\), where \(P(R|D_i)\) represents the probability of the republican winning given each Democratic candidate nominated. Then, we can plug in a bunch of values into this so we get \(P(R)=(0.2)(0.35)+(0.35)(0.4)+(0.8)(0.25)\). Therefore, the probability that R will win is given by \[P(R)=0.41\]

3. In a trial, a judge is 45% sure that Susan committed a crime. Julie and Robert are two witnesses who know whether Susan is innocent or guilty. However, Robert is Susan's friend and will lie in her favor with probability 0.25 if Susan is guilty. He will tell the truth if she is innocent. Julie is Susan's enemy and will lie with probability 0.75 if she is innocent. She will tell the truth if Susan is guilty. What is the probability that Susan is guilty if Robert and Julie give conflicting testimony?

It is helpful to recall the formula for Bayes' theorem here, which is \(P(B | A) = \frac{P(A|B)P(B)}{P(A|B)P(B)+P(A|B^c)P(B^c)}\). Also, remembering the law of multiplication may be useful here, given by \(P(A |B)=\frac{P(AB)}{P(B)}\).
Then, let B = the probability that Susan is guilty, and A = the probability that Robert and Julie give conflicting testimony. We can use Bayes' theorem to show the overall probability of B given A. We know that \(B = 0.45\) already. However, by the law of total probability, we know that \(B^c=1-B\), so \(B^c=0.55\).
Then first, let's compute \(P(A|B)\), or the probability that Robert and Julie give conflicting testimony given that Susan is guilty. If Susan is guilty, Julie will tell the truth with absolute certainty. However, if Susan is guilty, Robert has a 25% of lying, and therefore, the chance of conflicting testimony is 25%, or \(P(A|B)=0.25\).
Next, we can compute \(P(A|B^c)\), or the probability that Robert and Julie give conflicting testimony given that Susan is innocent. If Susan is innocent, Robert will confirm her innocence with absolute certainty. However since Julie is Susan's enemy, she will give false testimony with probability 0.75. Therefore, if Susan is innocent, Julie has a 75% of lying, and then, the chance of conflicting testimony is 75%, or \(P(A|B^c)=0.75\).
Then, we finally have all the prerequisite bits to plug into Bayes' theorem. So we have \[P(B|A)= \frac{(0.25)(0.45)}{(0.25)(0.45)+(0.75)(0.55)} \]. Evaluating somewhat gives us \[P(B|A)= \frac{0.1125}{0.525} \]. This gives us that the probability that Susan is guilty if Robert and Julie give conflicting testimony is \[P(B|A)=0.214\], or approximately 21.4%.

4. A twelve-sided die is rolled. Let X denote the number of rolls until a 12 is rolled.

(a) Find a formula for \(P(X=n)\) for \(n=1,2,3 \dots\)
Our formula is given by: \[P(X=n)=\Biggl(\frac{11}{12}\Biggr)^{n-1}\Biggl(\frac{1}{12}\Biggr)\], because the chance of getting a 12 on any roll is \(\frac{1}{12}\). Then, since in order for \(X=n\), there must be \(n-1\) prior rolls where a 12 has not come up, at the probability of not getting a 12 each time given by \(P(A^c)=1-P(A)\), or \(P(A^c)=1-\frac{1}{12}\), so \(P(A^c)=\frac{11}{12}\). Then the chance of not getting a 12 on the \(n-1\) rolls before is given by \(\frac{11}{12}\) to the power of \(n-1\), or \((\frac{11}{12})^{n-1}\).
(b) What is \(P(3 < X \leq 7)\)?
A discrete random variable being between a and b is given by \(F(b)-F(a)\). Therefore, in order to determine \(P(3 < X \leq 7)\), we can plug in for \(a\) and \(b\).
After plugging in, we have \(F(7)-F(3)\), or \[\Bigl((\frac{11}{12})^{(6)}(\frac{1}{12})\Bigr)-\Bigl((\frac{11}{12})^{(2)}(\frac{1}{12})\Bigr)\].
Then, simplified somewhat, this is \((\frac{1}{12})(\frac{11}{12})^{(7)}-(\frac{11}{12})^{(3)}\). However, this results in a negative value, which led me to dig into why this might be wrong. It is because we are using a formula \(P(X=n)\) for a specific n, and not a range of n values.
In order to determine the probability of \(P(3 < X \leq 7)\), we can note that \(\{a < X \leq b\}=\{X \leq b\} - \{X \leq a\}\) and \(\{X\leq a\} \subseteq \{X \leq b \}\). Therefore, the probability of \(P(3 < X \leq 7)\) can be written as \(P(a < X \leq b)= P(X \leq b)−P(X \leq a) = F(b) − F(a)\).
Same problem, this really doesn't help.
I'm not sure how well I can justify this, but it seems as if it will give us the correct result. So I'm going to do this. Just to repeat, we have a formula for \(P(X=n)\) for a given \(n\), and we are looking for \(P(3 < X \leq 7)\). Then, since this is a discrete function, we can evaluate \(P(X=n)\) for \(\{4,5,6,7\}\) to determine \(P(3 < X \leq 7)\), where \(n \in \mathbb{N}\). We can compute \(P(3 < X \leq 7)\), then, by \(P(X=4)+P(X=5)+P(X=6)+P(X=7)\).
Therefore, plugging in to \((\frac{11}{12})^{n-1}(\frac{1}{12})\) gives us \(\sum_{i=4}^7(\frac{11}{12})^{n-1}(\frac{1}{12})\). Pulling out a constant leaves us with \((\frac{1}{12})\sum_{i=4}^7(\frac{11}{12})^{n-1}\). We can now evaluate this as \((\frac{1}{12})\)\(\Bigl((\frac{11}{12})^6+(\frac{11}{12})^5+(\frac{11}{12})^4+(\frac{11}{12})^3\Bigr)\). Then, this is given by \(\frac{(11^6)+(11^5)(12)+(11^4)(12^2)+(11^3)(12^3)}{12^7}\), or \(\frac{8112445}{35831808}=0.2264\).
Then, the probability that x is greater than 3 and less than or equal to 7, or \(P(3 < X \leq 7)\), is \(22.64\%\).

5. The amount of time (in years) an angel must wait until she gets her wings is a random variable with the following probability density function.

\[f(x) = \begin{cases}50(x+5)^{-3} &,~x \geq 0 \\0 &,~ otherwise.\end{cases} \]

What is the probability the an angel will have to wait between 5 to 10 years before getting her wings?

Before beginning, it is useful to remember the probability density function for the probability that x is in between a and b. It is given by \(P(a \leq X \leq b)=\int_a^b f(t) dt\). Then, we can plug our equation into this formula to determine the probability that angel will have to wait between 5 to 10 years. This gives us \(P(5 \leq X \leq 10) = \int_5^{10} 50(x+5)^{-3} dx \). Instead of doing the math, let's do it with R instead.
> f <- function(x){ + (50)*((x+5)^(-3)) +} > integrate(f,5,10) > 0.1388889 with absolute error < 1.5e-15
Therefore, 13.9% of the time an angel will take between 5 to 10 years to get her wings.

6. (a) You are given \(P(A\cup B)=0.7\) and \(P(A \cup B^c) = 0.9\). Determine \(P(A)\).

Since A and B are both events in the same sample space, the probability of A or B is given by \(P(A \cup B)=P(A)+P(B)-P(A \cap B)\). Similarly, the probability of A or the complement of B, \(B^c\), is given by \(P(A \cup B^c)=P(A)+P(B^c)-P(A \cap B^c)\).
Then we can add the two together to determine the probability of \(P(A)\). This gives us \((P(A \cup B)+(P(A \cup B^c)=\) \((P(A)+P(B)-P(A \cap B))+\) \((P(A)+P(B^c)-P(A \cap B^c))\). Now we can substitute in for the respective probabilities on the left side, and reorganize the right so: \(0.7+0.9=\) \(2P(A) + P(B) + P(B^c) -P(A \cap B) -P(A \cap B^c)\). Then we can use the law of total probability and complement rule, which states that \(P(A)+P(A^c)=1\). This allows us to simplify further, so we now have \(1.6 = 2P(A) + 1 -(P(A \cap B) + P(A \cap B^c))\). We can now just attempt to simplify \(P(A \cap B) + P(A \cap B^c)\). We know that an intersection is formally defined as \(A \cap B = {x: x \in A \land x \in B}\). Therefore, for \(P(A \cap B)\) we are adding \(x \in A \land x \in B\) to \(P(A \cap B^c)\), or \(x \in A \land x \not \in B\). However, since we know that \(P(B)+P(B^c)=1\), or more formally by complement laws that \(B \cup B^c = U\), denoting the universal subset, \(x \in A \land x \in B\) + \(x \in A \land x \not \in B\) can be simply written as \(x \in A \land x \in U\). Since \(A \subset U\), then this means that \(P(A \cap B) + P(A \cap B^c)=P(A)\). Then, we can rewrite our earlier equation so \(1.6 = 2P(A) + 1 -P(A)\), or \(1.6-1=P(A)\). Therefore, \[P(A)=0.6\]

\(\star\) (b) If \(P(A^c \cap B^c)=P(A \cap B^c) = 0.2\) and \( P(B)=2P(A)\), find \(P(A\cap B)\).

\( A \cap B = \{ x: x \in A \,\land\, x \in B\} \)
\(\land =\) and
Complement rule: \(P(A)+P(A^c)=1\)
\(P(A)=1-P(A^c)\)
\(P(A \cup B)=P(A)+P(B)-P(A \cap B)\)
\(P(A \cup B^c)=P(A)+P(B^c)-P(A \cap B^c)\)

7. Each time a shopper purchases a tube of tooth paste, she chooses either brand A or brand B. Suppose that for each purchase after the first, the probability is \(\frac{1}{3}\) that she will choose the same brand that she chose on her preceding purchase and the probability is \(\frac{2}{3}\) that she will switch brands. If she is equally likely to choose either brand A or brand B on her purchase, what is the probability that both her first and second purchases will be one brand and both her third and fourth purchases will be the other brand?

Let \(P(C)\) denote the probability that a shopper will change brands, and therefore \(P(C^c)\) denotes the probability that said shopper will not. However, \(P(C)\) is not conditional upon the last purchase, and therefore the choice to switch or stay with a brand is independent. The multiplication rule states that for independent events \(P(A \cap B)=P(A)P(B)\). Then, starting with one brand, the probability that both the first and second purchases are one brand and the third and fourth will be the other (denoted U) is given by \(P(U)=P(C^c)P(C)P(C^c)\). Plugging in gives us \(P(U)=\frac{1}{3}\frac{2}{3}\frac{1}{3}\), or \[P(U)=\frac{2}{27}\]
Of course, adding up the chance of event U for both brands A and B gives us the same probability, since it is given by \((\frac{1}{2}\frac{1}{3}\frac{2}{3}\frac{1}{3})\)+\((\frac{1}{2}\frac{1}{3}\frac{2}{3}\frac{1}{3})\)\(=\frac{4}{54}=\frac{2}{27}\).
Therefore the probability that a shopper's first and second purchases will be one brand and her third and fourth purchases will be the other brand is \(\frac{2}{27}\) or approximately \(7.4\%\).

8. An urn contains five balls, two of which are marked $1, two $5 and one $15. A game is played by paying $10, picking two balls and winning the sum of the two numbers. Is this game fair? (A game is fair if the cost of playing the game is the same as the expected value of the game).

It is helpful to begin with the definition of expected value as given by (in the discrete case) \(E(x)=\sum x p(x)\), or the number of times an event occurs multiplied by the probability it will occur for all events in a sample space. Then, if we were only picking one ball, the expected value would be \(E(X)= 1(\frac{2}{5}) + 5(\frac{2}{5})+15(\frac{1}{5})\). This turns out to be an expected value of $5.40. If the game is played with replacement, then every game is an independent event and the expected value of picking two balls is $10.80. However, if the game changes to one where we pick two balls without replacement then this makes things slightly different.
For the second game then, we need to calculate the expected value based on each number that has been picked before. If a one dollar ball has already picked, then we have an expected value of \(1\frac{1}{4}+5\frac{2}{4}+15\frac{1}{4}\) = \(\frac{1}{4}+\frac{10}{4}+\frac{15}{4}\) = \(\frac{13}{2}\). If a 5 dollar ball has already been picked, then we have \(1\frac{2}{4}+5\frac{1}{4}+15\frac{1}{4}\) = \(\frac{2}{4}+\frac{5}{4}+\frac{15}{4}\) = \(\frac{22}{4}\) = \(\frac{11}{2}\). Finally, if the 15 dollar ball has already been picked, we have a value of \(1\frac{1}{2}+5\frac{1}{2}\)=\(\frac{1}{2}+\frac{5}{2}\)=\(\frac{6}{2}=3\). However, since the likelihood that a dollar and 5 dollar ball have been picked are \(\frac{2}{5}\) and \(\frac{2}{5}\) respectively, and the 15 dollar ball as \(\frac{1}{5}\), we can now calculate the expected value for this game as \(E(X)=\) \(\frac{2}{5}\frac{13}{2}+\frac{2}{5}\frac{11}{2}+\frac{1}{5}\frac{6}{2}\) = \(\frac{54}{10}\) = $5.4.
Therefore, the expected value for the overall game is given by \[E(X)=\$5.4+\$5.4=\$10.8\]. This is confirmed by the corollary that \(E(X_1+X_2+...+X_n)=E(X_1)+E(X_2)+...+E(X_n)\). Then, the game is not fair, but is instead biased in the player's favor by .80 cents.

EDIT:

There is another way to solve this. It involves making a plot looking at all the outcomes and probabilities of each. \( \begin{array}{|l|l|l|}\hline x & P(x) & x \dot P(x) \\ \hline 2 & \frac{1}{10} & \frac{2}{10}=.2 \\ 6 & \frac{4}{10} & \frac{24}{10}=2.4 \\ 10 & \frac{1}{10} & \frac{10}{10}=1 \\ 16 & \frac{2}{10} & \frac{32}{10}=3.2 \\ 20 & \frac{2}{10} & \frac{40}{10}=4 \\ \hline \end{array}\)
Since \(E(x)=\sum x p(x)\), \(E(x)=\) \(.2+2.4+1+3.2+4\) \(=10.8\), which mirrors our earlier result. Therefore, for calculating the expected value alone, both approaches come to the same result.

9. Calculate Var(X) in problem 8.

EDIT

By one of the theorems about variance for discrete random variables, we know that \(Var(X)=E(X^2)-[E(X)]^2\).
Therefore, to recall the expected value from the previous problem, we have \(E(X)=\) \(2(\frac{1}{10}) + 6(\frac{4}{10})+10(\frac{1}{10})+\) \(16(\frac{2}{10})+20(\frac{2}{10})\) \(=\frac{108}{10}\). From this, we can compute \([E(X)]^2\) by \((\frac{108}{10})^2\) which is, \(\frac{11664}{100}\) or \(116.64\).
Next, to compute \(E(X^2)\). This is given by \(\sum x^2 p(x)\), which gives us: \(E(X^2)=\) \((2)^2(\frac{1}{10}) + (6)^2(\frac{4}{10})+(10)^2(\frac{1}{10})+\) \((16)^2(\frac{2}{10})+(20)^2(\frac{2}{10})\). Simplified, this is \(4(\frac{1}{10}) + 36(\frac{4}{10})+100(\frac{1}{10})+\) \(256(\frac{2}{10})+400(\frac{2}{10})\)\(=\frac{1560}{10}\), so \(E(X^2)=156\).
Then, Var(X) is given by \(156-116.64=39.36\), so \[Var(X)=39.36\]

10. The time (in years) until failure of a component in a complex electrical machine is a random variable X with probability density function:

\[f(x) = \begin{cases}(6/125)x(5-x) &,0 < x< 5 \\0 &,~ otherwise.\end{cases} \]

Calculate the average time until failure.

Since the amount of time until failure of this machine most likely happens at an unknown point in time rather than at a discrete value, we can state that the time in years until failure is a continuous random variable. To recall the definition of expected value for continous random variables, we have: \(E(X)=\mu=\int_{-\infty}^{\infty} xf(x)dx \).
Then we can plug in our equation to find the expected value for the lifetime of the machine (in years). Therefore, this gives us \(E(X)=\int_0^5 (6/125)x^2(5-x) dx\). This will be easier to evaluate if we both pull out a constant and multiply through by \(x^2\), so let's do so. \(\frac{6}{125} \int_0^5 5x^2 dx - \int_0^5 x^3 dx\). Integrated, we now have \(\frac{6}{125}\bigl[\frac{5x^3}{3}-\frac{x^4}{4}\bigr]_0^5\). Evaluated (and skipping some of the easy computational stuff) this gives us \(\frac{6}{125}\frac{625}{12}\)=\(\frac{5}{2}\). Therefore, the average time until failure of the machine is 2.5 years.
> f <- function(x){ + (6/125)*(x)*(5-x) +} > f2 <- function(x){x*f(x)} > integrate(f2,0,5)

11. Calculate Var(X) in problem 10.

For continuous random variables, we know that Var(X) is given by \(Var(X)=E[(X-\mu)^2]=\int_{-\infty}^{\infty} (x-\mu)^2 f(x)dx\).
This doesn't help us much in trying to calculate Var(X) for problem 10. However, we can use the analogous theorem we used for problem 8, which states, \(Var(X)=E(X^2)-[E(X)]^2\).
First, we can compute \([E(X)]^2\) pretty easily. This is given by \((\frac{5}{2})^2\), which is \(\frac{25}{4}\).
Figuring out \(E(X^2)\) is slightly more difficult. It is \(E(X^2)=\int_0^5 (6/125)x^3(5-x) dx\). Then we can, as before, pull out a constant and multiply through by \(x^3\). This gives us \(\frac{6}{125} \int_0^5 5x^3 dx - \int_0^5 x^4 dx\). Integrated, we now have \(\frac{6}{125}\bigl[\frac{5x^4}{4}-\frac{x^5}{5}\bigr]_0^5\). Evaluated, this leaves us with \(\frac{6}{125}\frac{625}{4}\)=\(\frac{15}{2}\), or 7.5.
Then, we can plug in for our formula for Var(X), which gives us \(Var(X)=\frac{15}{2}-\frac{25}{4}\) \(=\frac{30}{4}-\frac{25}{4}=\frac{5}{4}\), or \[Var(X)=1.25\]
#R-Script for solution (see attached for better version) > f <- function(x){(6/125)*(x*x)*(5-x)} > f2 <- function(x){x*f(x)} > exp <- integrate(f,0,5) > xs <- integrate(f2, 0, 5) > esq <- as.numeric(exp[1]) > xsq <- as.numeric(xs[1]) > var <- xsq - esq^2 > var > [1] 1.25

12. Cyrus and 27 other students are taking a course in probability this semester. If their professor chooses eight students at random and with replacement to ask them eight questions, what is the probability that Cyrus is one of them?

For just one question, the chance of Cyrus being called is \(\frac{1}{28}\). By the complement rule we know \(P(A)=1-P(A')\), so the chance of her not being called is \(\frac{27}{28}\) if P(A) designates the Cyrus being called upon. Since the students chosen to answer each question are chosen randomly and with replacement, for each question each the chance of a given student being called is independent. Then, for each question Cyrus has a \(\frac{27}{28}\) chance that she will not be called upon. Then, the probability of her not being chosen 8 times is given by \((\frac{27}{28})^8\). Then, we can let the probability that Cyrus is called upon at least once be given by \(P(A)\). Then, through the complement rule again, \(P(A)=1-(\frac{27}{28})^8\). Evaluated, this gives us \(P(A)=1-0.74756\), or \(P(A)=0.25244\).
Then, the probability that Cyrus is called at least once is 25.24%.
http://cs.marlboro.edu/ courses/ spring2013/matts_tutorials/ wiki/ Probability_Exam
last modified Wednesday May 15 2013 9:31 am EDT

attachments [paper clip]

     name last modified size
   JaySayreprobabilityexam.R May 15 2013 9:31 am 2.39kB [IMG]question7.jpg May 10 2013 10:22 pm 20.7kB