\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) State why the following code doesn't work. (Do NOT state how
to fix it.)

\begin{lstlisting}
integrate(function(x) x^2,1,4) + 
integrate(function(x) x,4,5)
\end{lstlisting}

{\bf 2.} Consider the example in Sec.\ 12.2.1.  
Find the following:

\begin{itemize}

\item [(a)] (15) $F_{\overline{X}}(70.1)$

\item [(b)] (15) $EX_2$

\item [(c)] (15) In this part only, suppose we sample without replacement.
Find $Cov(X_1,X_2)$.

\end{itemize}

{\bf 3.} Again consider Sec.\ 12.2.1 (sampling with replacement), in our
``notebook'' context, with $n = 100$
We have columns for $X_1, X_2,...,X_{100}, \overline{X}, s^2,
\overline{X} - 1.5 s/\sqrt{100}, \overline{X} + 1.5 s/\sqrt{100}$. (Here
$s$ is as in (12.23).  Find the following:

\begin{itemize}

\item [(a)] (10) The long-run average value in the $\overline{X}$ column.

\item [(b)] (10) The long-run average value in the $s^2$ column.

\item [(c)] (10) The long-run proportion of notebook lines for which the
population mean is between the values in the last two columns.

\end{itemize}

{\bf 4.} (10) Consider the code on pp.227-228, but with {\bf rexp(1,0,1}
in line 4 replaced by {\bf runif(1,0,1)}.  Give the approximate value
of the output in line 12.

\onecolumn
\newpage

{\bf Solutions:}

{\bf 1.}  We are trying to add two objects of class {\bf 'integrate()},
rather than add two numbers.

{\bf 2.a}

$$
\frac{1}{9} +
\frac{2}{9} +
\frac{1}{9} =
\frac{4}{9} 
$$

{\bf 2.b}  $EX_i = \mu = (69+70+72) / 3$

{\bf 2.c}

$$
Cov(X_1,X_2) = E(X_1 X_2) - EX_1 ~ EX_2 = E(X_1 X_2) - \mu^2
$$

$$
E(X_1 X_2) = (69 \cdot 70 + 69 \cdot 72 + 70 \cdot 72) / 3
$$

{\bf 3.a} $\mu$

{\bf 3.b} 

$$
E(s^2) = \frac{99}{100} \sigma^2
$$

$$
\sigma^2 = E(X^2) - (EX)^2 = (69^2+70^2+72^2)/3 - \mu^2
$$

{\bf 3.c}  This is a confidence interval, for which we are being asked
to find the confidence level.  This is

\begin{lstlisting}
1 - 2 * pnorm(-1.5)
\end{lstlisting}

(The original version had $\sqrt{2}$ rather than $\sqrt{100}$.  The
problem was not graded.

{\bf 4.} Use (9.42).  Here $EX = 0.5$ and $f_X(t) = 1$.  So,
$f_Y(t) = 2t$.  Then 

$$
EY = \int_{0}^{1} t\cdot 2t ~ dt = \frac{2}{3}
$$

So the mean length of the interval we arrive within is 2/3, and the mean
time to the next/last bus is 1/3.

\end{document}

