---
title: "A06 Conditional Probability, Random Variables, and Expectation (153 points)"
author: "TYPE YOUR NAME HERE"
date: "TYPE DATE HERE"
format: docx
editor: visual
---

```{r}
#| message: false
#| warning: false
#| echo: false
library(tidyverse)
```

## Instructions

Complete each exercise either in this qmd file or on paper. Include your name as the author and the date completed in the YAML code at the top of this file, and replace the first sentence in the Acknowledgements section as directed. Any parts completed on paper should either (a) be handed to David Housman, (b) placed in SC 117, or (c) scanned into a pdf file. This qmd file should be rendered to an html, docx, or pdf file. Zip together all relevant files: Rproj, qmd, rendered file, any data or image files, and (optionally) the pdf file containing your answers completed on paper. Upload the zip file in Moodle. Points will be taken off if these instructions are not followed.

For each probability computation, show the process used and the answer to four decimal places.

## Acknowledgements

Replace this sentence with either (1) an acknowledgment of any person who gave you assistance and/or any resource that was used, or (2) a statement that you did not use any outside assistance.

By submitting this assignment, the author attests to abiding by the *Collaboration and Academic Integrity* policy stated in the course syllabus.

## Exercise 1 (12 points)

Ledolter exercise 2.2-4. Consider flipping at random two coins, one a nickel and the other a dime, and recording either H or T for each. Assume that the flips are independent

a.  What is the sample space of this random experiment?

b.  What is the probability of getting two heads?

c.  What is the probability of getting exactly one head?

d.  What is the probability of getting at least one head?

## Exercise 2 (14 points)

Ledolter exercise 2.2-6. You are rolling two unbiased dice, one red and one blue, and recording the ordered pair. If the results on the dice are independent, determine exactly the probabilities of the following events:

a.  1 on the red die.

b.  1 on each die.

c.  1 on at least one of the two dice:

d.  the sum of the two values equals 7.

e.  the sum of the two values is an even number.

f.  the number on the blue die is a least as large as the number on the red die.

g.  the numbers on the two dice are equal.

## Exercise 3 (15 points)

Ledolter exercise 2.2-11. A survey organization asked respondents what their views were on the probable future direction of the economy and how they voted for president in the last election. The table shows the fractions of respondents in each classifications.

|                             | Optimistic | Pessimistic | Neutral |
|-----------------------------|:----------:|:-----------:|:-------:|
| Voted for the president     |    0.20    |    0.08     |  0.12   |
| Voted against the president |    0.08    |    0.15     |  0.12   |
| Did not vote                |    0.07    |    0.08     |  0.10   |

a.  What is the probability that a randomly chosen respondent voted for the president?

b.  What is the probability that a randomly chosen respondent is pessimistic about the economy?

c.  What is the conditional probability that a respondent who voted for the president will be pessimistic about the economy?

d.  What is the conditional probability that a respondent who is pessimistic about the economy voted for the president?

e.  Are the views on the economy independent of how respondents voted? Why or why not?

## Exercise 4 (8 points)

Ledolter exercise 2.2-1. A bowl contains 6 red and 4 blue chips. Three chips are drawn at random and without replacement.

a.  Compute the conditional probability that 2 are red and 1 is blue, given that at least 1 red chip is among the three selected.

b.  Compute the conditional probability that all 3 are red, given that at least 2 red chips are among the three selected.

## Exercise 5 (4 points)

Ledolter exercise 2.2-2. A hand of 13 cards is dealt at random and without replacement from an ordinary deck of 52 playing cards. Find the conditional probability that there are at least three aces in the hand, given that there are at least two aces.

## Exercise 6 (8 points)

Modified from Ledolter exercise 2.2-15. Suppose that we wish to determine whether a rare, but very costly, flaw is present (event $F$). Let us assume that $P(F) = 0.001$; thus, $P(F’) = 0.999$. A fairly simple procedure is proposed to test for this flaw. However, the test is preliminary, as the probabilities of reaching the wrong conclusion are large. About 6 percent of the time, the test indicates a flaw ($TF$) when no flaw is present; and about 4 percent of the time, it indicates the absence of a flaw when a flaw is present. That is, $P(TF|F’) = 0.06$, but $P(TF’|F) = 0.04$.

a.  Find the probability that the test indicates a flaw.

b.  Find the posterior probability that there is no flaw, given that the test has indicated a flaw.

