\documentclass[twocolumn]{article}
% \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}

\setlength\columnsep{25pt}

\usepackage{fancyvrb}
\usepackage{relsize}
\usepackage{hyperref}

\usepackage{listings}
\usepackage{amsmath}

\begin{document}

\lstset{xleftmargin=5mm,framexleftmargin=10mm,basicstyle=\footnotesize}

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

Directions: MAKE SURE TO COPY YOUR ANSWERS TO A SEPARATE SHEET FOR SENDING
ME AN ELECTRONIC COPY LATER.

{\bf 1.} (15) Suppose the random variable $Y$ has density $c t^3$ on the
interval (1,3), 0 elsewhere.  What must be the value of the constant
$c$?

{\bf 2.} (15) Consider the light bulb example, p.139 top.  We keep sampling
bulbs until we get one with lifetime less than 2.8.  Let $N$ denote the
number of bulbs we sample.  Find $Var(N)$.

{\bf 3.} Consider the Markov analysis of the bus ridership problem,
pp.125-126.

\begin{itemize}

\item [(a)] (10) Find $p_{21}$ (the probability of going from state 2 to
state 1).

\item [(b)] (15) Find the long-run proportion of stops at which there
will be exactly one disappointed customer, among those cases in which no
one alights.  Write your answer in terms of the $\pi$ vector, using 
R notation, e.g. \lstinline{pi[12]^3}.

\end{itemize}

{\bf 4.} (15) Recall that the {\it skewness} of a random variable $X$ is
defined to be

\begin{equation}
E[(X-\mu)^3/\sigma^3]
\end{equation}

Using R's {\bf integrate()}, find the skewness of the random variable $X$
in the bottom half of p.138.

{\bf 5.} (15) We found that the mean time between wins in the
3-consecutive-heads game is about 14.1.  Express this mean using
notation P(), E(), Var() and the $T_{ij}$ in Section 6.10.   (In your
electronic file, write the latter quantity as T\_ij.)

{\bf 6.} (15) Suppose we have parametric family of densities called the
{\it nasty} family, with support $(0,\infty)$.  So we should have
functions {\bf dnasty()}, {\bf pnasty()} and so on, but have only been
given {\bf dnasty()}. Say the latter has parameters {\bf x} (a scalar,
not a vector) and {\bf nastyparm}, the parameter indexing the family.
The arguments for {\bf pnasty()} will be {\bf x} and {\bf nastyparm}.
Show R code that constructs {\bf pnasty()} from {\bf dnasty()}.  

\onecolumn

\newpage

{\bf Solutions:}

{\bf 1.} The density must integrate to 1.0, so $c = 1/20$.

{\bf 2.} $N$ has a geometric distribution with $p = (2.8^2-1)/15$.

{\bf 3.a}  We have 2 on the bus, and want the probability of this count
dropping to 1.  Either 2 alight and 1 boards, or 1 alights and 0 board.
So the probability is $0.2^2 \cdot 0.4 + 2(0.2)(0.8)\cdot 0.5$.

{\bf 3.b} $\pi_{20} 0.4 + \pi_{19} 0.1$

{\bf 4.}

\begin{lstlisting}
integrate(function(x) ((x-2.8)/sqrt(0.66))^3 * 2 * x / 15,1,4)
\end{lstlisting}

{\bf 5.} $E(T_{00})$

{\bf 6.} 

\begin{lstlisting}
function pnasty(x,nastyparm) integrate(dnasty,0,x,nastyparm)$value
\end{lstlisting}
\end{document}
