% 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,twocolumn]{article} %,twocolumn

%\usepackage{times,amsmath,amsfonts}

% Use following instead for LaTex 2.09 (may need some other mods as well).
%\documentstyle[times,twocolumn]{article}
\usepackage[dvips]{graphicx,graphics}
% Set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{10in} \setlength{\textwidth}{7in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.5in}  % Centers text.
\setlength{\evensidemargin}{-.5in}

% 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}

% Make title bold and 14 pt font (Latex default is non-bold, 16pt)
\title{Stat 471: Lecture 7\\
Diagonalization.}
% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle \thispagestyle{empty}

\begin{enumerate}

\item Go to ${\tt www.infinityassociates.com}$ to download ${\tt
MATLAB}$ examples in the textbook.


\item Other factorization technique for covariance matrix $V$.
Suppose $V$ has positive eigenvalues $\lambda_i$ and corresponding
normalized eigenvectors $e_i$. Let $Q=(e_1,e_2,e_3)$. Then $QQ'=I$
and $V=QDiag(\lambda_1, \lambda_2, \lambda_3)Q'.$ So
$V^{1/2}=QDiag(\lambda_1^{1/2}, \lambda_2^{1/2},
\lambda_3^{1/2})Q'.$ For $z \sim N(0,I)$, $w=V^{1/2}z \sim
N(0,V)$.
\begin{verbatim}
>>V=[2 1
     1 2]
>> [Q D]=eig(V)
Q = -0.7071    0.7071
     0.7071    0.7071
D =  1     0
     0     3
>> Q*D.^(1/2)*Q'
ans = 1.3660    0.3660
      0.3660    1.3660
>> V^(1/2)
ans = 1.3660    0.3660
      0.3660    1.3660
>>w=V^(1/2)*[z1 z2]';
\end{verbatim}


\begin{figure}
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.4]{lecture07-1.eps}
\end{figure}

\item Review of lecture 6. For given bivariate data
$w_i=(x_i,y_i)$, we computed the sample covariance matrix $\hat
V$. Then we estimated the Cholesky factor of $\hat V$. Based on
this, $w=V^{1/2}z + \mu$ becomes $z=\hat V^{-1/2}(w-\mu) \sim
N(0,I)$. So we can test if $w_i$ are from bivariate normal by
checking if $z_i \sim N(0,1)$.

\begin{verbatim}
>>hatV=cov(w(1,:),w(2,:));
>>z=hatV^(-1/2)*(w-mean(w,2));
>>qqplot(z(1,:));qqplot(z(2,:))
\end{verbatim}



\begin{figure}
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.4]{lecture07-2.eps}
\end{figure}

\begin{figure}
\centering
\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.4]{lecture07-3.eps}
\end{figure}

\item Consider linear equation
$$\left(%
\begin{array}{cc}
  2 & 1 \\
  4 & 2 \\
\end{array}%
\right)\left(%
\begin{array}{c}
  y_1 \\
  y_2 \\
\end{array}%
\right) = \left(%
\begin{array}{c}
  1 \\
  1 \\
\end{array}%
\right).$$ There is no exact solution but it is possible to get a
solution in the least-squares sense. Note that
$$2y_1 + y_2 -1 = \epsilon_1, 4y_1 + y_2 -1 = \epsilon_2.$$
Minimize the sum of squared errors, $\min (X\beta -c)'(X\beta-c),$
where $c=(1,1)', \beta=(y_1,y_2)'$ and $X=\left(%
\begin{array}{cc}
  2 & 1 \\
  4 & 2 \\
\end{array}%
\right).$ $\frac{\partial}{\partial \beta} \beta'A = A,
\frac{\partial}{\partial \beta} \beta'A\beta = 2A\beta.$ Then it
can be shown that $\hat \beta = (X'X)^{-1}X'c$.
\end{enumerate}
\end{document}
