% This is a simple LaTex sample document that gives a submission format
%   for IEEE PAMI-TC conference submissions.  Use at your own risk.

% Make two column format for LaTex 2e.
\documentclass[10pt]{article} %,twocolumn
%\usepackage[dvips]{graphicx,graphics}
\usepackage{times,amsmath,amsfonts}

% Use following instead for LaTex 2.09 (may need some other mods as well).
% \documentstyle[times,twocolumn]{article}

% Set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{9.2in} \setlength{\textwidth}{6.875in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.1875in}  % Centers text.
\setlength{\evensidemargin}{-.1875in}

% Add the period after section numbers.  Adjust spacing.
\newcommand{\Section}[1]{\vspace{-8pt}\section{\hskip -1em.~~#1}\vspace{-3pt}}
\newcommand{\SubSection}[1]{\vspace{-3pt}\subsection{\hskip -1em.~~#1}
        \vspace{-3pt}}
\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand {\diff}[1] {\frac{\partial}{\partial #1}}
\newcommand{\jacob}[3]{\frac{\partial^2 #3}{\partial #1 \partial #2}}
\newcommand{\der}[2]{\frac{\partial #2}{\partial #1}}
\begin{document}

% Don't want date printed
\date{May 5, 2005}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat324: Sample Final Exam}

% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle

\begin{enumerate}


\item Suppose that $X_1,\cdots, X_n$ is a random sample from the Bernoulli distribution with $P(X_i=1)=p, 0<p<1$ (20pts)\\
(a) Compute the correlation coefficient of $X_1+X_2$ and $X_1+X_3$.\\
(b) Determine the probability distribution of $X_1^2 + \cdots +
X_n^2$.

{\it Solution.} ${\bf Cov}(X_1+X_2,X_1+X_3) = {\bf Var}(X_1)=
p(1-p)$. ${\bf Var}(X_1+X_2)={\bf Var}(X_1+X_3) = {\bf Var}X_1 +
{\bf Var}X_3 = 2p(1-p)$. $\rho = \frac{1}{\sqrt{2}}$. $X_i^2$ are
again i.i.d. Bernoulli($p$). So $X_1^2 + \cdots + X_n^2 \sim
\mbox{Binomial}(n,p)$.

\item The density of $X$ is given by $f(x) = |x| $ for $ -1 < x <1$
and $f(x)=0$ otherwise (20pts). \\
(a) Compute the cumulative distribution of $X$ and plot its
graph.\\
(b) Determine the density of $U=X^2$\\

{\it Solution.} $F_X(x) = P(X < x) = \frac{1-x^2}{2}$ for $-1 <x <0$
and $\frac{1+x^2}{2}$ for $0<x<1$. $F_U(u) = P(U < u) =
F_X(\sqrt{u})-F_X(-\sqrt{u})$ for $0<u<1$. $f_U(u) =
\frac{f_X(\sqrt{u})+ f_X(-\sqrt{u})}{2\sqrt{u}}=
\frac{f_X(\sqrt{u})}{\sqrt{u}} = 1$ for $0<u<1$. Hence $U \sim
\mbox{Uniform}(0,1)$.

\item Gross sales before and after a training program is given by
\begin{verbatim}
Salesperson :  1  2   3  4   5  6
Sales before: 90 83 105 97 110 78
Sales after : 97 80 110 93 123 84
\end{verbatim}
Determine if the training program is effective at $\alpha=0.1$. Carefully do your analysis stating all the relevant assumptions (30 pts).\\
{\em Solution.} The points will be given in three categories. {\bf
Model specification} (10 pts). We assume that the gross sale $X_i$
of $i$-th sales person before the training to follow normal, i.e.
$X_i \sim N(\mu_b,\sigma_b^2)$. We also assume that the gross sale
$Y_i$ of $i$-th sales person after the training to follow normal,
i.e. $Y_i \sim N(\mu_a,\sigma_a^2)$. Then the sales difference
$W_i=Y_i - X_i \sim N(\mu_a-\mu_b,\sigma_a^2+\sigma_b^2)$.

{\bf Inference setup} (10 pts). The null hypothesis of interest
would be $H_0: \mu_a = \mu_b$ vs. $H_1: \mu_a > \mu_b$. The
appropriate test statistic would be the one sample $t$-statistic. So
the $t$-statistic is $T= \bar W/(S/\sqrt{6}),$ where $S$ is the
sample variance of $W$ and it is distributed as $T \sim t_5$. {\bf
Actual computation} (10 pts). You need to compute $S$ by yourself
and actual R output either in $\tt{pt}$ or $\tt{qt}$ will be given.

\item When you throw a coin 10 times, you observed 3 heads. Test if the coin is biased at $\alpha=0.2$. Clearly state appropriate parameters, hypotheses, a test statistic. You may use the following R output (15pts).\\
\begin{verbatim}
> pbinom(0:5,10,0.5)
 [1] 0.00 0.01 0.06 0.17 0.38 0.62
\end{verbatim}

{\em Solution} Let $p$ be the probability of getting head. Then
$H_0: p=0.5$ vs. $H_1: p \neq 0.5$. Assign $X_i=1$ if $i$-th tossing
yields head and $X_i=0$ otherwise.  Note that $P(X_i=1)=p,
P(X_i=0)=1-p$.  We will take $X=\sum_{i=1}^{10} X_i$ as a test
statistic since $X \sim Binomial (10,p)$. Under $H_0$,
$\sum_{i=1}^{10} X_i \sim \mbox{Binomial}(10,0.5)$. We reject $H_0$
if $\sum_{i=1}^{10} x_i$ is either too small or too large. Note that
$P(X \leq 3) = P(X \geq 7) = 0.01+0.06+0.17= 0.24$ and $P(X \leq 2)
= P(X \geq 8)= 0.01+0.06=0.07$. Hence we reject $H_0$ if $X\leq 2$
or $X \geq 8$ at level $\alphha=0.2$. The data indicates that we
should not reject the null hypothesis at $\alpha=0.2$.

\item Consider a linear model $Y=\beta_0 + \beta_1 x + \epsilon$. There is a reason to believe that $\beta_1=0$. The following data
are given: $(x_1,y_1), \cdots, (x_n,y_n)$ to be fitted to the linear
model. We assume $\epsilon$ to follow zero mean normal distribution.
 \begin{itemize}
\item[(a)] Estimate $\beta_0$ by minimizing the sum of the squared residuals.
No point given for not showing the minimization steps (10pts).
\item[(b)] Estimate $\beta_0$ by the maximum likelihood method. Determine
if it is unbiased. Do you get the same answer as (a)? Please derive
everything. (20pts).
\item[(c)] When $n=2$, show that the estimator in (a) is the minimum variance
unbiased estimator (MVUE) among the estimators of the form
$c_1Y_1+c_2Y_2$. No point given if you did not solve (a) (10pts).
\end{itemize}
{\em Solution.} This problem tests your total understanding of
linear model and estimation. Since $\beta_1=0$, we are dealing with
a very simple linear model $Y=\beta_0 + \epsilon$. (a) The the sum
of squared residuals $SSE =\sum_{i=1}^n (y_i-\beta_0)^2$ (3pts).
Solving $\partial SSE/\partial \beta_0 = 0$, we get $\beta_0=\bar y$
(4pts). (b) Note that $Y_i \sim N(\beta_0,\sigma^2)$ for some
$\sigma$. Then we can show that the maximum likelihood estimator of
$\beta_0$ is $\bar Y$. Do not mix up little $y_i$ and big $Y_i$. It
will cost you 2 points.  Then it can be shown that $\mathbb{E} \hat
\beta_0 = \beta_0$ (7pts). The MLE is the LSE (3pts).
(c) To make
$c_1Y_1 + c_2Y_2$ unbiased, we need $\mathbb{E}(c_1Y_1+c_2Y_2) =
c_1\beta_0 + c_2\beta_0=\beta_0$. So $c_2=1-c_1$. Now minimize the
variance ${\bf Var}(c_1Y_1 + c_2Y_2) = c_1^2{\bf Var}Y_1 + c_2^2{\bf
Var} Y_2 = (c_1^2+(1-c_1)^2)\sigma^2$ for some $\sigma$. By
differentiating it w.r.t. $c_1$, we get $c_1=1/2$. Hence, $\bar Y$
is MVUE when $n=2$.

\item Data for the average blood lead level ($\tt{blood}$) of children age 6 months to 5 years and the amount of lead used in gasoline production ($\tt{gasoline}$) for ten 6-months periods are available.\\
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
  \hline
  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...

  $\tt{blood}$ &48&  59  &79 & 80&  95&  95 & 97& 102& 102& 107\\
\hline
  $\tt{gasoline}$ & 9.3 &11.0 &12.8 &14.1& 13.6 &13.8 &14.6 &14.6 &16.0 &18.2\\

  \hline
\end{tabular}\\
R output for analyzing this data is given below.
\begin{verbatim}
>blood
[1]  48  59  79  80  95  95  97 102 102 107
>gasoline
[1]  9.3 11.0 12.8 14.1 13.6 13.8 14.6 14.6 16.0 18.2
>summary(lm(blood~gasoline))
Call:
lm(formula = blood ~ gasoline)
Residuals:
     Min       1Q   Median       3Q      Max
-11.5112  -6.6140  -0.2788   7.6404  10.0596
Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)  -14.312     16.101  -0.889 0.399984
gasoline       7.298      1.150   6.344 0.000222 ***
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 8.508 on 8 degrees of freedom
Multiple R-Squared: 0.8342,     Adjusted R-squared: 0.8135
F-statistic: 40.25 on 1 and 8 DF,  p-value: 0.0002220
\end{verbatim}
\begin{itemize}
\item[(a)] Is there any linear relationship between blood lead level and the amount of lead used in gasoline production? What is the statistical significance of your conclusion? (20 pts).
\item[(b)] What is the correlation coefficient between two variables? (10pts).
\end{itemize}
{\em Solution.} (a) We test if the intercept slop is zero, i.e.
$H_0:\beta_1=0$. The $P$-value is extremely small so we conclude
that there is a linear relationship with $99\%$ significance. (b)
The coefficient of determination $r^2=0.8442$. If you take the squre
root, $r=\pm \sqrt{0.844}$. From the negative regrssion slope, we
see that the correlation must be negative. So $\rho= - \sqrt{0.844}$
is the correlation.



\end{enumerate}

\end{document}