## Exercise 7 (4 points)

Ledolter exercise 2.2-18. Thirty percent of the students in a calculus course and 20 percent of students in a statistics course receive A’s. Furthermore, 60 percent of the students with an A in calculus receive an A in the statistics course. John received an A in the statistics course. Calculate the probability that he also received an A in the calculus course.

## Exercise 8 (4 points)

Ledolter exercise 2.2-20. Suppose that 65% of all those who enroll at the University of Iowa finish in six years. What is the probability that five freshmen selected at random will all finish in six years?

## Exercise 9 (8 points)

The following information was correct at one time, but may no longer be correct. The American Cancer Society recommends that women obtain a mammogram annually between ages 45 and 54 and then every two years afterwards. About 1% of these women have breast cancer. A woman with breast cancer will have a positive mammogram 90% of the time. A woman without breast cancer will have a negative mammogram 91% of the time. The following calculations motivated a reduction in the recommended start and frequency of testing.

a.  If a woman tests positive, what is the probability that she has breast cancer?

b.  If a woman does not have breast cancer, what is the probability that she will test positive during at least one of her first ten mammograms?

## Exercise 10 (10 points)

Tversky and his colleagues in *Judgement Under Uncertainty: Heuristics and Biases* (Cambridge: Cambridge University Press, 1982) studied the records of 48 of the Philadelphia 76ers basketball games in the 1980-81 season to see if a player had times when he was hot and every shot went in, and other times when he was cold and barely able to hit the backboard. The players estimated that they were about 25 percent more likely to make a shot after a hit than after a miss. In fact, the opposite was true—the 76ers were 6 percent more likely to score after a miss than after a hit. Tversky reports that the number of hot and cold streaks was about what one would expect by purely random effects. Assuming that a player has a 60% chance of making a shot and takes 20 shots a game, estimate by a computer simulation the proportion of the games in which the player will have a streak of 5 or more hits.(Problem modified from Charles M. Grinstead and J. Laurie Snell, *Introduction to Probability*, American Mathematical Society, 1997, p. 15.)

## Exercise 11 (22 points)

Ledolter exercise 2.3-4. Suppose that the probability density function $f(x)$ of the length $X$ of an international telephone call, rounded up to the next minute, is given by the table.

|        |     |     |     |     |
|:------:|:---:|:---:|:---:|:---:|
|  $x$   |  1  |  2  |  3  |  4  |
| $f(x)$ | 0.2 | 0.5 | 0.2 | 0.1 |

a.  (6 points) Calculate $P(X≤2)$, $P(X<2)$, and $P(X≥1)$.

b.  (4 points) Plot the cumulative distribution function of $X$.

c.  (4 points) Calculate the mean $μ=E(X)$. Show the calculation being performed.

d.  (4 points) Calculate $E[X^2]$, and use the result to determine the variance $σ^2 = E[X^2] - (E[X])^2$. Show the calculations being performed.

e.  (4 points) Use the formula $σ^2 = E[(X-μ)^2]$ to calculate the variance (show the calculation being performed). Observe you should obtain the same answer as in part (d) via this different calculation method.

## Exercise 12 (4 points)

If $E[X] = 3$ and $E[X^2] = 25$, find $E[(X-2)^2]$.

## Exercise 13 (40 points)

Consider the experiment: roll two 4-sided dice simultaneously. Let $X$ be the sum and $Y$ be the minimum.

a.  (10 points) Find the pdf, mean, variance, and standard deviation for $X$.

b.  (7 points) Draw a spike graph or histogram for the pdf of $X$ and mark on the horizontal scale the mean, one standard deviation either side of the mean, two standard deviations either side of the mean and three standard deviations either side of the mean.

c.  (10 points) Find the pdf, mean, variance, and standard deviation for $Y$.

d.  (7 points) Draw a spike graph or histogram for the pdf of $Y$ and mark on the horizontal scale the mean, one standard deviation either side of the mean, two standard deviations either side of the mean and three standard deviations either side of the mean.

e.  (6 points) Compare the distributions of $X$ and $Y$ with the empirical rule by completing the following table.

|                         | empirical | $X$ | $Y$ |
|:-----------------------:|:---------:|:---:|:---:|
| Within 1 sd of the mean |  0.6827   |     |     |
| Within 2 sd of the mean |  0.9545   |     |     |
| Within 3 sd of the mean |  0.9973   |     |     |
