\documentclass[11pt]{article}

\author{Jeremy Morris}
\title{Exam 1 Answers}

\usepackage{longtable,amssymb,amsmath,amsfonts}
%\usepackage{times}
%\usepackage[T1]{fontenc}
\usepackage[dvips]{graphicx}
\addtolength{\hoffset}{-1.05cm}
\addtolength{\textwidth}{2.5cm}
\addtolength{\textheight}{2.5cm}

\begin{document}
\maketitle

\noindent\textbf{\Large Exercises 6b}
\begin{enumerate}
\setcounter{enumi}{1}
\item \textit{Given the model $Y_{i} = \beta_{1}x_{i} + \varepsilon_{i}$ where $\varepsilon_{i} \sim N(0,\sigma^{2}w_{i}^{-1})$ show how to predict $x_{0}$ for a given value of $Y_{0}$.  Describe a method for constructing a confidence interval for $x_{0}$.}

Prediction of $x_{0}$ can be done using the equation $\tilde{x} = Y_{0}/\tilde{\beta_{1}}$ where
\[\tilde{\beta_{1}} = \frac{\sum w_{i}Y_{i}(x_{i} - \bar{x}_{w})}{\sum w_{i}(x_{i} - \bar{x}_{w})^{2}}\]
\[\bar{x}_{w} = \frac{\sum w_{i}x_{i}}{\sum w_{i}} \]

A confidence interval for $x_{0}$ can be found by using the roots of
\[ x^{2}\left(\tilde{\beta}_{1}^{2} - \frac{\lambda^{2}S^{2}}{\sum x_{i}^{2}}\right) - 2x\tilde{\beta}_{1}Y_{0} + Y_{0}^{2} - \lambda^{2}S^{2} = 0\]
where we take
\[S^{2} = \frac{1}{n-1}\left\{\sum w_{i}Y_{i}^{2} - \tilde{\beta_{1}}^{2}\sum w_{i}x_{i}^{2}\right\}\]

\item \textit{Given the regression line \[Y_{i} = \beta_{0} + \beta_{1}x_{i} + \varepsilon_{i}\] where the $\varepsilon_{i}$ are independent with $E[\varepsilon_{i}] = 0$ and $var(\varepsilon_{i}) = \sigma^{2}x_{i}^{2}$, show that weighted least squares estimation is equivalent to ordinary least squares estimation fo the model \[\frac{Y_{i}}{x_{i}} = \beta_{1} + \frac{\beta_{0}}{x_{i}} + \delta_{i}\]}

The main idea is to use the weighted least squares method and set $w_{i} = x_{i}^{-2}$.  Then we have
\[ \sum_{i=1}^{n} x_{i}^{-2}\left(Y_{i} - \beta_{0} - \beta_{1}x_{i}\right)^{2} = \min{} \]
This can be rewritten as
\[ \sum_{i=1}^{n} \left(\frac{Y_{i} - \beta_{0} - \beta_{1}x_{i}}{x_{i}}\right)^{2} = \min{} \]
Which is equivalent to the model\[\frac{Y_{i}}{x_{i}} = \beta_{1} + \frac{\beta_{0}}{x_{i}} + \delta_{i}\]
Where $\delta_{i} = \varepsilon_{i} / x_{i}$.

\end{enumerate}

\noindent\textbf{\Large Miscellaneous Exercises 6}
\begin{enumerate}
\setcounter{enumi}{1}
\item \textit{Derive an $F$-statistic for testing the hypothesis that two straight lines intersect at the point (a,b)}

Define the combined model as $\boldsymbol{Y} = \boldsymbol{X\beta} + \boldsymbol{\varepsilon}$.  Where $\boldsymbol{Y}' = (y_{1,i},\ldots,y_{1,n},y_{2,1},\ldots,y_{2,m})$ and
\begin{eqnarray}
\boldsymbol{X} & = & \left( \begin{array}{llll}
	1 & x_{1,1} & 0 & 0 \\
	\vdots & \vdots & \vdots & \vdots \\
	1 & x_{1,n} & 0 & 0 \\
	0 & 0 & 1 & x_{2,1} \\
	\vdots & \vdots & \vdots & \vdots \\
	0 & 0 & 1 & x_{2,m} \end{array} \right)
