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

\usepackage{amsmath}

\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 1.}  X be the number of dots we get in rolling a three-sided
die once.  (It's cylindrical in shape.)  The die is weighted so that the
probabilities of one, two and three dots are 1/2, 1/3 and 1/6,
respectively.  Note:  Express all answers in this problem as common
fractions, reduced to lowest terms, such as 2/3 and 9/7.

   \begin{itemize}

   \item [(a)] (10) State the value of $p_X(2)$.

   \item [(b)] (10) Find EX and Var(X).

   \item [(c)] (15) Suppose you win \$2 for each dot.  Find EW, where W is the
   amount you win.

   \end{itemize}

{\bf 2.} This problem concerns the {\bf REVISED} version of the
committee/gender example.  

   \begin{itemize}

   \item [(a)] (10) Find $E(D^2)$.  Express your answer as an {\it
unsimpilfied} expression involving combinatorial quantities such as
$\binom{168}{28}$.

   \item [(b)] (15) Find $P(G_1 = G_2 = 1)$.  Express your answer as a
   common fraction.

   \end{itemize}

{\bf 3.} (15) State the (approximate) return value for the function below, in
terms of w.  {\bf You must cite an equation number in the book to get
full credit.}

\begin{lstlisting}[numbers=left]
xsim <- function(nreps,w) {
   sumn <- 0
   for (i in 1:nreps) {
      n <- 0
      while (TRUE) {
         n <- n + 1
         u <- runif(1)
         if (u < w) break
      }
      sumn <- sumn + n
   }
   return(sumn/nreps)
}
\end{lstlisting}

{\bf 4.} (15) Consider the parking space example on p.48.  (NOT the
variant in the homework.)  Let N denote the number of empty spaces in
the first block.  State the value of Var(N), expressed as a common
fraction. 

{\bf 5.} (10) Suppose X and Y are independent, with variances 1 and 2,
respectively.  Find the value of c that minimizes Var[cX + (1-c)Y].

{\bf Solutions:}

{\bf 1.a} 1/3

{\bf 1.b} 

\begin{equation*}
EX = 1 \cdot (1/2) + 2 \cdot (1/3) + 3 \cdot (1/6) = 5/3
\end{equation*}

\begin{eqnarray*}
Var(X) &=& E(X^2) - (EX)^2 \\ 
&=& 
1^2 \cdot (1/2) + 2^2 \cdot (1/3) + 3^2 \cdot (1/6) - 25/9  \\
&=& 5/9
\end{eqnarray*}

{\bf 1.c} EW = E(2X) = 2 EX = 10/3

{\bf 2.a} 

\begin{equation*}
E(D^2) = (-2)^2 
\frac
{\binom{6}{1} \binom{3}{3}}
{\binom{9}{4}} + ...
\end{equation*}

{\bf 2.b}

\begin{eqnarray*}
P(G_1 = G_2 = 1) 
&=& P(G_1 = 1) P(G_2 = 1 | G_1 = 1) \\
&=& \frac{6}{9} \cdot 
\frac{5}{8} \\
&=& \frac{5}{12}
\end{eqnarray*}

{\bf 3.} 1/w, by (3.74)

{\bf 4.} 10(0.2)(1-0.2) = 8/5, by (3.82)

{\bf 5.}

\begin{eqnarray*}
0 &=& \frac{d}{dc} Var[cX+(1-c)Y] \\
  &=& \frac{d}{dc} \left [ c^2 Var(X) + (1-c)^2 Var(Y) \right ] \\
  &=& \frac{d}{dc} [c^2 + 2(1-c)^2] \\
  &=& 2c -4(1-c) 
\end{eqnarray*}

So, the best c is 2/3.

\end{document}

