% 302f15Assignment1.tex                 REVIEW
\documentclass[11pt]{article} 
%\usepackage{amsbsy} % for \boldsymbol and \pmb 
\usepackage{graphicx} % To include pdf files!
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amsfonts}
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref} % For links
\usepackage{fullpage}
%\pagestyle{empty} % No page numbers


\begin{document}
%\enlargethispage*{1000 pt} 

\begin{center}   
{\Large \textbf{STA 302f15 Assignment One}}\footnote{Copyright information is at the end of the last page.}
\vspace{1 mm}
\end{center}

\noindent 
Please do these review questions in preparation for Quiz One and Test One; they are not to be handed in. This material will not directly be on the final exam. 
The following formulas will be supplied with Quiz One. You may use them without proof. 
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{ll}
$E(X) = \sum_x \, x \, p_{_X}(x)$  & $E(X) = \int_{-\infty}^\infty x f_{_X}(x) \, dx$ \\
$E(g(X)) = \sum_x g(x) \, p_{_X}(x)$ &
$E(g(\mathbf{X})) =  
\sum_{x_1} \cdots \sum_{x_p} g(x_1, \ldots, x_p) \, 
p_{_\mathbf{X}}(x_1, \ldots, x_p) $   \\ 
$E(g(X)) = \int_{-\infty}^\infty g(x) \, f_{_X}(x) \, dx$ &
$E(g(\mathbf{X})) =  
\int_{-\infty}^\infty \cdots \int_{-\infty}^\infty g(x_1, \ldots, x_p) \, 
f_{_\mathbf{X}}(x_1, \ldots, x_p) \, dx_1 \ldots dx_p $   \\ 
$E(\sum_{i=1}^na_iX_i) = \sum_{i=1}^na_iE(X_i)$ &
$Var(X) = E\left( \, (X-\mu_{_X})^2 \, \right)$  \\ 
$Cov(X,Y) = E\left( \, (X-\mu_{_X})(Y-\mu_{_Y}) \, \right)$    &
$Corr(X,Y) = \frac{Cov(X,Y)}{\sqrt{Var(X)Var(Y)} } $
\end{tabular}
\renewcommand{\arraystretch}{1.0}
\end{center}

\vspace{3mm}

\begin{enumerate} 

     \item This question is very elementary, but it may help to clarify some basic concepts. The discrete random variables $X$ and $Y$ have joint distribution
\begin{center}
\begin{tabular}{c|ccc} 
        &  $X=1$  &   $X=2$  & $X=3$   \\  \hline
$Y=2$   &  $2/12$  & $3/12$    & $1/12$  \\
$Y=1$   &  $2/12$  & $1/12$   & $3/12$  \\ 
\end{tabular}
\end{center} 

        \begin{enumerate}
            \item What is the marginal distribution of $X$? 
            \item What is the marginal distribution of $Y$? 
            \item Are $X$ and $Y$ independent? Answer Yes or No and show your work.
            \item Calculate $E(X)$. Show your work.
            \item Denote a ``centered" version of $X$ by $X_c = X - E(X) = X-\mu_{_X}$. 
                \begin{enumerate}
                    \item What is the probability distribution of $X_c$?
                    \item What is $E(X_c)$? Show your work.
                    \item What is the probability distribution of $X_c^2$?
                    \item What is $E(X_c^2)$? Show your work.
                \end{enumerate}
            \item What is $Var(X)$? If you have been paying attention, you don't have to show any work. 
            \item Calculate $E(Y)$. Show your work.
            \item Calculate $Var(Y)$. Show your work. You may use Question~\ref{handy} if you wish.
            \item Calculate $Cov(X,Y)$. Show your work.             
            \item Let $Z_1 = g_1(X,Y) = X+Y$. What is the probability distribution of $Z_1$? Show some work.
            \item Calculate $E(Z_1)$. Show your work.
            \item Do we have $E(X+Y) = E(X)+E(Y)$? Answer Yes or No. Note that the answer does not require independence. 
            \item Let $Z_2 = g_2(X,Y) = XY$. What is the probability distribution of $Z_2$? Show some work.
            \item Calculate $E(Z_2)$. Show your work.
            \item Do we have $E(XY) = E(X)E(Y)$? Answer Yes or No. The connection to independence is established in Question~\ref{prod}.
        \end{enumerate}

     \item Let $X$ be a discrete random variable and let $a$ be a constant. Using the expression for $E(g(X))$ at the beginning of this assignment, show $E(a)=a$. Is the result still true if $X$ is continuous? 
     
     \item Let $a$ be a constant and $Pr\{Y=a\}=1$. Find $Var(Y)$. Show your work. 

     \item \label{prod} Let $X_1$ and $X_2$ be continuous random variables that are \emph{independent}. Using the expression for $E(g(\mathbf{X}))$ above, show $E(X_1 X_2) = E(X_1)E(X_2)$. Draw an arrow to the place in your answer where you use independence, and write ``This is where I use independence." Because $X_1$ and $X_2$ are continuous, you will need to integrate. Does your proof still apply if $X_1$ and $X_2$ are discrete? 
     
     \item \label{handy} Using the definitions of variance covariance along with the linear property $E(\sum_{i=1}^na_iY_i) = \sum_{i=1}^na_iE(Y_i)$ (no integrals), show the following:
        \begin{enumerate} 
            \item $Var(Y) = E(Y^2)-\mu_Y^2$
            \item $Cov(X,Y)=E(XY)-E(X)E(Y)$
            \item If $X$ and $Y$ are independent, $Cov(X,Y) = 0$. Of course you may use Problem~\ref{prod}.
        \end{enumerate} 

    \item Let $X$ be a random variable and $a$ be a constant. Show 
        \begin{enumerate}
            \item $Var(aX) = a^2Var(X)$.
            \item $Var(X+a) = Var(X)$.
        \end{enumerate}

    \item Show $Var(X+Y) = Var(X) + Var(Y) + 2Cov(X,Y)$.

    \item Let $X$ and $Y$ be random variables, and let $a$ and $b$ be constants. Show $Cov(X+a,Y+b) = Cov(X,Y)$.

     \item Let $X$ and $Y$ be random variables, with $E(X)=\mu_x$, $E(Y)=\mu_y$, 