\end{eqnarray}
And $\boldsymbol{\beta}' = (\alpha_{1},\beta_{1},\alpha_{2},\beta_{2})$.  Then we use the $F$-statistic derived previously
\begin{eqnarray}
F &=& \frac{(RSS_{H} - RSS) / q}{RSS / (n-p)} \label{fstat}
\end{eqnarray}
With
\begin{eqnarray}
RSS_{H} - RSS& = & (A\hat{\beta} - c) \left(A(X'X)^{-1}A'\right)^{-1} (A\hat{\beta} - c)' \label{rss.h.rss}
\end{eqnarray}
And we set
\begin{eqnarray}
A & = & \left( \begin{array}{llll}
	1 & a & 0 & 0 \\
	0 & 0 & 1 & a \end{array}\right) \\
c & = & \left( \begin{array}{c}
	b \\ b \end{array} \right)
\end{eqnarray}

\item \textit{Obtain an estimate and a confidence interval for the horizontal distance between two parallel lines.}

Since the lines are parallel we have the models
\begin{eqnarray}
Y_{1} & = & \alpha_{1} + \beta_{1}X_{1} \\
Y_{2} & = & \alpha_{2} + \beta_{1}X_{2}
\end{eqnarray}
Setting $Y_{1} = Y_{2} = 0$ and solving, we get the estimate
\begin{eqnarray}
\delta & = & \frac{\hat{\alpha}_{2} - \hat{\alpha}_{1}}{\hat{\beta}_{1}}
\end{eqnarray}
where we choose the models so that the estimate $\delta$ is positive.  Then to get a confidence interval we define
\begin{eqnarray}
U & = & \hat{\alpha}_{2} - \hat{\alpha}_{1} - \hat{\beta}_{1}\delta
\end{eqnarray}
Then we have the following properties of $U$
\begin{eqnarray}
EU & = & 0 \\
var(U) & = & var(\bar{Y}_{2}) + var(\bar{Y}_{1}) + (\bar{x}_{1} - \bar{x}_{2} - \delta)^{2}var(\hat{\beta}_{1}) \\
       & = & \sigma^{2}\left( \frac{1}{n_{2}} + \frac{1}{n_{1}} + \frac{(\bar{x}_{1} - \bar{x}_{2} - \delta)^{2}}{\sum\sum (x_{ik} - \bar{x}_{i\cdot})} \right) \\
	   & = & \sigma_{U}^{2}
\end{eqnarray}
Where the covariance terms in $var(U)$ are all $0$.  Since $U$ is a linear combination of the $Y_{i}$, we can say that $U$ has the distribution $N(0,w\sigma^{2})$ and we can construct the $T$ variable
\begin{eqnarray}
T & = & \frac{U/\sigma_{U}}{S/\sigma}
\end{eqnarray}
Where $S^{2} = RSS_{H_{1}}/(n_{1} + n_{2} - 3)$ for the alternative hypothesis $H_{1}$ that the lines are parallel.  Then the confidence interval are the roots in $\delta$ of the equation
\begin{eqnarray}
T^{2} & = & F_{1,n_{1} + n_{2} - 3}^{\alpha}
\end{eqnarray}


\end{enumerate}

\noindent\textbf{\Large Miscellaneous Exercises 7}
\begin{enumerate}
\setcounter{enumi}{2}
\item \textit{Suppose that the regression curve\[E[Y] = \beta_{0} + \beta_{1}x + \beta_{2}x^{2}\] has a local maximum at $x = x_{m}$ where $x_{m}$ is near the origin.  if $Y$ is observed at $n$ points $x_{i}$ in $[-a,a], \bar{x} = 0$, and the usual normality assumptions hold, outline a method for finding a confidence interval for $x_{m}$.}

First find a statistic for $\hat{x}_{m}$ by differentiating and solving for $0$ to find the value $\hat{x}_{m}$
\begin{eqnarray}
0 & = & \beta_{1} + 2\beta_{2}x \\
\hat{x}_{m} & = & \frac{-\beta_{1}}{2\beta_{2}}
\end{eqnarray}
Then let $U = \hat{\beta}_{1} + 2\hat{\beta}_{2}x_{m}$ which has the properties
\begin{eqnarray}
E[U] & = & 0 \\
var(U) & = & var(\hat{\beta}_{1}) + 4x_{m}^{2}var(\hat{\beta}_{2}) + 4x_{m}^{2}cov(\hat{\beta}_{2},\hat{\beta}_{1}) = \sigma^{2}_{U}
\end{eqnarray}
Where $var(\hat{\boldsymbol{\beta}}) = \sigma^{2}(\boldsymbol{X}'\boldsymbol{X})^{-1}$.  Which means we have the new variable
\begin{eqnarray}
T & = & \frac{U/\sigma_{U}}{S/\sigma} \sim t_{n-3}
\end{eqnarray}
And the confidence interval can be defined by the roots of the quadratic 
\begin{eqnarray}
T^{2} & = & F_{1,n - 3}^{\alpha}
\end{eqnarray}
in $x_{m}$.

\end{enumerate}

\noindent\textbf{\Large Miscellaneous Exercises 9}
\begin{enumerate}
\item \textit{Suppose that the postulated regression model is \[EY = \beta_{0} + \beta_{1}x\] when the true model is \[EY = \beta_{0} + \beta_{1}x + \beta_{2}x^{2} + \beta_{3}x^{3}\] If the observations of $EY$ are taken at $x = -3,-2,-1,0,1,2,3$ what is the bias?}

If we let
\begin{eqnarray}
X & = & \left( \begin{array}{rr} \input{X.tex} \end{array} \right) \\
Z & = & \left( \begin{array}{rr} \input{Z.tex} \end{array} \right)
\end{eqnarray}
Then we have the model
\begin{eqnarray}
EY & = & X\left( \begin{array}{l} \beta_{0} \\ \beta_{1} \end{array} \right) + Z \left( \begin{array}{l} \beta_{2} \\ \beta_{3} \end{array} \right)
\end{eqnarray}
And we can use equation (9.2) from the text
\begin{eqnarray}
E\hat{\beta} & = & \beta + L\gamma
\end{eqnarray}
Where $\gamma = (\beta_{2},\beta_{3})'$ and
\begin{eqnarray}
L\gamma & = & (X'X)^{-1}X'Z\gamma
\end{eqnarray}
Which gives us the realtion
\begin{eqnarray}
E\hat{\beta} & = & \left( \begin{array}{l} \beta_{0} \\ \beta_{1} \end{array} \right) + 
	\left(\begin{array}{ll}
	\frac{1}{7} & 0 \\
	0 & \frac{1}{28} \end{array} \right)
	\left( \begin{array}{ll}
	28 & 0 \\
	0 & 196 \end{array} \right) 
	\left( \begin{array}{l} \beta_{2} \\ \beta_{3} \end{array} \right)
\end{eqnarray}
So that the bias is
\begin{eqnarray}
E\hat{\beta}_{0} & = & \beta_{0} + 4 \beta_{2} \\
E\hat{\beta}_{1} & = & \beta_{1} + 7 \beta_{3}
\end{eqnarray}
\end{enumerate}

\noindent\textbf{\Large Exercises 10a}
\begin{enumerate}
\setcounter{enumi}{3}
\item \textit{Show that $(1-h_{i})^{2} + \sum_{j \neq i}h_{ij}^{2} = (1 - h_{i})$.}

If the the $h_{ij}$ are the elements of the hat matrix $H$ which has the form
\begin{eqnarray}
\hat{Y} & = & X(X'X)^{-1}X'Y = HY
\end{eqnarray}
Then, $H$ is the idempotent projection matrix that transforms $Y$ into $\hat{Y}$.  This implies $(I-H)^{2} = I-H$ and shows $(1-h_{i})^{2} + \sum_{j \neq i}h_{ij}^{2} = (1 - h_{i})$.

\end{enumerate}

\noindent\textbf{\Large Exercises 10c}
\begin{enumerate}
\setcounter{enumi}{3}
\item \textit{Suppose that $Y_{1},Y_{2},\ldots,Y_{n}$ are gamma random variables so that $EY = r\lambda_{i} = \mu_{i}$, say, and $var[Y_{i}] = r^{-1}\mu_{i}^{2}$.  Find a transformation that will make the variances of the $Y_{i}$ approximately equal.}

If we use the methods described in section 10.4.3 of the text, we find that we can make the variances more homogeneous if we use 
\begin{eqnarray}
var[f(Y_{i})] & \approx & \left( \frac{df}{d\mu} \right)^{2} var[Y_{i}] \\
 & = & \left( \frac{df}{d\mu} \right)^{2} w(\mu)
\end{eqnarray}
Then in this case we let $w(\mu) = r^{-1}\mu_{i}^{2}$.  And we look at
\begin{eqnarray}
f(\mu) & = & \int \left( \frac{r}{\mu^{2}} \right)^{1/2} d\mu \\
 & = & \sqrt{r} \int \frac{1}{\mu} d\mu \\
 & = & \sqrt{r} \log{\mu}
\end{eqnarray}
So we expect the data $(\sqrt{r}\log{Y_{1}},\sqrt{r}\log{Y_{2}},\ldots,\sqrt{r}\log{Y_{n}})$ to have approximately the same variance.


\end{enumerate}
\end{document}
