% 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[11pt,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 10\\
Monte-Carlo Integral.}
% 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 The constant $\pi$ is usually computed by summing up infinite series, i.e.$$\pi=4\Big(1-\frac{1}{3}+ \frac{1}{5} - \frac{1}{7} + \cdots\Big).$$
There is a slightly different way to estimate the digits of $\pi$ based on a computer simulation. Let $A$ be the area of a quarter circle with unit radius bounded by a unit square $B$. Suppose we throw darts at the square at random. Define binary random variable $X=1$ if a dart hits $A$ and $X=0$ if it hits $A^{c}$. Note that $$\mathbb{E} X = \int_{A} \;dx dy = \frac{\pi}{4}.$$ Note that the sample mean $\bar X_n=\sum_{i=1}^n X_i/n$ converges to $\mathbb{E} X$ as $n \to \infty$. So
$$\pi= 4\lim_{n \to \infty} \bar X_n.$$
\begin{verbatim}
x=rand(100000,1);y=rand(100000,1);
rsquare=x.^2+y.^2;
accept=find(rsquare <1);
>> accept'
ans =
     2 3 4 5 6 7 8 10 11 15 ...
plot(x(accept),y(accept),'.')
>>4*size(accept,1)/1000000
ans =
    3.1336
\end{verbatim}

\begin{figure}
\centering
\includegraphics[scale=0.32]{lecture10-1.eps}
\end{figure}

\item There are many Monte-Carlo techniques for evaluating
integrals. The above method is based on generating specific random
numbers. In general if we know how to generate random variable $X
\sim f$, we can generate $g(X)$. So
$$\mathbb{E} g(X) = \int g(x)f(x) \; dx.$$
$\mathbb{E}g(X)$ can be approximated by the sample mean $\bar
g(X)=\sum_{i=1}^n g(X_i)/n$. What if you want to compute $\int
g(x) \; dx$ ? Note that
$$\int g(x) \; dx = \int \frac{g(x)}{f(x)} f(x)\; dx =
\mathbb{E}\frac{g(X)}{f(X)}.$$ So we generate random numbers
$g(X)/f(X)$.

\item Empirical distribution. Estimate the cumulative distribution
of the standard normal using the Monte-Carlo integration method.
$$\Phi(x)=\int_{-\infty}^x \frac{e^{-x^2/2}}{\sqrt{2\pi}} \; dx.$$
Let $g$ be a index function defined as\\ $g(y) =
\mathbb{I}_{x}(y)=0$ if $y \leq x$ and 1 if $y > x$. Then
$\Phi(x)=\mathbb{E}\mathbb{I}_x(Z),$ where $Z \sim N(0,1)$. For
given $x$, $\mathbb{E}\mathbb{I}_x(Z)$ is estimated by the
proportion of the random numbers that is less than $x$. This is
true for an arbitrary cumulative distribution function and we call
this Monte-Carlo estimate as the empirical (cumulative)
distribution.


\end{enumerate}
 Interesting paper by John Von Neumann (1951): Various techniques
used in connection with random digits. Proceedings of Symposium on
¡°Monte Carlo Method¡± (held June. July, 1949, in Los Angeles),
chapter 13. Summary written by G. E. Forsythe, Journal of Research
of the National Bureau of Standards {\bf 12} 36-38. Next lecture
topic is about variance reduction in MC.

\end{document}
