
% BB Sep 11, 2008. Changes for Gaussian qdf and bootstrap.
% BB Sep 05, 2007.
% BB Nov 21, 2006.
% BB Aug 28, 2005.

\documentclass[20pt,landscape,footrule]{foils}
\usepackage[dvips]{graphicx}
\usepackage[pdftex]{geometry}
\geometry{headsep=3ex,hscale=0.9}
\usepackage[pdftex]{color} % for the colored block
% \date{\color{blue} Leipzig University, December 16, 2004}
\date{\color{blue} FSU,  August 31, 2006}
\usepackage[ignore]{pause}
% \usepackage{pause}
\usepackage{background}
%\usepackage{pp4slide}
%\MyLogo{AV HEP,CSIT}
\LogoOff
\begin{document}
\def\r{\color{red}}
\def\b{\color{blue}}
\def\s{\color{black}}

\foilhead{\r Lecturenotes Statistics I -- Contents}\b \vskip 0.0pt
\begin{enumerate}
\item Uniform and General Distributions
\item Confidence Intervals, Cumulative Distribution Function and Sorting
\end{enumerate}
 
\foilhead{\r Uniform and General Distributions}\b \vskip -30.0pt
Uniform distribution (probability density):
$$\s u(x) = \cases{ 1~~{\rm for}~~0\le x < 1;\cr
                    0 ~~{\rm elsewhere}. } $$ \b
