\documentclass[notitlepage,12pt]{article}
%twocolumn
\usepackage{epsfig}
\usepackage{fullpage,psfrag}
\usepackage{graphicx}
\usepackage{color}
\usepackage{subfigure}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{geometry}
%\usepackage{endfloat}
\usepackage{hyperref}


%\usepackage{loflot}
%\setstretch{0.8}

\textheight 8
in \oddsidemargin 0.03in \textwidth 6.0in
 \topmargin -.25in
\parskip .1in

%\title{Stat 849: Homework Assignment 1\\
%Due: October 8, 2004}
%\author{}
%\date{}
\usepackage{natbib}

%\newcommand{\xv}{\mbox{\boldmath$x$}}
%\newcommand{\uv}{\mbox{\boldmath$u$}}
%\newcommand{\xiv}{\mbox{\boldmath$\xi$}}

\begin{document}
%\pagestyle{empty}

\begin{center}
FALL 2008\\
Stat 849: Homework Assignment 1\\
Due: September 19, 2008 \\
Total points = 70\\
\end{center}

\begin{enumerate}

\item Suppose $Y$ is $\mathcal{N}_n(\mu,
\sigma^2I)$ and suppose $X$ is an $n\times p$ matrix of constants
with rank $p<n$.

\begin{enumerate}
\item Show that $A = X(X'X)^{-1}X'$ and $I-A = I-X(X'X)^{-1}X'$ are
idempotent and find the rank of each.

\item if $\mu$ is a linear combination of columns of $X$, e.g.,
$\mu=Xb$ form some $b$, find $E(Y'AY)$ and $E[Y'(I-A)Y]$, where $A$
is defined in part (a).

\item Find the distributions of $Y'AY/\sigma^2$ and
$Y'(I-A)Y/\sigma^2$.

\item Show that $Y'A'Y$ and $Y'(I-A)Y$ are independent.

\item Find the distribution of
\[\frac{Y'AY/p}{Y'(I-A)Y/(n-p)}.\]
\end{enumerate}

\item Consider the simple linear regression model
\[Y = \beta_0 + \beta_1 X  + \epsilon,\]
where the intercept $\beta_0$ is known.

\begin{enumerate}
\item Find the least squares estimator of $\beta_1$ in this model.

\item Find variance of the estimator that you found in part (a).
How does this compare with the least squares estimator of $\beta_1$
in a model where $\beta_0$ is not known?
\end{enumerate}


\item Let
\begin{eqnarray}
A = \left ( \begin{array}{ccc}
\frac{2}{3} & 0 & \frac{1}{3} \sqrt{2} \\
0 & 1 & 0 \\
\frac{1}{3} \sqrt{2} & 0 & \frac{1}{3} \\
\end{array} \right ).
\end{eqnarray}
\begin{enumerate}
\item Find the rank of $A$.

\item Show that $A$ is idempotent.

\item Show that $I-A$ is idempotent.

\item Show that $A(I-A) = 0$.

\item Find tr($A$).

\item Find the eigenvalues of $A$.


\end{enumerate}

\item Set up the regression matrix X and $\beta$ vector for each
of the following regression models:

\begin{enumerate}
\item $Y_i = \beta_0 + \beta_1 X_{i1} + \beta_2 X_{i1} X_{i2} +
\epsilon_i$, $i = 1, \cdots, 4$.

\item $\log{Y_i} = \beta_0 +  \beta_1 X_{i1} + \beta_2 X_{i2} +
\epsilon_i$, $i = 1, \cdots, 4$.

\item $Y_i = \beta_1 X_{i1} + \beta_2 X_{i2} + \beta_3 X_{i1}^2 +
\epsilon_i$, $i = 1, \cdots, 5$.


\item $\sqrt{Y_i} =  \beta_0 +  \beta_1 X_{i1} + \beta_2 +
\log_{10} X_{i2} + \epsilon_i$, $i = 1, \cdots, 5$.
\end{enumerate}


\item  The data for exercise 1.19 in the book by
 Sen and Srivastava (\texttt{R} package \texttt{SenSrivastava}; data set
 E1.19) provide the price of books versus the number of pages and a
characterization of whether the book is a paperback or a hardcover
book.

\begin{itemize}
\item Provide separate plots of price versus number pages by book type.
Use the same axes for each plot.
\item Provide an overlaid plot of price versus number of pages using
different symbols for the two types of books.
\item Which plot do you think is more effective and why?
\item Would you consider transforming the axes in these plots and,
if so, how? Explain why or why not you would transform.
\item Provide a single ``key graph'' showing the relationship between
 the number of pages and the price on whatever scale you feel is suitable.
 The plot may be a multi-panel plot and may contain smoother lines. Provide
a caption for your plot. Describe why you chose this plot and how
this plot will influence your initial choice of a statistical model
for these data.
\end{itemize}
\textit{Hint:} Here is how you can access these data in \texttt{R}:
\begin{verbatim}
library(SenSrivastava)
data(E1.19)
E1.19
\end{verbatim}
Note that you may not have the \texttt{SenSrivastava} package
already available to you, i.e., error message after the line
\texttt{library(SenSrivastava)}.
 This means that you first have to install this package from
\url{http://cran.r-project.org/src/contrib/Descriptions/SenSrivastava.html.}




\item A large, national grocery retailer tracks productivity  and
costs of its facilities closely. Data were obtained from a single
distribution center for a one-year period. Each data point for each
variable represents one week of activity. The variables included are
the number of cases shipped ($X_1$), the indirect costs of the total
labor hours as percentage $(X_2)$, a qualitative predictor called
holiday that is coded $1$ if the week has a holiday and 0 otherwise
($X_3$), and the total labor hours ($Y$).  These data are available
in the file \texttt{grocery\_retailer} from the course website
\url{http://www.stat.wisc.edu/~st849-1/private/hmw.html}.

\begin{enumerate}
\item Provide various useful plots of these data (scatter plots
etc...).  What information can you gather from these plots?

\item Fit a linear regression model to these data. What are the
estimated coefficients and standard errors of these estimates? How
is the coefficient in front of holiday is interpreted?

\item Investigate the residual plots. How well are the
Gauss-Markov assumptions  satisfied? Comment on anything unusual
you see.

\end{enumerate}

\item A scale has two pans. The measurements given by the scale is the difference between the weights
in pan \# 1 and pan \# 2 plus a random error. Thus, if a weight
$\mu_1$ is put in pan \# 1, a weight $\mu_2$ is put in pan \# 2,
then the measurement is $Y = \mu_1-\mu_2+\epsilon$. Suppose that
$E[\epsilon ]=0$ and $\mbox{Var}(\epsilon) = \sigma^2$, and that in
repeated uses of the scale, observations $Y_i$ are independent.

Suppose that two objects, \#1 and \#2, have weights $\beta_1$ and
$\beta_2$. Measurements are taken as follows:
\begin{enumerate}
\item  Object \#1 is put on pan \#1, nothing on pan \# 2.
\item Object \#2 is put on pan \# 2, nothing on pan \# 1.
\item Object \#1 is put on pan \# 1, object \#2 on pan \#2.
\item Objects \#1 and \#2 both put on pan \# 1.
\end{enumerate}

Answer the following questions based on the above measurements.

\begin{enumerate}
\item Let $\mathbf{Y} = (Y_1, Y_2, Y_3, Y_4)^\prime$ be the vector of observations.
Formulate this as a linear model.

\item Find vectors $\mathbf{c}_1$, $\mathbf{c}_2$ such that $\hat{\beta}_1 = \mathbf{c}_1^\prime \mathbf{Y}$
 and $\hat{\beta}_2 = \mathbf{c}_2^\prime \mathbf{Y}$.

\item Find the covariance matrix of $\hat{\mathbf{\beta}} = (\hat{\beta}_1, \hat{\beta}_2)^\prime$.

\end{enumerate}



\end{enumerate}

\end{document}
