\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: {\bf \Large Work only on this sheet} (on both sides, if
needed).  MAKE SURE TO COPY YOUR ANSWERS TO A SEPARATE SHEET FOR SENDING
ME AN ELECTRONIC COPY LATER.

{\bf Important note:}  Remember that in problems calling for R code, you
are allowed to use any built-in R function, e.g. {\bf choose()}, {\bf
sum()}, etc.  

{\bf 1.} (15)  A class has 68 students, 48 of which are CS majors.  The
68 students will be randomly assigned to groups of 4.  Find the
probability that a random group of 4 has exactly 2 CS majors.

{\bf 2.}  This problem concerns the bus ridership example, Sec. 2.11 in
our book.

\begin{itemize}

\item [(a)] (15) Find $E(L_1)$.

\item [(b)] (15) Find $Var(L_1)$.

\end{itemize}

{\bf 3.}  This problem again concerns the bus ridership example, but
focuses on the simulation, Sec. 2.12.4.  Here we are interested in
finding $E(L_8)$.  

\begin{itemize}

\item [(a)] (10) Where should a line 

\begin{lstlisting}
tot_l2 <- 0
\end{lstlisting}

be placed?  Answer using a half-line number, e.g. 6.5 if you think 
this code should be inserted between lines 6 and 7.

\item [(b)] (15) What code should be inserted at line 12.5?

\item [(c)] (10) Give a print statement to go after line 16, printing the
approximate value of $E(L_8)$

\end{itemize}

{\bf 4.} (10) Say a large research program measures boys' heights at age
10 and age 15.  Call the two heights X and Y.  So, each boy has an X
and a Y.  Each boy is a ``notebook line'', and the notebook has two
columns, for X and Y.  We are interested in Var(Y-X).  Which of the
following is true?  (Answer with a Roman numeral, e.g. (v).)

\begin{itemize}

\item [(i)] $Var(Y-X) = Var(Y) + Var(X)$
\item [(ii)] $Var(Y-X) = Var(Y) - Var(X)$
\item [(iii)] $Var(Y-X) < Var(Y) + Var(X)$
\item [(iv)] $Var(Y-X) < Var(Y) - Var(X)$
\item [(v)] $Var(Y-X) > Var(Y) + Var(X)$
\item [(vi)] $Var(Y-X) > Var(Y) - Var(X)$
\item [(vii)] None of the above.

\end{itemize}

{\bf 5.} (10) Suppose at some public library, patrons return books
exactly 7 days after borrowing them, never early or late.  However, they
are allowed to return their books to another branch, rather than the
branch where they borrowed their books.  In that situation, it takes 9
days for a book to return to its proper library, as opposed to the
normal 7.  Suppose 50\% of patrons return their books to a ``foreign''
library.  Find Var(T), where T is the time, either 7 or 9 days, for a
book to come back to its proper location.  (Hint:  Use the concept of
indicator random variables.)


\onecolumn

\newpage

{\bf Solutions:}

{\bf 1.}

$$
\frac
{\binom{48}{2} ~ \binom{20}{2}} 
{\binom{68}{4}}
$$

{\bf 2.a}

$$
EL_1 = EB_1 = 0 \cdot 0.5 + 1 \cdot 0.4 + 2 \cdot 0.1
$$

{\bf 2.b} First, note that $Var(L_1) = E(L^2_1) - (EL_1)^2$; then
compute $E(L^2_1) = 0^2 \cdot 0.5 + 1^2 \cdot 0.4 + 2^2 \cdot 0.1$.

{\bf 3.a} 3.5 (or earlier)

{\bf 3.b}

\begin{lstlisting}
if(j == 8) tot_l2 <- tot_l2 + passengers
\end{lstlisting}

{\bf 3.c}

\begin{lstlisting}
print(tot_l2 / nreps)
\end{lstlisting}

{\bf 4.}

$$
Var(Y-X) = Var[Y+(-X)] = Var(Y) + Var(-X) + 2Cov(Y,-X) =
Var(Y) + Var(X) - 2Cov(X,Y)
$$

Since X and Y are positively correlated, their covariance is positive,
so the answer is (iii).

{\bf 5.}  $T = 7 + 2 I$, where I is an indicator random variable for the
event that the book is returned to a ``foreign'' branch.  Then

$$
Var(T) = Var(7 + 2I) =  4 Var(I) = 4 \cdot 0.5 (1 - 0.5)
$$

\end{document}

