---
title: "Math 151 - Probability Theory - Homework 9"
author: "your name here"
date: "Due: Friday, October 23, 2020, midnight PDT"
output: pdf_document
---
## Important Note:
You should work to turn in assignments that are clear, communicative, and concise. Part of what you need to do is not print pages and pages of output. Additionally, you should remove these exact sentences and the information about HW scoring below.
Click on the *Knit to PDF* icon at the top of R Studio to run the R code and create a PDF document simultaneously. [PDF will only work if either (1) you are using R on the network, or (2) you have LaTeX installed on your computer. Lightweight LaTeX installation here: https://yihui.name/tinytex/]
> Either use the college's RStudio server (https://rstudio.pomona.edu/)
or install R and R Studio on to your personal computer.
See: https://research.pomona.edu/johardin/math151f20/ for resources.
```{r warning=FALSE, comment=FALSE, message=FALSE, echo = FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.height=3, fig.width=5,
fig.align = "center")
```
### Assignment
#### 1: PodQ
Describe one thing you learned from someone in your pod this week (it could be: content, logistical help, background material, R information, etc.) 1-3 sentences.
#### 2: 4.1.4
Suppose that one word is to be selected at random from the sentence:
THE GIRL PUT ON HER BEAUTIFUL RED HAT.
If $X$ denotes the number of letters in the word that is selected, what is the value of $E[X]$?
#### 3: 4.3.2
Suppose that one word is selected at random from the sentence
THE GIRL PUT ON HER BEAUTIFUL RED HAT.
If $X$ denotes the number of letters in the word that is selected, what is the value of $Var(X)$?
#### 4: 4.1.3
Suppose that a random variable $X$ has a continuous distribution with the p.d.f.:
$$f_X(x) = \begin{cases} 2x & 0 < x < 1 \\ 0 & \hbox{ otherwise } \end{cases}$$
Find the expectation of $1/X$.
#### 5: 4.3.8
Construct an example of a distribution for which the mean is finite but the variance in infinite. (See if you can find one that is different from your colleagues'!)
#### 6. 4.4.8
Suppose $X$ is a random variable for which the moment generating function (m.g.f.) is:
$$ \psi(t) = e^{t^2 + 3t}, \quad - \infty < t < \infty .$$
Find the mean and the variance of $X$.
#### 7: 4.4.11
Suppose $X$ is a random variable for which the m.g.f. is:
$$ \psi(t) = \frac{1}{5} e^{2t} + \frac{2}{5} e^{4t} + \frac{2}{5}e^{8t} , \quad - \infty < t < \infty .$$
Find the probability distribution of $X$.
*Hint:* it is a simple discrete distribution. Try to come up with a possible pf, if you can come up with it, you are right! Remember that the mgf uniquely determines the pf, so if you can come up with the right pf, you'll know that it is the *only* possible pf.
#### 8. R - evil Cauchy!
Let's investigate the expected value of a Cauchy random variable. Recall, the distribution of $X \sim$ Cauchy is $$f_X(x) = \frac{1}{2 \pi (1+x^2)}, \quad - \infty < x < \infty .$$
a. 4.4.13 (from DeGroot)
Let $X$ have the Cauchy distribution, so the density of $X$ is:
Prove that the m.g.f. of $X$ is finite only for $t = 0$.
b. Using R, generate many many samples (at least thousands). For each sample, generate many many observations (at least thousands).
Empirically estimate the expected value. Find the `mean()` of each sample and plot them in a histogram (you should be plotting many x-bar values); then use the `summary()` command to give a summary of your simulated statistics.
c. Using R, generate many many samples (at least thousands). For each sample, generate many many observations (at least thousands).
Empirically estimate the `var()`iance of the Cauchy. Find the `var()`iance of each sample and plot them in a histogram (you should be plotting many variance values); then use the `summary()` command to give a summary of your simulated statistics.
d. Using R, generate many many samples (at least thousands). For each sample, generate many many observations (at least thousands).
Give the empirical estimate of $E[1/X]$. Find the `mean()` of one over each sample value and plot the averages in a histogram (you should be plotting many average values); then use the `summary()` command to give a summary of your simulated statistics. (Note: you are not estimating 1/$E[X]$.)
e. What does the empirical sampling distribution of the mean (and other statistics) tell you (convince you?) about $E[X]$ being finite?
Hint: you'll need a single `for()` loop (to go through the many samples). And the command `rcauchy()` will generate observations (many of them in a single call to the function) from a Cauchy distribution.