
\documentclass[12pt]{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 256f18 Assignment Nine}}\footnote{Copyright information is at the end of the last page.}\vspace{1 mm}\end{center}\noindent
Please read Sections 4.3-4.5 in the text.
The following homework problems are not to be handed in. They are preparation for Test 3 and the final exam.  All textbook problems are from Chapter Four. Use the formula sheet to do the problems. On tests and the final exam, you may use anything on the formula sheet unless you are being directly asked to prove or derive it.
\vspace{5mm}
\begin{enumerate} 
%%%%%%%%%%%%%%%%%%%% Covariance %%%%%%%%%%%%%%%%%%%%
% Including some conditional expected value in the first 2 questions. 

\item The discrete random variables $X$ and $Y$ have joint probability mass function $p_{xy}=xy/18$ for $x=1,2,3$, $y = 1,2$, and zero otherwise. 
    \begin{enumerate}
        \item Find $cov(X,Y)$. My answer is 0.
        \item Find $E(Y|X=1)$ My answer is $\frac{5}{3}$.
        \item Are $X$ and $Y$ independent?
    \end{enumerate}

\item \label{contxy} The continuous random variables $X$ and $Y$ have joint density function $f_{xy}=1$ for $0<x<1$ and $2x < y < 2$, and zero otherwise. 
    \begin{enumerate}
        \item Find $cov(X,Y)$. My answer is $\frac{1}{18}$.
        \item Find $E(X|Y=y)$ My answer is $\frac{y}{4}$.
        \item Are $X$ and $Y$ independent?
        \item Find $E(X)$ using double expectation: $E(X)=E(E[X|Y])$. Compare to the $E(X)=\frac{1}{3}$ you got using the definition of expected value. 
    \end{enumerate}
    
\item Starting with the definitions on the formula sheet, prove the following facts about variances and covariances. Use expected value rules rather than integration or summation.
    \begin{enumerate}
        \item $Cov(X,Y) = E(XY)-E(X)E(Y)$
        \item $Cov(a+X,b+Y)  = Cov(X,Y)$
        \item $Var(aX+bY) = a^2Var(X)+b^2Var(Y) + 2abCov(X,Y)$
        \item $Cov(aW+bX,cY+dZ) = acCov(W,Y) + adCov(W,Z) + bcCov(X,Y) + bdCov(X,Z)$
        \item $Var(aX+bY) = a^2Var(X)+b^2Var(Y) + 2abCov(X,Y)$
        \item $Var\left(\sum_{i=1}^n a_iX_i \right) = \sum_{i=1}^n a_i^2Var(X_i) 
\, + \, \sum\sum_{i \neq j} a_ib_j Cov(X_i,X_j)$. How many covariances are you adding up in the last term?
    \end{enumerate}

\item Do Problem 44 in the text. % Cov(X+Y,X-Y)
\item Do Problem 50 in the text. % Expected value and variance of mean.

\item \label{corr} The correlation between two random variables $X$ and $Y$ is defined as
\begin{displaymath}
    Corr(X,Y) = \rho = \frac{Cov(X,Y)}{\sqrt{Var(X) \, Var(Y)}}
\end{displaymath}
Find a formula for $Corr(a+bX,c+dY)$, where $b$ and $d$ are both non-zero. Show your work.

\item Let the pairs $(X_1, Y_1), \ldots, (X_n,Y_n)$ be selected independently from a joint distribution with $E(X_i)=\mu_x$, $E(Y_i)=\mu_y$, $Var(X_i)=\sigma^2_x$, $Var(Y_i)=\sigma^2_y$, and $Cov(X_i,Y_i)=\sigma_{xy}$. Independence means that $X_i$ and $Y_i$ are independent of $X_j$ and $Y_j$ for $i \neq j$.

The sample mean (average) of the $X$ values is $\overline{X} = \frac{1}{n}\sum_{i=1}^nX_i$, and the sample mean of the $Y$ values is $\overline{Y} = \frac{1}{n}\sum_{i=1}^nY_i$
    \begin{enumerate}
        \item Show $Cov(X_j,\overline{X}) = \sigma^2_x/n$.
        \item Show $Cov(\overline{X},\overline{Y}) = \sigma^2_{xy}/n $
        \item The formula for correlation is not on the formula sheet, but it is given in Problem~\ref{corr}. Show $Corr(\overline{X},\overline{Y}) = Corr(X_i,Y_i)$.
    \end{enumerate}


