\documentclass[10pt]{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

\oddsidemargin=0in                  % Good for US Letter paper
\evensidemargin=0in
\textwidth=6.3in
\topmargin=-0.5in
\headheight=0.1in
\headsep=0.1in
\textheight=9.4in

\pagestyle{empty} % No page numbers

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


\begin{center}   
{\Large \textbf{STA 442/2101 Formulas}}\\   % Version 2
\vspace{1 mm}
\end{center}

% Spectral decomposition, linear independence.
% MGFs
% Random vectors
% Linear model
% Distribution facts, incl x2 addup?
% Test stats and CIs


\noindent
\renewcommand{\arraystretch}{2.0}
\begin{tabular}{lll}
$M_Y(t) = E(e^{Yt})$ & ~~~~~ & $M_{aY}(t) = M_Y(at)$ \\
$M_{Y+a}(t) = e^{at}M_Y(t)$ & ~~~~~ & 
$M_{\sum_{i=1}^n Y_i}(t) = \prod_{i=1}^n M_{Y_i}(t)$
\\
$Y \sim N(\mu,\sigma^2)$ means $M_Y(t) = e^{\mu t + \frac{1}{2}\sigma^2t^2}$
& ~~~~~ & 
$Y \sim \chi^2(\nu)$ means $M_Y(t) = (1-2t)^{-\nu/2}$
\\
\multicolumn{3}{l}{If  $W=W_1+W_2$ with $W_1$ and $W_2$ independent, $W\sim\chi^2(\nu_1+\nu_2)$, $W_2\sim\chi^2(\nu_2)$ then $W_1\sim\chi^2(\nu_1)$} \\ 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\multicolumn{3}{l}{Columns of  $\mathbf{A}$ \emph{linearly dependent} means there is a vector $\mathbf{v} \neq \mathbf{0}$ with $\mathbf{Av} = \mathbf{0}$.} \\
\multicolumn{3}{l}{Columns of  $\mathbf{A}$ \emph{linearly independent} means that $\mathbf{Av} = \mathbf{0}$ implies $\mathbf{v} = \mathbf{0}$.} \\ 
\multicolumn{3}{l}{$\mathbf{A}$ \emph{positive definite} means  $\mathbf{v}^\top \mathbf{Av} > 0$ for all vectors $\mathbf{v} \neq \mathbf{0}$.} \\
$\boldsymbol{\Sigma} = \mathbf{P} \boldsymbol{\Lambda}\mathbf{P}^\top$
& ~~~~~ & 
$\boldsymbol{\Sigma}^{-1} = \mathbf{P} \boldsymbol{\Lambda}^{-1} \mathbf{P}^\top$
\\
$\boldsymbol{\Sigma}^{1/2} = \mathbf{P} \boldsymbol{\Lambda}^{1/2} \mathbf{P}^\top$
& ~~~~~ &
$\boldsymbol{\Sigma}^{-1/2} = \mathbf{P} \boldsymbol{\Lambda}^{-1/2} \mathbf{P}^\top$
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\multicolumn{3}{l}{If $\lim_{n \rightarrow \infty} E(T_n) = \theta$  and $\lim_{n \rightarrow \infty} Var(T_n) = 0$, then $T_n \stackrel{P}{\rightarrow} \theta$} \\ 
$\mathbf{Y}_n = \sqrt{n}(\overline{\mathbf{Y}}_n-\boldsymbol{\mu}) 
\stackrel{d}{\rightarrow} \mathbf{Y} \sim N(\mathbf{0},\boldsymbol{\Sigma})$
& ~~~~~ & 
So asymptotically, $\overline{\mathbf{Y}}_n \sim N(\boldsymbol{\mu},\frac{1}{n}\boldsymbol{\Sigma})$ 
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

$V(\mathbf{Y}) = 
E\left\{(\mathbf{Y}-\boldsymbol{\mu}_y)(\mathbf{Y}-\boldsymbol{\mu}_y)^\top\right\}$ 
& ~~~~~ & 
$C(\mathbf{Y,T}) = E\left\{ (\mathbf{Y}-\boldsymbol{\mu}_y)
                             (\mathbf{T}-\boldsymbol{\mu}_t)^\top\right\}$
\\
$V(\mathbf{Y}) = E\{\mathbf{YY}^\top\} - \boldsymbol{\mu}_y\boldsymbol{\mu}_y^\top$
& ~~~~~ &
$V(\mathbf{AY}) = \mathbf{A}V(\mathbf{Y}) \mathbf{A}^\top$
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$M_{\mathbf{Y}}(\mathbf{t}) = E(e^{\mathbf{t}^\top\mathbf{Y}})$ 
& ~~~~~ & 
$M_{\mathbf{AY}}(\mathbf{t}) = M_{\mathbf{Y}}(\mathbf{A}^\top\mathbf{t})$
\\
\multicolumn{3}{l}{$\mathbf{Y}_1$ and $\mathbf{Y}_2$ are independent if and only if
$M_{(\mathbf{Y}_1,\mathbf{Y}_2)}\left(\mathbf{t}_1,\mathbf{t}_2\right)
= M_{\mathbf{Y}_1}(\mathbf{t}_1) M_{\mathbf{Y}_2}(\mathbf{t}_2)$} \\
$M_{\mathbf{Y}+\mathbf{c}}(\mathbf{t}) = e^{\mathbf{t}^\top\mathbf{c}} M_{\mathbf{Y}}(\mathbf{t})$
 & ~~~~~ & 
$\mathbf{Y} \sim N_p(\boldsymbol{\mu}, \boldsymbol{\Sigma})$ means $M_{\mathbf{Y}}(\mathbf{t}) = e^{\mathbf{t}^\top\boldsymbol{\mu} + \frac{1}{2} \mathbf{t}^\top \boldsymbol{\Sigma} \mathbf{t}}$
\\


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If $\mathbf{Y} \sim N_p(\boldsymbol{\mu},\boldsymbol{\Sigma} )$, then
$\mathbf{AY} \sim N_r(\mathbf{A}\boldsymbol{\mu},
                    \mathbf{A}\boldsymbol{\Sigma}\mathbf{A}^\top )$
& ~~~~~ & 
and $(\mathbf{Y}-\boldsymbol{\mu})^\top
                 \boldsymbol{\Sigma}^{-1}(\mathbf{Y}-\boldsymbol{\mu}) \sim \chi^2 (p)$
\\
\multicolumn{3}{l}{$L(\boldsymbol{\mu,\Sigma}) = |\boldsymbol{\Sigma}|^{-n/2} (2\pi)^{-np/2} 
    \exp -\frac{n}{2}\left\{ tr(\boldsymbol{\widehat{\Sigma}\Sigma}^{-1}) +
    (\overline{\mathbf{y}}-\boldsymbol{\mu})^\top \boldsymbol{\Sigma}^{-1} 
    (\overline{\mathbf{y}}-\boldsymbol{\mu}) \right\}$,  
where $\boldsymbol{\widehat{\Sigma}} = 
\frac{1}{n}\sum_{i=1}^n (\mathbf{y}_i-\overline{\mathbf{y}}) 
                        (\mathbf{y}_i-\overline{\mathbf{y}})^\top $} 
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

$G^2 = -2 \log \left(   
           \frac{\max_{\theta \in \Theta_0} L(\theta)}
                {\max_{\theta \in \Theta} L(\theta)}
           \right)$
& ~~~~~ &
$W_n = (\mathbf{L}\widehat{\boldsymbol{\theta}}_n-\mathbf{h})^\top 
\left(\mathbf{L} \widehat{\mathbf{V}}_n \mathbf{L}^\top\right)^{-1} 
(\mathbf{L}\widehat{\boldsymbol{\theta}}_n-\mathbf{h})$ 
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$Y_i = \beta_0 + \beta_1 x_{i,1} + \cdots + \beta_{p-1} x_{i,p-1} + \epsilon_i$
& ~~~~~ & 
$\epsilon_1, \ldots, \epsilon_n$ independent $N(0,\sigma^2)$
\\
$\mathbf{Y} = \mathbf{X} \boldsymbol{\beta} + \boldsymbol{\epsilon}$ 
& ~~~~~ &
$\boldsymbol{\epsilon} \sim N_n(\mathbf{0},\sigma^2\mathbf{I}_n)$
\\
$\widehat{\boldsymbol{\beta}} = (\mathbf{X}^\top \mathbf{X})^{-1} 
                   \mathbf{X}^\top \mathbf{Y} \sim N_p\left(\boldsymbol{\beta}, 
                   \sigma^2 (\mathbf{X}^\top \mathbf{X})^{-1}\right)$
& ~~~~~ &
$\widehat{\mathbf{Y}} = \mathbf{X}\widehat{\boldsymbol{\beta}} = \mathbf{HY}$, where 
$\mathbf{H} = \mathbf{X}(\mathbf{X}^\top \mathbf{X})^{-1} 
                   \mathbf{X}^\top $
\\ 
$\textbf{e} = \mathbf{Y} - \widehat{\mathbf{Y}}$ 
& ~~~~~ &
$\widehat{\boldsymbol{\beta}}$ and $\textbf{e}$ are independent under normality.
\\
$\frac{SSE}{\sigma^2} = \frac{\textbf{e}^\top \textbf{e}}{\sigma^2}  \sim \chi^2(n-p)$
& ~~~~~ &
$MSE = \frac{SSE}{n-p}$
\\
$\sum_{i=1}^n(Y_i-\overline{Y})^2 = \sum_{i=1}^n(Y_i-\widehat{Y}_i)^2 + \sum_{i=1}^n(\widehat{Y}_i-\overline{Y})^2$
& ~~~~~ &
$SST=SSE+SSR$ and $R^2 = \frac{SSR}{SST}$
\\
\end{tabular}

\pagebreak

\noindent
\renewcommand{\arraystretch}{2.0}
\begin{tabular}{lll}
$T = \frac{Z}{\sqrt{W/\nu}} \sim t(\nu)$
& ~~~~~ &
$F = \frac{W_1/\nu_1}{W_2/\nu_2} \sim F(\nu_1,\nu_2)$
\\
    $T = \frac{\mathbf{a}^\top \widehat{\boldsymbol{\beta}}-\mathbf{a}^\top \boldsymbol{\beta}}
             {\sqrt{MSE \, \mathbf{a}^\top 
             (\mathbf{X}^\top \mathbf{X})^{-1}\mathbf{a}}} \sim t(n-p)$
& ~~~~~ &
$T = \frac{Y_{n+1}-\mathbf{x}_{n+1}^\top \widehat{\boldsymbol{\beta}}}
             {\sqrt{MSE \, (1+\mathbf{x}_{n+1}^\top 
             (\mathbf{X}^\top \mathbf{X})^{-1}\mathbf{x}_{n+1})}} \sim t(n-p)$
\\
$F^* = \frac{SSR_F-SSR_R}{r \, MSE_F} =  \left(\frac{n-p}{r}\right) \left(\frac{a}{1-a}\right) \sim F(r,n-p)$
& ~~~~~ &
$F^* = \frac{(\mathbf{L}\widehat{\boldsymbol{\beta}}-\mathbf{h})^\top
            (\mathbf{L}(\mathbf{X}^\top \mathbf{X})^{-1}\mathbf{C}^\top)^{-1}
            (\mathbf{L}\widehat{\boldsymbol{\beta}}-\mathbf{h})}
           {r \, MSE} \sim F(r,n-p)$

\\
$a = \frac{R^2_F-R^2_R}{1-R^2_R} = \frac{rF^*}{n-p+rF^*}$
& ~~~~~ &
$\lambda = \frac{(\mathbf{L}\boldsymbol{\beta}-\mathbf{h})^\top
            (\mathbf{L}(\mathbf{X}^\top \mathbf{X})^{-1}\mathbf{L}^\top)^{-1}
            (\mathbf{L}\boldsymbol{\beta}-\mathbf{h})}
           {\sigma^2}$
\\
$ Z_i \stackrel{ind}{\sim} N(\mu_i,1)  \Rightarrow  \sum_{i=1}^n Z_i^2 \sim \chi^2_{nc}(n,\lambda=\sum_{i=1}^n \mu_i^2)$
& ~~~~~ &
 $\lambda = \frac{\sum_{k=1}^p n_k (\mu_k-\mu_.)^2}{\sigma^2}$, where 
                 $\mu_. = \sum_{k=1}^p \frac{n_k}{n} \mu_k$
\\
$ \log\left(\frac{\pi_i}{1-\pi_i} \right) = 
    \beta_0 + \beta_1 x_{i,1} + \ldots + \beta_{p-1} x_{i,p-1}$
& ~~~~~ &
   $\pi_i  =  \frac{e^{\beta_0 + \beta_1 x_{i,1} + \ldots + \beta_{p-1} x_{i,p-1}}}
                    {1+e^{\beta_0 + \beta_1 x_{i,1} + \ldots + \beta_{p-1} x_{i,p-1}}}$
\\
\end{tabular}
\renewcommand{\arraystretch}{1.0}
  
\begin{verbatim}
> # Chi-squared critical values
> df = 1:6
> Critical_Value = qchisq(0.95,df)
> cbind(df,Critical_Value)
     df Critical_Value
[1,]  1       3.841459
[2,]  2       5.991465
[3,]  3       7.814728
[4,]  4       9.487729
[5,]  5      11.070498
[6,]  6      12.591587
\end{verbatim} 
\vspace{120mm}


\noindent
\begin{center}\begin{tabular}{l}
\hspace{6.5in} \\ \hline
\end{tabular}\end{center}
This formula sheet was prepared by  \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Statistics, 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/302f14} {\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/302f14}}



\end{document}



% Move sections up as the term progresses.

\multicolumn{3}{l}{$F = \frac{(\mathbf{L}\widehat{\boldsymbol{\beta}}-\mathbf{h})^\top
            (\mathbf{L}(\mathbf{X}^\top \mathbf{X})^{-1}\mathbf{C}^\top)^{-1}
            (\mathbf{L}\widehat{\boldsymbol{\beta}}-\mathbf{h})}
           {r \, MSE} 
           = \frac{SSR_F-SSR_R}{r \, MSE_F} =  \left(\frac{n-p}{r}\right) \left(\frac{a}{1-a}\right) \sim F(r,n-p)$, where $a = \frac{R^2_F-R^2_R}{1-R^2_R}$  }
\\




$r_{xy} = \frac{\sum_{i=1}^n (X_i-\overline{X})(Y_i-\overline{Y})}
               {\sqrt{\sum_{i=1}^n (X_i-\overline{X})^2} \sqrt{\sum_{i=1}^n (Y_i-\overline{Y})^2}}$
& ~~~~~ &
\\

