\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}

\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
pnorm()}, etc.  

Note too the R function {\bf integrate()}, e.g.

\begin{lstlisting}
> integrate(function(x) x^2,0,1)
0.3333333 with absolute error < 3.7e-15
\end{lstlisting}

The limits of integration must be numbers or Inf or -Inf, not symbols.
Thus one cannot use it for the inner integral in a double integral.

{\bf 1.} Say X and Y have means 1 and 2, with variances 4 and 8, and
with covariance -1.  Find the following:

\begin{itemize}

\item [(a)] (20) Var(X+Y)

\item [(b)] (20) $\rho(X+Y)$

\item [(c)] (15) Cov(X,X+Y) 

\end{itemize}

{\bf 2.} Find the cdf values:


\begin{itemize}

\item [(a)] (15) In the marbles problem, pp.156-158, find $F_{Y,B}(1,1)$.

\item [(b)] (20) In the example in Sec. 8.2.3, find $F_{X,Y}(0.5,0.2)$.

\end{itemize}

{\bf 3.} (10) In Sec. 7.3.5, find Var(X - 2Y + Z), using matrix methods.
Note:  Recall that in R, matrix multiplication is done via
\lstinline{%*%}, and that matrix storage is in column-major order, e.g.

\begin{lstlisting}[numbers=left]
> m <- matrix(c(5,12,13,3,4,5),ncol=2)
> m
     [,1] [,2]
[1,]    5    3
[2,]   12    4
[3,]   13    5
\end{lstlisting}

\onecolumn

{\bf Solutions:}

{\bf 1.a}

\begin{equation}
Var(X+Y) = Var(X) + Var(Y) + 2 Cov(X,Y) = 4 + 8 - 2 = 10 
\end{equation}

{\bf 1.b}

\begin{equation}
\frac{-1}
{ \sqrt{4} \sqrt{8} }
\end{equation}

{\bf 1.c}

\begin{equation}
Cov(X,X+Y) = Cov(X,X) + Cov(X,Y) = 4 - 1 = 3.
\end{equation}

{\bf 2.a} 0.002 + 0.024 + 0.162 + 0.073

{\bf 2.b} 

\begin{equation}
\int_{0}^{0.2} \int_{0}^{s} 8st ~ dt ~ ds +
\int_{0.2}^{0.5} \int_{0}^{0.2} 8st ~ dt ~ ds
\end{equation}

{\bf 3.}

\begin{lstlisting}[numbers=left]
50 * c(1,-2,1) %*% matrix(c(5/36,-1/1,-1/12,-1/18,2/9,-1/6,-1/12,-1/6,1/4) %*% c(1,-2,1)
\end{lstlisting}

\end{document}