%%%%%%%%%%%%%%%%%%%% Conditional expectation %%%%%%%%%%%%%%%%%%%%


\item The double expectation formula  says $E(Y) = E[E(Y|X)]$. Prove it for the case where $X$ and $Y$ are discrete random variables.

\item Do Problem 70 in the text. Consider the continuous and discrete cases separately. % If X and Y are independent, E(X|Y=y) = E(X).

\item Do Problem 73 in the text. Try denoting the number of heads in the first $n$ tosses by $N_1$, and the number of heads in the second set of tosses by $N_2$. You want $E(N_1+N_2)$. Use double expectation, conditioning on $N_1$. % np(1+p)

\item Do Problem 75 in the text. Just find $E(U)$. For the variance you would use Theorem B on page 151, which we skipped. % 1/(2 lambda)


%%%%%%%%%%%%%%%%%%%% Moment-generating functions %%%%%%%%%%%%%%%%%%%%

\item Let $X$ have a moment-generating function $M_x(t)$ and let $a$ be a constant. Show $M_{a+x}(t) = e^{at}M_x(t)$.

\item Let $X$ have a moment-generating function $M_x(t)$ and let $a$ be a constant. Show $M_{a+x}(t) = e^{at}M_x(t)$.

\item  Let $X$ and $Y$ be independent, (continuous) random variables.  Show $M_{x+y}(t) = M_x(t) \, M_y(t)$. 

\pagebreak

\item In the following table, derive the moment-generating functions (given on the formula sheet), and then use them to obtain the expected values and variances. To make the task shorter, notice that the Bernoulli is a special case of the binomial, and that the exponential and chi-squared distributions are special cases of the gamma. Do the general case first and then just write the answer for the special cases.

\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|l|c|c|c|} \hline
\textbf{Distribution} & \textbf{MGF} $M_x(t)$ & $E(X)$ & $Var(X)$ \\ \hline
Bernoulli ($p$)  &  &  & \\ \hline 
Binomial ($n,p$) &  &  & \\ \hline 
%Geometric ($p$) &  &  & \\ \hline 
Poisson ($\lambda$) &  &  & \\ \hline 
Uniform $(a,b)$ &  &  & \\ \hline 
Exponential ($\lambda$) &  &  & \\ \hline 
Gamma ($\alpha,\lambda$) &   &  & \\ \hline 
Normal ($\mu,\sigma$) &  &  & \\ \hline 
Chi-squared ($\nu$) &  &  & \\ \hline 
\end{tabular}
\renewcommand{\arraystretch}{1.0}

\item Do Problem 83 in the text. % Sum of binomials

\item  Do Problem 88 in the text. % Z = alpha X + beta Y

\item  Do Problem 89 in the text. % Weighted sum of normals.

\item Do Problem 93 in the text. By a ``geometric sum of exponential random variables," they mean that first $N$ is sampled from a geometric distribution, and then $X_1, \ldots, X_N$ are sampled independently from an exponential distribution -- independently of $N$ as well as each other. The sum is  $S = \sum_{i=1}^NX_i$. To find the distribution of $S$, find its moment-generating function. Obtain $M_s(t)=E(e^{St})$ using double expectation. Condition on $N$.


\end{enumerate} % End of questions
\vspace{20mm}


\vspace{2mm}\noindent
\begin{center}
\begin{tabular}{l}\hspace{6in} \\ \hline\end{tabular}
\end{center}

This assignment was prepared by 
%\href{https://www.utm.utoronto.ca/math-cs-stats/faculty-staff/zou-dr-nan}{Nan Zou} and 
\href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner}, Department of Mathematical and Computational 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:      \begin{center}\href{http://www.utstat.toronto.edu/~brunner/oldclass/256f18} {\small\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/256f18}}\end{center}

\end{document}


\item
    \begin{enumerate}
        \item 
        \item 
    \end{enumerate}


\item Do Problem  in the text. 
\item Do Problem  in the text. 

\item Do Problem  in the text. 


\item
    \begin{enumerate}
        \item 
        \item 
    \end{enumerate}