$Var(X)=\sigma^2_x$, $Var(Y)=\sigma^2_y$, $Cov(X,Y) = \sigma_{xy}$ and $Corr(X,Y) = \rho_{xy}$.  Let $a$ and $b$ be non-zero constants.
        \begin{enumerate}
            \item Find $Cov(aX,Y)$. 
            \item Find $Corr(aX,Y)$. Do not forget that $a$ could be negative. 
        \end{enumerate}


     \item Let $y_1, \ldots, y_n$ be numbers, and $\overline{y}=\frac{1}{n}\sum_{i=1}^ny_i$. Show
         \begin{enumerate} 
            \item $\sum_{i=1}^n(y_i-\overline{y})=0$
            \item $\sum_{i=1}^n(y_i-\overline{y})^2=\sum_{i=1}^ny_i^2 \,-\, n\overline{y}^2$
            \item The sum of squares $Q_m = \sum_{i=1}^n(y_i-m)^2$ is minimized when $m = \overline{y}$.
        \end{enumerate}

\pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Next time 
%      \item Let $x_1, \ldots, x_n$ and $y_1, \ldots, y_n$ be numbers, with $\overline{x}=\frac{1}{n}\sum_{i=1}^nx_i$ and $\overline{y}=\frac{1}{n}\sum_{i=1}^ny_i$. Show $\sum_{i=1}^n(x_i-\overline{x})(y_i-\overline{y}) = \sum_{i=1}^n x_iy_i \,-\, n\overline{x} \, \overline{y}$. 

    \item Let $Y_1, \ldots, Y_n$ be independent random variables with $E(Y_i)=\mu$ and $Var(Y_i)=\sigma^2$ for $i=1, \ldots, n$. For this question, please use definitions and familiar properties of expected value, not integrals.
         \begin{enumerate} 
            \item Find $E(\sum_{i=1}^nY_i)$. Are you using independence? 
            \item Find $Var\left(\sum_{i=1}^n Y_i\right)$. What earlier questions are you using in connection with independence? 
            \item Using your answer to the last question, find $Var(\overline{Y})$. 
            \item A statistic $T$ is an \emph{unbiased estimator} of a parameter $\theta$ if $E(T)=\theta$. Show that $\overline{Y}$ is an unbiased estimator of $\mu$. This is very quick. 
            \item Let $a_1, \ldots, a_n$ be constants and define the linear combination $L$ by $L = \sum_{i=1}^n a_i Y_i$. What condition on the $a_i$ values makes $L$ an unbiased estimator of $\mu$?
            \item Is $\overline{Y}$ a special case of $L$?  If so, what are the $a_i$ values?
            \item What is $Var(L)$? 
        \end{enumerate}

    \item  Here is a simple linear regression model. Let $Y = \beta_0 + \beta_1 x + \epsilon$, where $\beta_0$ and $\beta_1$ are constants (typically unknown), $x$ is a known, observable constant, and $\epsilon$ is a random variable with expected value zero and variance $\sigma^2$.
        \begin{enumerate}
            \item What is $E(Y)?$
            \item What is $Var(Y)$?
            \item Suppose that the distribution of $\epsilon$ is normal, so that it has density $f(\epsilon) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{\epsilon^2}{2\sigma^2}}$. Find the distribution of $Y$. Show your work. Hint: differentiate the cumulative distribution function of $Y$.
            \item Suppose there are two equations:
