\documentclass{article}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.05in}
\setlength{\columnseprule}{0.3pt}
\usepackage{fancyvrb}
\usepackage{hyperref}

\usepackage{listings,relsize}

\begin{document}

\lstset{language=R,basicstyle=\smaller}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

Directions: {\bf Work only on this sheet} (on both sides, if needed); do not
turn in any supplementary sheets of paper. There is actually plenty of room
for your answers, as long as you organize yourself BEFORE starting writing.

{\bf \Large SHOW YOUR WORK!}  

{\bf 1.} (15) Suppose $f_X(t) = 1/t^2$ on $(1,\infty)$, 0 elsewhere.  Find
$h_X(2.0)$, expressing your answer as a common fraction, reduced to
lowest terms.

{\bf 2.} (10) The book, {\it Last Man Standing}, author D. McDonald writes
the following about the practice of combining many mortgage loans into a
single package sold to investors:  

\begin{quote}
Even if every single [loan] in the [package] had a 30 percent risk of
default, the thinking went, the odds that most of them would default at
once were arguably infinitesimal...What [this argument] missed was the
auto-synchronous relationship of many loans...[If several of them] are
all mortgage for houses sitting next to each other on a beach...one
strong hurricane and the [loan package] would be decimated.
\end{quote}

Fill in the blank with a term from our course:  The author is referring
to an unwarranted assumption of
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

{\bf 3.} (15) In the light bulb example on p.188, suppose the actual
observed value of $\overline{X}$ turns out to be 15.88.  Write R code to
find the p-value.  (If you are not sure of the parameters for some R
function, just assume what they are and explain what you did.)

{\bf 4.} Suppose X and Y are independent geometrically distributed
random variables with success probability p.  Let Z = X/Y.  We are
interested in EZ.

\begin{itemize}

\item [(a)] (20) Due to independence, EZ = (1/p) E(1/Y).  Find an infinite
series expression for E(1/Y).  

\item [(b)] (20) Write a full R function {\bf findez(nreps,p)} that finds EZ by
simulation.  The return value is EZ (which of course is only
approximate).  Extra Credit will be given for the most compact code.

\item [(c)] (20) Find an infinite series expression for $F_Z(m)$ for positive
integer m.  For full credit, there should be only one series.  (Extra
Credit for a series-free expression.)

\end{itemize}

{\bf Solutions:}

{\bf 1.}

\begin{eqnarray}
h_X(2.0) &=& \frac{f_X(2.0)}{1-F_X(2.0)} \\
&=& \frac{f_X(2.0)}{1-\int_{1}^{2.0} f_X(t) ~ dt} \\
&=& (1/4.0) / (1 - 1/2.0) \\
&=& 1/2
\end{eqnarray}

{\bf 2.}  independence

{\bf 3.}  Setting w in Equation (6.65) to 15.88, we need to find what
the 0.05 in that equation would change to.  The R code

\begin{Verbatim}[fontsize=\relsize{-2}]
1 - pgamma(15.88,10,0.001)
\end{Verbatim}

does this.

{\bf 4.a}  Using our mailing tube E, p.35, as usual, together with the
pmf for the geometric family, we have

$$
E(\frac{1}{Y}) = \sum_{i=1}^{\infty} \frac{1}{i} (1-p)^{i-1} p
$$

{\bf 4.b}

\begin{Verbatim}[fontsize=\relsize{-2}]
findez(nreps,p) return(mean(rgeom(nreps,p)/rgeom(nreps,p)))
\end{Verbatim}

{\bf 4.c}

\begin{eqnarray}
F_Z(m) &=& P \left (\frac{X}{Y} \leq m \right ) \\ 
&=& P(X \leq mY) \\ 
&=& \sum_{i=1}^{\infty} P(X = i) ~ P(X \leq mY | X = i) \\
&=& \sum_{i=1}^{\infty} (1-p)^{i-1} p ~ P(Y \geq mi) \\
&=& \sum_{i=1}^{\infty} (1-p)^{i-1} p ~ (1-p)^{mi-1} \\
\end{eqnarray}

This last expression can be simplified:

\begin{eqnarray}
F_Z(m) &=& \sum_{i=1}^{\infty} (1-p)^{i-1} p ~ (1-p)^{mi-1} \\
&=& \frac{p}{(1-p)^2} \sum_{i=1}^{\infty} (1-p)^{(m+1)i} \\
&=& \frac{p}{(1-p)^2} \sum_{i=1}^{\infty} [(1-p)^{m+1}]^i \\
&=& \frac{p}{(1-p)^2} (1-p)^{m+1} \sum_{j=0}^{\infty} [(1-p)^{m+1}]^j \\
&=& \frac{p}{(1-p)^2} (1-p)^{m+1} \frac{1}{1 - (1-p)^{m+1}}  ~~~~ (3.69) \\
&=& p (1-p)^{m-1} \frac{1}{1 - (1-p)^{m+1}}  
\end{eqnarray}

\end{document}

