## Exercises - Random Variables

1. Classify the following random variables as discrete or continuous:

1. The number of people currently diagnosed with cancer in the U.S.
2. The weight of all of the money stored at a local bank
3. The height of a bean plant
4. The number of cars on the road that have been in two accidents
5. The time required to fly from Cincinatti to Atlanta
6. The total amount (in ounces) of milk your family consumed last month
7. The number of hunting licenses purchased in the past year
8. The number of movies currently playing in Georgia theaters
9. The running time (minus ads) of a randomly selected TV show
10. The cost of making a randomly selected recipe from a cookbook

a,d,g, and h are discrete, while the rest are continuous

2. Determine which of the following represent valid probability mass functions. For those that do, find the expected value and standard deviation of the associated random variable. For those that don't, explain why.

1. $\displaystyle{ \begin{array}{c|c} x & P(x)\\\hline 0 & 0.125\\ 1 & 0.375\\ 2 & 0.375\\ 3 & 0.125 \end{array} }$

2. $\displaystyle{ \begin{array}{c|c} x & P(x)\\\hline 0 & 0.22\\ 1 & 0.16\\ 2 & 0.21\\ 3 & 0.16 \end{array} }$

3. A function $\displaystyle{P(x) = \frac{x^2}{14}}$, for $x = 0,1,2,3$.

4. A function $\displaystyle{P(x) = \frac{x-1}{5}}$, for $x = 0,1,2,3,4$.

1. Yes, this represents a valid probability mass function, with $E(X) = 1.5$ and $SD(X) \doteq .8660$.

R:
X.outcomes = c(0,1,2,3)
X.probabilities = c(0.125,0.375,0.375,0.125)
X.exp = sum(X.outcomes * X.probabilities)
X.var = sum(X.outcomes^2 * X.probabilities) - X.exp^2
X.sd = sqrt(X.var)
X.exp
X.sd

2. No, this does not represent a valid probability mass function as the sum of the probabilities is $0.75 \neq 1$

3. Yes, this represents a valid probability mass function, with $E(X) \doteq 2.5714$ and $SD(X) \doteq 0.6227$.

R:
X.outcomes = c(0,1,2,3)
X.probabilities = X.outcomes^2/14.0
X.exp = sum(X.outcomes * X.probabilities)
X.var = sum((X.outcomes^2) * X.probabilities) - X.exp^2
X.sd = sqrt(X.var)
X.exp
X.sd

4. No, this does not represent a valid probability mass function as $P(0) \lt 0$.

3. Given the probability mass function below, find the indicated probabilities. (Hint: finding probabilities of complements sometimes helps make simpler calculations.)

$\displaystyle{ \begin{array}{c|c} x & P(x)\\\hline 0 & 0.015625\\ 1 & 0.09375\\ 2 & 0.234375\\ 3 & 0.3125\\ 4 & 0.234375\\ 5 & 0.09375\\ 6 & 0.015625\\ \end{array} }$

1. $P(x \ge 1)$
2. $P(2 \lt x \lt 5)$
3. $P(x \lt 5)$

1. $P(x \ge 1)$ = 1 - P(0) = 0.984375

2. $P(2 \lt x \lt 5) = P(3) + P(4) = 0.546875$

3. $P(x \lt 5)$ = 1 - (P(6) + P(5)) = 0.890625$4. There is a 0.9986 probability that a randomly selected 30 years old US citizen will live throughout the year. An insurance company charges$\$161$ for insuring the male will live through the year, with a $\$100,000$payout if he dies during this time. What is the expected value of this policy to the insurance company? About$\$21$.

We find $E(X)$ for random variable $X$ with probability mass function:

$$\begin{array}{c|c|c} & \textrm{lives} & \textrm{dies}\\\hline x & 161 & -99839\\\hline P(x) & 0.9986 & 0.0014\\ \end{array}$$ $$E(x) = (161)(0.9986) + (-99839)(0.0014) = 21$$

5. The American version of roulette involves a wheel with 38 equal-sized slots. numbered 0 through 36 and one numbered with a double-zero (00). The wheel is spun and a small ball is dropped into it, with the ball eventually coming to rest in one of these 38 slots. Bets are made with regard to where the ball might land. Determine which is a better bet -- betting $\$5$to win$\$180$ if the ball lands on the slot numbered 13, or betting $\$5$to win$\$35$ if the ball lands in a slot numbered either $0$, $00$, $1$, $2$, or $3$ -- by finding the expected values of the associated random variables. (Note, in both cases you don't get back the $\$5$you initially spend -- this is the cost to play the game!) Betting on just 13 yields an expected return of approximately$-\$0.26$, while betting on $0$ or $00$ or $1$ or $2$ or $3$ yields an expected return of $-\$0.39$. Thus, the former bet is the better one (but you will likely lose on both). 6. Is it possible to label the sides of two dice with values whereby when the dice are rolled the totals are uniformly distributed? That is to say, can one make the probabilities of rolling a$1,2,3,\ldots,12$with two dice all equally likely? Yes! One way (found just by experimenting with different values) is to label one die with$1,2,3,4,5,6$and the other with$0,0,0,6,6,6$. 7. When a coin is tossed repeatedly, the sequence of heads and tails can be broken up into "runs" where in any one run all of the flips are heads or all of the flips are tails, with the side of the coin involved (i.e., heads or tails) alternating between successive runs. As an example, the sequence shown on the left breaks into the 5 runs shown on the right below: $$HHHTTTTHTHH \quad \rightarrow \quad HHH \mid TTTT \mid H \mid T \mid HH$$ If a coin is tossed$n$times, what is the expected number of runs? Let$R$be the random variable corresponding to the number of runs. We then seek$E(R)$. Let$B$be the random variable corresponding to the number of breaks between runs. For any one sequence, we clearly have$R = B + 1$, and thus$E(R) = E(B) + 1$. As such, we turn our attention to$E(B)$. For any two successive tosses, a break occurs with probability$1/2$. To see this, think about the sample space$\{HH,HT,TH,TT\}$-- only the middle two correspond to a break. There are$n-1$such pairs, so$E(B) = (n-1)/2\$.

Consequently: $$E(R) = \frac{n-1}{2} + 1 = \frac{n+1}{2}$$