\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()}, {\bf integrate()}etc.  

{\bf 1.}  This problem concerns the Markov inventory model, Sec. 4.6,
but with a little change:  When replenishment occurs, it might not be a
full shipment.  A proportion 0.2 of the time, the store's supplier has a
shortage, and delivers only r/2 new items rather than r.  The function
{\bf inventory()} will be revised accordingly.  Assume that r is an even
number, and that a statement 

\begin{lstlisting}
r2 <- r / 2
\end{lstlisting}

has been inserted between the lines containing calls to {\bf function()}
and {\bf matrix()}.

\begin{itemize}

\item [(a)] (15) The line

\begin{lstlisting}
tm[2,r] <- q
\end{lstlisting}

must be altered.  Show what the new line should be.

\item [(b)] (15) In addition, a new line of code that assigns to some
element of row 2 in {\bf tm} must be inserted.  Show what that new line
should be.  (Don't worry about where it will be inserted, or what
modifications, if any, need to be made concerning other rows.)

\item [(c)] (15) Give a loop-free R expression, using matrix and/or
vector operations, for the long-run average amount of stock.  It will
involve {\bf pivec}, the $\pi$ vector.

\end{itemize}

{\bf 2.}  Consider the counterexample to the statement

\begin{quote}
Cov(X,Y) = 0 $\Rightarrow$ X,Y independent
\end{quote}

starting at the bottom of p.138.

Instead of using the unit disk, we might take various other regions for
our counterexample to the above-displayed statement.  In each case
below, answer either C or NC (no quotation marks necessary)  according
to whether the proposed distribution would indeed provide a
counterexample.

\begin{itemize}

\item [(a)] (5) 
(X,Y) has a uniform distribution on the rectangle with corners at
(-1,-8), (-1,8), (1,-8) and (1,8).

\item [(b)] (5)
(X,Y) has a uniform distribution on the diamond with corners at
(-1,0), (0,-8), (1,0) and (0,8).

\item [(c)] (5)
(X,Y) has a uniform distribution on the ellipse having 
axis intercepts at (-1,0), (0,-8), (1,0) and (0,8).

\end{itemize}

{\bf 3.} (10) Consider the dice correlation example in Sec. 7.2.2.1, but
with a twist:  The blue die is an ordinary, fair die, but the yellow one
is heavily weighted toward the extremes:  1 and 6 have higher
probabilities than 2, 3 and 4.  The probabilities are still symmetric,
so that i has the same probability as 7-i.  The question at hand is, how
would this affect $\rho(X,S)$?  Choose one:

\begin{itemize}

\item [(i)] The correlation would be larger than 0.707.

\item [(ii)] The correlation would be smaller than 0.707.

\item [(iii)] The correlation would still be 0.707.

\item [(iv)] There is not enough information to tell.

\end{itemize}

{\bf 4.} (10) Suppose we model light bulb lifetimes as having a normal
distribution with mean and standard deviation 500 and 50 hours,
respectively.  Give a loop-free R expression for finding the value of d
such that 30\% of all bulbs have lifetime more than d.

{\bf 5.} (10) Say $W = U_1 + ... + U_{50}$, with the $U_i$ being i.i.d. (a
very frequently-used term; see beginning of Sec. 5.5.4.5) with uniform
distributions on (0,1).  Give an R expression for the approximate
value of $P(W < 23.4)$.

{\bf 6.} (10) Figure 5.2 is a nice illustration of the Central Limit
Theorem.  The curves are more and more bell-shaped as r grows (and would
be even more so with still larger r).  But in view of the formal
statement of the CLT, the bell-shaped nature of those curves does not
actually follow from the CLT.  Explain why, in a single short line.

\onecolumn

\newpage

{\bf Solutions:}

{\bf 1.a}

\begin{lstlisting}
tm[2,r] <- 0.8 * q
\end{lstlisting}

{\bf 1.b}

\begin{lstlisting}
tm[2,r2] <- 0.2 * q
\end{lstlisting}

{\bf 1.c}

\begin{lstlisting}
pivec %*% 1:r
\end{lstlisting}

{\bf 2.} NC, C, C

{\bf 3.} Now $Var(Y) > Var(X)$, so $Var(S)$ would increase.  Answer
(ii) is correct.

{\bf 4.}

\begin{lstlisting}
qnorm(1-0.30,500,50)
\end{lstlisting}

{\bf 5.}  W has an approximate normal distribution, with mean $50 \times
0.5$ and variance $50 \times (1/12)$.  So we need 

\begin{lstlisting}
pnorm(23.4,25,sqrt(50/12))
\end{lstlisting}

{\bf 6.}  Theorem 15---the formal statement of the CLT---merely says
that the cdfs converge, not that the densities converge.  In this case,
the densities actually do converge, but in some other situations they do
not.  The cdfs could be very "kinky" so that the densities don't
converge, even though the cdfs do.

\end{document}

