\documentclass[12pt]{article} 
%\usepackage{amsbsy} % for \boldsymbol and \pmb 
\usepackage{graphicx} % To include pdf files!
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amsfonts}
\usepackage{euscript} % for \EuScript
\usepackage[colorlinks=true, pdfstartview=FitV, linkcolor=blue, citecolor=blue, urlcolor=blue]{hyperref} % For links

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

\pagestyle{empty} % No page numbers

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


\begin{center}   
{\Large \textbf{STA 312s19 Formulas}}\\   % 
\vspace{1 mm}
\end{center}

\renewcommand{\arraystretch}{1.75}



\noindent
\begin{tabular}{lcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Gamma %%%%%%%%%%%%%%%%%%%%%%%%%%
$\Gamma(\alpha) = \int_0^\infty e^{-t} t^{\alpha-1} \, dt$
& ~ & 
$\Gamma(\alpha+1) = \alpha \, \Gamma(\alpha)$ and $\Gamma(\frac{1}{2}) = \sqrt{\pi}$\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Moments %%%%%%%%%%%%%%%%%%%%%%%%%%
$E(X) \stackrel{def}{=} \sum_x x \, p_x(x)$ or $\int_{-\infty}^\infty x \, f_x(x) \, dx$
& ~ & 
$E(g(X)) = \sum_x g(x) \, p_x(x)$ or $\int_{-\infty}^\infty g(x) \, f_x(x) \, dx$    \\
$Var(X) \stackrel{def}{=} E\left( (X-\mu)^2 \right)$ 
& ~ &  
$Var(X) = E(X^2)-[E(X)]^2$ \\
%If $X \sim N(\mu,\sigma^2)$, then $\frac{X-\mu}{\sigma} \sim N(0,1)$.
%& ~ & 
%If $Z \sim N(0,1)$, then $Z^2 \sim \chi^2(1)$. \\
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Likelihood %%%%%%%%%%%%%%%%%%%%%%%%%%
$L(\theta) = \prod_{i=1}^n p(y_i|\theta) $
& ~ & 
$L(\theta) = \prod_{i=1}^n f(y_i|\theta)$ \\
$L(\theta) = \prod_{i=1}^n f(t_i|\theta)^{\delta_i} \, S(t_i|\theta)^{1-\delta_i}$
& ~ & 
$\ell(\theta) = \log L(\theta)$ \\
%%%%%%%%% Univariate %%%%%%%%%
$\widehat{\theta}_n \stackrel{.}{\sim} N(\theta,\frac{1}{n \, I(\theta)})$
& ~ & 
$I(\theta) = -E \frac{\partial^2}{\partial\theta^2} \log f(X|\theta)$ \\
$\widehat{v}_n = 1/-\ell^{\prime\prime}(\widehat{\theta})$
& ~ &
$S_{\widehat{\theta}} = \sqrt{\,\widehat{v}_n}$ \\
% $se = \sqrt{\,\widehat{v}_n}$ \\
95\% CI: $\widehat{\theta} \pm 1.96 \times S_{\widehat{\theta}}$ 
& ~ &
$Z_n = \frac{\widehat{\theta}-\theta_0}{S_{\widehat{\theta}}}$ \\
If $g: \mathbb{R} \rightarrow \mathbb{R}$
& ~ &
$g(\widehat{\theta}) \stackrel{.}{\sim} 
    N\left( g(\theta), g^\prime(\theta)^2 \, v_n \right)$ \\
%%%%%%%%% Multivariate %%%%%%%%%
$ \widehat{\boldsymbol{\theta}}_n \stackrel{.}{\sim} N_k\left(\boldsymbol{\theta}, \frac{1}{n} \boldsymbol{\mathcal{I}}(\boldsymbol{\theta})^{-1}\right )$
& ~ &
$ \boldsymbol{\mathcal{I}}(\boldsymbol{\theta}) = \left[-E\left(\frac{\partial^2}{\partial\theta_i\partial\theta_j}
\log f(Y;\boldsymbol{\theta})\right)\right]$ 
\\
$\mathbf{H}(\boldsymbol{\theta}) = \left[-\frac{\partial^2} {\partial\theta_i\partial\theta_j} \ell(\boldsymbol{\theta}) \right]$
& ~ &
$\widehat{\mathbf{V}}_n = \mathbf{H}(\boldsymbol{\widehat{\theta}})^{-1}$ estimates
$\frac{1}{n} \boldsymbol{\mathcal{I}}(\boldsymbol{\theta})^{-1}$
\\
If $g: \mathbb{R}^k \rightarrow \mathbb{R}$ & ~ & \\
\.{g}$(\boldsymbol{\theta}) = \left( \frac{\partial g}{\partial\theta_1}, \ldots ,  \frac{\partial g}{\partial\theta_k} \right)$
& ~ &
$g(\widehat{\boldsymbol{\theta}}) \stackrel{.}{\sim} 
    N\left( g(\boldsymbol{\theta}), \mbox{\.{g}}(\boldsymbol{\theta}) \mathbf{V}_n \,
     \mbox{\.{g}}(\boldsymbol{\theta})^\top \right)$ 
\\
$G^2 = -2 \log \left(   
           \frac{\max_{\boldsymbol{\theta} \in \Theta_0} L(\boldsymbol{\theta})}
                {\max_{\boldsymbol{\theta} \in \Theta}   L(\boldsymbol{\theta})}
           \right) 
     = -2 \log \left( \frac{L(\widehat{\boldsymbol{\theta}}_0)}
                           {L(\widehat{\boldsymbol{\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})$
\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%% Survival and Hazard %%%%%%%%%%%%%%%%%%%%%%%%%%
$S(t) \stackrel{def}{=} P(T > t) = 1-F(t)$
& ~ &
$h(t) \stackrel{def}{=}  \lim_{\Delta \rightarrow 0} 
                            \frac{P(t < T < t + \Delta|T>t)}{\Delta}$, where $\Delta>0$
\\
$ h(t) = \frac{f(t)}{S(t)}$
& ~ &
$S(t) = \exp\{-\int_0^t h(x) \, dx\} = e^{-H(t)}$
\end{tabular}
% \hspace{10mm} 

\hspace{2mm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%% Distributions %%%%%%%%%%%%%%%%%%%%%%%%%%
% See earlier versions for material that was cut out.

{ \small
\begin{center}
\begin{tabular}{|l|l|c|c|c|} \hline
\textbf{Distribution} & \hspace{20mm} \textbf{Density} & $\mathbf{S(t)}$ & $\mathbf{E(T)}$ & \textbf{Median} \\ \hline \hline
Exponential & $f(t|\lambda) = \lambda e^{-\lambda t}$ for $t \geq 0$ 
&  $e^{-\lambda t}$ & $\frac{1}{\lambda}$  & $\frac{\log(2)}{\lambda}$\\ \hline
Weibull & $f(t|\alpha,\lambda) = \alpha\lambda(\lambda t)^{\alpha-1} \, \exp\{-(\lambda t)^\alpha \}$ for $t \geq 0$ 
&  $e^{-(\lambda t)^\alpha}$ & $\frac{\Gamma(1+1/\alpha)}{\lambda}$  & $\frac{\log(2)^{1/\alpha}}{\lambda}$ \\ \hline
Gumbel $G(\mu,\sigma)$ & $f(y|\mu,\sigma) = \frac{1}{\sigma} \, \exp\left\{ \left( \frac{y-\mu}{\sigma}\right) - e^{ \left(\frac{y-\mu}{\sigma}\right)}  \right\}$ & $e^{-e^{\left( \frac{t-\mu}{\sigma} \right)}}$ & $\sigma\Gamma^\prime(1)+\mu$  & $\sigma\log(\log(2)) + \mu$ \\ \hline
Log-normal & $ f(t|\mu,\sigma^2) = \frac{1}{\sigma \sqrt{2\pi}} \,  
    \exp -\left\{{\frac{(\log(t)-\mu)^2} {2\sigma^2}}\right\} \, \frac{1}{t} $  for $t \geq 0$&
   & $e^{\mu + \frac{1}{2}\sigma^2}$ & $e^\mu$ \\ \hline
\end{tabular} \vspace{2mm}
\end{center}
} % End size
\renewcommand{\arraystretch}{1.0}



\noindent
Log of standard exponential is Gumbel(0,1), also called the standard extreme value distribution.  \\
If $Z \sim G(0,1)$, MGF is $M_z(t)=\Gamma(t+1)$, $E(Z) = \Gamma^\prime(1)$, $Var(Z) = \frac{\pi^2}{6}$, and $Y = \sigma Z + \mu \sim G(\mu,\sigma)$. \\
Log of Weibull with $\alpha = 1/\sigma$ and $\lambda = e^{-\mu}$ is Gumbel$(\mu,\sigma)$. \\
%\vspace{1mm}

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

\noindent
Kaplan-Meier estimate: Discrete time.
\begin{itemize}
    \item $p_j = $ the probability of surviving past time $t_j$, given survival to time $t_{j-1}$. \\ $S(t_k) = \prod_{j=1}^k p_j$.
    %\item $\displaystyle S(t_k) = \prod_{j=1}^k p_j$.
    \item $d_j$ is the number of deaths at time $t_j$, and $n_j$ is the number of individuals at risk before time $t_j$. 
    \item $\widehat{p}_j  = \frac{n_j-d_j}{n_j}$,\hspace{5mm} 
          $\widehat{S}(t_k) = \prod_{j=1}^k \widehat{p}_j$,\hspace{5mm}
          $\widehat{S}(t) = \prod_{t_j \leq t} \widehat{p}_j$.
    \item $\widehat{S}(t) \stackrel{.}{\sim}
          N\left( S(t) , S(t)^2\sum_{t_j \leq t}  \frac{1-p_j}{n_jp_j} \right)$.
    \item The standard error of $\widehat{S}(t)$ is 
          $\widehat{S}(t)\sqrt{\sum_{t_j \leq t} \left(\frac{d_j}{n_j(n_j-d_j)}\right)}$. 
\end{itemize}


\noindent
Weibull Regression: $t_i = \exp\{\beta_0+\beta_1x_{i,1} + \ldots + \beta_{p-1}x_{i,p-1} \} \cdot \epsilon_i^\sigma = e^{\mathbf{x}_i^\top \boldsymbol{\beta}}\epsilon_i^\sigma$, 
where $\epsilon_1 \sim \exp(1)$.
        \begin{itemize}
            \item $t_i \sim$ Weibull, with $\alpha = 1/\sigma$ and  $\lambda = e^{-\mathbf{x}_i^\top \boldsymbol{\beta}}$.
            \item $E(t_i) = e^{\mathbf{x}_i^\top \boldsymbol{\beta}} \, \Gamma(\sigma + 1)$, 
                    Median($t_i$) = $e^{\mathbf{x}_i^\top \boldsymbol{\beta}} \, \log(2)^\sigma$, 
                    $h_i(t) = \frac{1}{\sigma} \exp\{-\frac{1}{\sigma}\mathbf{x}_i^\top \boldsymbol{\beta}\}t^{\frac{1}{\sigma}-1}$.
           % \item[] $S(t) = e^{ -\left( e^{-\frac{1}{\sigma}\mathbf{x}_i^\top \boldsymbol{\beta} } t^{\frac{1}{\sigma}} \right)}$
           \item $S(t) = \exp\left\{ - e^{-\frac{1}{\sigma}\mathbf{x}_i^\top \boldsymbol{\beta} } t^{\frac{1}{\sigma}} \right\}$
        \end{itemize}

\noindent
Log-normal Regression Regression: $t_i = \exp\{\beta_0+\beta_1x_{i,1} + \ldots + \beta_{p-1}x_{i,p-1} \} \cdot \epsilon_i^\sigma = e^{\mathbf{x}_i^\top \boldsymbol{\beta}}\epsilon_i^\sigma$, 
where $\epsilon_1 \sim$ Log-normal(0,1).
        \begin{itemize}
            \item $t_i \sim$ Log-normal$(\mu,\sigma^2)$, with $\mu = e^{\mathbf{x}_i^\top \boldsymbol{\beta}}$.
            \item $E(t_i) = e^{\mathbf{x}_i^\top \boldsymbol{\beta}+ \frac{1}{2}\sigma^2} $, 
                    Median($t_i$) = $e^{\mathbf{x}_i^\top \boldsymbol{\beta}}$.
        \end{itemize}

\noindent
Proportional Hazards Regression
        \begin{itemize}
            \item $ h_i(t|\boldsymbol{\beta}) =  h_0(t) \,  e^{\mathbf{x}_i^\top \boldsymbol{\beta}}$.
            \item $\mbox{PL}(T) = \displaystyle \prod_{i=1}^D 
    \left( \frac{\displaystyle  e^{\mathbf{x}_{(i)}^\top \boldsymbol{\beta}} }
     {\displaystyle  \sum_{j \in R_{(i)}}  e^{\mathbf{x}_j^\top \boldsymbol{\beta}}} \right) $.
            \item $h_{i,j}(t_{i,j}) = h_0(t_{i,j}) \exp\{ \sigma z_i + \mathbf{x}_{i,j}^\top\boldsymbol{\beta} \}$
        \end{itemize}

\vspace{8mm} \hrule \vspace{3mm}

This formula sheet was prepared by  \href{http://www.utstat.toronto.edu/~brunner}{Jerry Brunner},
Department of Mathematical and Computational Sciences, University of Toronto Mississauga. 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/312s19} {\texttt{http://www.utstat.toronto.edu/$^\sim$brunner/oldclass/312s19}}
\end{center}

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


\end{document}




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

& ~~~~~ &
\\


%\multicolumn{3}{l} {$P(B_j|A) = \frac{P(A|B_j)P(B_j)}{\sum_{k=1}^n P(A|B_k)P(B_k)}$} 
% $P(B_j|A) = \frac{P(A|B_j)P(B_j)}{\sum_{k=1}^n P(A|B_k)P(B_k)}$ & & 
% \multicolumn{3}{l} {$P(B_j|A) = P(A|B_j)P(B_j) / \sum_{k=1}^n P(A|B_k)P(B_k)$} 