\begin{eqnarray*}
    Y_1 & = & \beta_0 + \beta_1 x_1 + \epsilon_1 \\
    Y_2 & = & \beta_0 + \beta_1 x_2 + \epsilon_2 
\end{eqnarray*}
with $E(\epsilon_1) = E(\epsilon_2) = 0$, $Var(\epsilon_1) = Var(\epsilon_2) = \sigma^2$ and $Cov(\epsilon_1, \epsilon_2)=0$. What is $Cov(Y_1,Y_2)$? Just give the number of the problem you solved earlier. 

        \end{enumerate}

\pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \item \label{firstmat} Which statement is true? (Quantities in boldface are matrices of constants.)
        \begin{enumerate}
            \item $\mathbf{A(B+C) = AB+AC}$
            \item $\mathbf{A(B+C) = BA+CA}$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}
    \item Which statement is true?
        \begin{enumerate}
            \item $a\mathbf{(B+C)}=a\mathbf{B} + a\mathbf{C}$
            \item $a\mathbf{(B+C)}=\mathbf{B}a + \mathbf{C}a$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}


    \item Which statement is true?
        \begin{enumerate}
            \item $\mathbf{(B+C)A = AB+AC}$
            \item $\mathbf{(B+C)A = BA+CA}$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}

    \item Which statement is true?
        \begin{enumerate}
            \item $\mathbf{(AB)^\prime = A^\prime B^\prime}$
            \item $\mathbf{(AB)^\prime = B^\prime A^\prime}$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}

    \item Which statement is true?
        \begin{enumerate}
            \item $\mathbf{A^{\prime\prime} = A }$
            \item $\mathbf{A^{\prime\prime\prime} = A^\prime }$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}

\pagebreak %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \item Suppose that the square matrices $\mathbf{A}$ and $\mathbf{B}$ both have inverses. Which statement is true?
        \begin{enumerate}
            \item $\mathbf{(AB)}^{-1} = \mathbf{A}^{-1}\mathbf{B}^{-1}$
            \item $\mathbf{(AB)}^{-1} = \mathbf{B}^{-1}\mathbf{A}^{-1}$
            \item Both a and b
            \item Neither a nor b
        \end{enumerate}
    \item Which statement is true?
        \begin{enumerate}
            \item $\mathbf{(A+B)^\prime = A^\prime + B^\prime}$
            \item $\mathbf{(A+B)^\prime = B^\prime + A^\prime }$
            \item $\mathbf{(A+B)^\prime = (B+A)^\prime}$
            \item All of the above
            \item None of the above
        \end{enumerate}

    \item Which statement is true?
        \begin{enumerate}
            \item $(a+b)\mathbf{C} = a\mathbf{C}+ b\mathbf{C}$
            \item $(a+b)\mathbf{C} = \mathbf{C}a+ \mathbf{C}b$
            \item $(a+b)\mathbf{C} = \mathbf{C}(a+b)$
            \item All of the above
            \item None of the above
        \end{enumerate}

    \item Let $\mathbf{A}$ be a square matrix with the determinant of $\mathbf{A}$ (denoted $|\mathbf{A}|$) equal to zero. What does this tell you about $\mathbf{A}^{-1}$? No proof is required here.
        
    \item Recall that $\mathbf{A}$ symmetric means $\mathbf{A=A^\prime}$. Let $\mathbf{X}$ be an $n$ by $p$ matrix. Prove that $\mathbf{X^\prime X}$ is symmetric.

    \item Matrix multiplication does not commute. That is, if $\mathbf{A}$ and $\mathbf{B}$ are matrices, in general it is \emph{not} true that $\mathbf{AB} = \mathbf{BA}$ unless both matrices are $1 \times 1$. Establish this important fact by making up a simple numerical example in which $\mathbf{A}$ and $\mathbf{B}$ are both $2 \times 2$ matrices. Carry out the multiplication, showing $\mathbf{AB} \neq \mathbf{BA}$. This is also the point of Question~\ref{firstmat}.

    \item Let $\mathbf{X}$ be an $n$ by $p$ matrix with $n \neq p$. Why is it incorrect to say that $(\mathbf{X^\prime X})^{-1}= \mathbf{X}^{-1}\mathbf{X}^{\prime -1}$?

\end{enumerate}

% \vspace{130mm}

\noindent
\begin{center}\begin{tabular}{l}
\hspace{6in} \\ \hline
\end{tabular}\end{center}
This assignment was prepared by  \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Statistical Sciences, University of Toronto. It is licensed under a 
\href{http://creativecommons.org/licenses/by-sa/3.0/deed.en_US}
     {Creative Commons Attribution - ShareAlike 3.0 Unported License}. Use any part of it as you like and share the result freely. The \LaTeX~source code is available from the course website:
\href{http://www.utstat.toronto.edu/~brunner/oldclass/302f15} {\small\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/302f15}}

\end{document}

