% 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]{article} %,twocolumn
\documentclass[10pt]{article} %,twocolumn


\usepackage{times,amsmath,amsfonts}
\usepackage[dvips]{graphicx,graphics}
% Use following instead for LaTex 2.09 (may need some other mods as well).
%\documentstyle[times,twocolumn]{article}

% Set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{10in} \setlength{\textwidth}{6in}
%\setlength{\columnsep}{0.3125in} \setlength{\topmargin}{0in}
\setlength{\headheight}{0in} \setlength{\headsep}{-1in}
\setlength{\parindent}{1pc}
\setlength{\oddsidemargin}{-.3in}  % Centers text.
\setlength{\evensidemargin}{-.3in}

% 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: Homework 05}
% For single author (just remove % characters)
\author{Moo K. Chung\\
mchung@stat.wisc.edu}
% For two authors (default example)
\maketitle \thispagestyle{empty}

{\bf Due Date:} November 24, 1:20pm. No late assignments will be
accepted or graded. There will be $10\%$ bonus points for
exceptional solutions.


\begin{figure}
\centering
%\renewcommand{\baselinestretch}{1}
\includegraphics[scale=0.8]{homework05-1.eps}
\end{figure}

\begin{enumerate}

\item Simulate bivariate normal
$${\bf Z} =(X,Y)' \sim N(0, \Big[\begin{array}{cc}
                                     \sigma^2 & \rho\\
                                     \rho & \sigma^2 \end{array}\Big])$$
when $(\rho,\sigma)=(0.9, 0.5)$ using the Gibbs sampler. Plot your
Markov chains.

 \item $(3,2,4,2,1)$ are observations for model
 $$Y_i = \beta + \epsilon_i.$$ $\epsilon_i \sim N(0,1)$ and prior $\beta|\gamma \sim N(\gamma,1)$, $\gamma
 \sim N(2,1)$. Estimate $\beta$ based on the Gibbs sampling
 method.


 \item From $\tt{strengh.data}$, fit the model
$${\tt grip}_i = \beta_0 + \beta_1 {\tt arm}_i + \epsilon_i,$$
using the Gibbs sampler. $\epsilon_i \sim N(0,3^2)$ and the priors
are $\beta_0 \sim N(110, 3^2)$ and $\beta_1 \sim N(1,1)$. Compare
your result with the least squares estimation method we studied.

\item Download data
$\tt{http://www.stat.wisc.edu/~mchung/teaching/data/bainslice2}$
and run the following codes.
\begin{verbatim}
load brainslice2; intensity=reshape(brainslice2,256*124,1);
intensity=intensity(find((intensity >=50)&(intensity<=250)));
imagesc(brainslice2);colormap('bone');colormap;
hist(intensity,100);
\end{verbatim}
You should get 19,660 values for $\tt{intensity}$ which are gray
scale values between 50 and 250 of the magnetic resonance image
(MRI) of the human brain. Let $y_1,\cdots ,y_{19660}$ be the
observations. From the histogram below, we see that the image
intensity can be modelled as the mixture of normals such that the
probability density is given by
$$f(y) = p f_1(y) + (1-p)f_2(y) \mbox{   : two component Gaussian mixture model}$$
where $f_1 \sim N(\mu_1,\sigma_1^2)$ and $f_2 \sim
N(\mu_2,\sigma_2^2)$. Assume $\mu_1=170,\sigma^2=20^2, \mu_2=210,
\sigma_2^2=10^2$. Estimate parameter $0<p<1$ by maximizing the
likelihood function using the EM algorithm. Use both deterministic
and Monte-Carlo versions.  What this parameter $p$ measure?
\end{enumerate}
\end{document}