The corresponding (cumulative) distribution function is \s
$$ U(x) = \int_{-\infty}^x u(x')\,dx' = \cases{
   0~~{\rm for}~~x<0;\cr
   x~~{\rm for}~~0\le x\le 1;\cr 1~~{\rm for}~~x>1.} $$ \b
It allows for the construction of general probability distributions.  
Let \s
$$ y = F(x) = \int_{-\infty}^x f(x')\,dx'\ . $$ \b

\foilhead{\r } \b \vskip -50.0pt
For \s $y^r$ \b being a uniformly distributed random variable in 
\s $[0,1)$: $x^r = F^{-1} (y^r)$ \b is then distributed according 
to the probability density $\s f(x).$ \bigskip

{\r\bf Example:} Mapping of the uniform to the {\r Cauchy distribution.}
$$\s f_c(x) = {\alpha \over \pi\, (\alpha^2+x^2)} ~~{\rm and}~~ F_c(x) 
     = \int_{-\infty}^x f_c(x')\,dx' = {1\over 2} + {1\over\pi}\,
     \tan^{-1} \left( {x\over\alpha} \right),\ \alpha>0\, . $$
The Cauchy distributed random variable $\s x^r$ is generated from the 
uniform $\s y^r\in[0,1)$ through 
$$\s \frac{x^r}{\alpha} = \tan\left(\pi y^r-\frac{\pi}{2}\right)\ \
     \Leftrightarrow\ \ x^r = \alpha\,\tan (2\pi y^r)\,. $$

\begin{figure} \begin{center}
\includegraphics[height=0.7\textheight]{figures/gdf.pdf}
% \caption{\small Mapping of the uniform to the Cauchy distribution.}
\end{center} \end{figure}

In STMC/Forlib: {\tt rmacau.f}.

\foilhead{\r Gaussian Distribution}\vskip -20pt \b
The Gaussian or {\bf normal distribution} is of major 
importance. Its probability density is 
$$\s g(x) = {1\over \sigma \sqrt{2\pi}}\, e^{-x^2/(2\sigma^2)} $$
where $\s \sigma^2$ is the {\bf variance} and $\s \sigma > 0$ the
{\bf standard deviation}. The Gaussian distribution function 
$\s G(x)$ is related to that of variance $\s \sigma^2=1$ by 
$$\s G(x) = \int_{-\infty}^x g(x')\,dx' = {1\over \sqrt{2\pi}}
     \int_{-\infty}^{x/\sigma} e^{-(x'')^2/2}\, dx'' = {1\over 2} 
   + {1\over 2}\, {\rm erf} \left( {x\over \sigma\sqrt{2}} \right)\ .$$
\b In principle we could now generate {\bf Gaussian random numbers}. 
However, the numerical calculation of the inverse error function 
is slow and makes this an impractical procedure. Much faster is 
to express the product probability density of two independent 
Gaussian distributions in polar coordinates
$$\s {1\over 2\pi\,\sigma^2}\,e^{-x^2/(2\sigma^2)}\,e^{-y^2/(2\sigma^2)}
\, dx\,dy ={1\over 2\pi\,\sigma^2}\,e^{-r^2/(2\sigma^2)}\,d\phi\,rdr\,,$$
and to use the relations \s $x^r = r^r\, \cos \phi^r$, 
$y^r = r^r\, \sin \phi^r\,.$

% \begin{figure} \begin{center}
% \includegraphics[height=0.5\textheight]{figures/df.pdf}
% \end{center} \end{figure} 

\noindent {\r Assignments {\tt a0104\_01} and {\tt a0104\_02}:} \b

\noindent Probability densities and cumulative distribution functions
for the uniform in $\s [-1,+1)$, a Gaussian and a Cauchy distribution.


\foilhead{\r Confidence Intervals and Sorting}\b \vskip -20pt

\noindent One defines {\bf ${\bf q}$-tiles} (also {\bf quantiles} or 
{\bf fractiles}) $\s x_q$ of a distribution function by 
$$\s F(x_q)\ =\ q\ . $$
An example is the {\bf median} $\s x_{1\over 2}.$ The probability 
content of the {\bf confidence interval}
$$\s [x_q,x_{1-q}] ~~{\rm is}~~ p=1-2q\ .$$
Example: {\r Gaussian or normal distribution} of variance 
$\s \sigma^2:$
$$\s [-n\sigma,+n\sigma]\ \Rightarrow\ p=0.6827\ {\rm for}\ n=1,~~
     p=0.9545\ {\rm for}\ n=2\ .$$
The {\bf peaked distribution function} 
$$\s F_q(x) = \cases{ F(x)\ {\rm for}\ F(x) \le {1\over 2},\cr
                 1 - F(x)\ {\rm for}\ F(x) > {1\over 2}.} $$
provides a graphical visualization of probability intervals of
such a distribution:
%
\begin{figure} \begin{center}
\includegraphics[height=0.5\textheight]{figures/gqdf.pdf}
% \caption{\small Gaussian peaked distribution function and estimates 
% of $x_q$ for the 70\% (approximately $1\,\sigma$) and 95\% 
% (approximately $2\,\sigma$) confidence intervals.}
\end{center} \end{figure}

\noindent {\r Sorting} allows for an empirical estimate. Assume we 
generate $\s n$ random number $\s x_1,...,x_n$. We may re-arrange 
the $\s x_i$ in increasing order:
$$\s x_{\pi_1} \le x_{\pi_2} \le \dots \le x_{\pi_n} $$
where $\s \pi_1,\dots , \pi_n$ is a permutation of $\s 1,\dots ,n$.

\noindent In Statistics and Mathematics the random variables 
$\s x_{\pi_1},\,x_{\pi_2},\, \dots \ x_{\pi_n}$
are called {\bf order statistics}.

An estimator for the distribution function $\s F(x)$ is 
then the {\bf empirical distribution function}
$$\s \overline{F} (x) = {i\over n}~~~{\rm for}~~~x_{\pi_i} \le x <
     x_{\pi_{i+1}},\ i=0, 1,\dots , n-1, n $$
with the definitions $\s x_{\pi_0}=-\infty$ and $\s x_{\pi_{n+1}} =
+\infty$. To calculate $\s \overline{F}(x)$ one needs an efficient way 
to {\bf sort} $n$ data values in ascending (or descending) order. In 
the STMC package this is provided by a {\bf heapsort} routine, which 
arrives at the results in $\s O(n\,\log_2 n)$ steps.

\noindent Example: {\r Gaussian distribution in assignment 
          {\tt a0106\_02a}} (200 and 20,000 data). 

\noindent Download {\r\tt a0106\_02a} from the classwork website.
Compile and run the programs. Plot with {\r\tt gau\_qdf.plt} 
(the other gnuplot drivers are for special purposes).
\vskip 20pt


\foilhead{\r Statistical Bootstrap: Example Opinion polls.}
\b \vskip -20pt

We are used to statements that according to a poll an opinion has 
changed by a certain percentage. The {\r statistical significance} 
is often not addressed. One can figure that out based on multinomial 
distributions, but the analytical approach tends to become cumbersome. 
Modern PCs allow to {\r bootstrap the confidence levels} with methods 
we just introduced. 

To be specific, we address the situation that a poll of {\tt\s NDAT} 
people has been taken, where each person has to vote for one of {\tt\s
NCH} distinct candidates, or stay undecided. The outcome are estimates 
of the true probabilities for these choices. We estimate the {\r 
confidence limits of these probabilities} by using them as input to 
{\r simulate the polling process {\tt\s NPOLL} times,}
where {\tt\s NPOLL} has to be a sufficiently large number. 
Thus we obtain an empirical peaked distribution functions 
for each outcome probability. 

\newpage

The program {\tt\s polls.f} (download from the classwork
page) performs the task of simulating opinion polls. It is
preset to results from an opinion poll in the early stage of the 
1992 US presidential election. At that time there were three 
candidates: George Bush (senior), Bill Clinton and Ross Perot.
A poll of {\tt\s NDAT = 700} people had given {\r {\s 42\%} for Bush, 
{\s 38\%} for Clinton, {\s 16\%} for Perot,} and the rest undecided.
The question is: To what extent {\r is the advantage for Bush 
versus Clinton is statistically significant?} Using the probabilities 
of the poll as input, we simulate the polling {\tt\s NPOLL = 10,000} 
times.

Output are {\r peaked distribution functions, which overlap for
Bush and Clinton} at a probability of {\s 0.14.} That is not yet 
the result for the likelihood that Clinton wins, because the 
distributions are correlated. The estimate for the probabilities of 
the election outcome is obtained by simply counting the wins of Clinton
versus those of Bush and dividing the draws (possible due to the small 
number of peoples asked) equally between the two. In this way we get 
a {\r probability of {\s 11.8\%} that Clinton wins,} while {\r Bush 
wins with {\s 88.2\%} probability.} \bigskip

\centerline{With a {\s 5\%} cut-off this is still in the {\r dead heat.}}

\end{document}
