\documentclass[11pt]{article}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{latexsym}
\usepackage{epsfig}

\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}


\newcommand{\handout}[5]{
   \renewcommand{\thepage}{#1-\arabic{page}}
   \noindent
   \begin{center}
   \framebox{
      \vbox{
    \hbox to 5.78in {{\sf STAT C206A / MATH C223A : Stein's method and applications} 
\hfill \sf #2 }
       \vspace{4mm}
       \hbox to 5.78in { {\Large \hfill #5  \hfill} }
       \vspace{2mm}
       \hbox to 5.78in { {\em #3 \hfill #4} }
      }
   }
   \end{center}
   \vspace*{4mm}
}

\newcommand{\lecture}[4]{\handout{#1}{#2}{Lecture date: #3}{Scribe: #4}{Lecture #1}}


\textwidth=6in
\oddsidemargin=0.25in
\evensidemargin=0.25in
\topmargin=-0.1in
\footskip=0.8in
\parindent=0.0cm
\parskip=0.3cm
\textheight=8.00in
\setcounter{tocdepth} {3}
\setcounter{secnumdepth} {2}
\sloppy


\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{question}[theorem]{Question}
\newtheorem{answer}[theorem]{Answer}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{example}[theorem]{Example}
\newenvironment{proof}{\noindent \textbf{Proof:}}{$\Box$}
%\newtheorem*{lemma*}{Lemma}

\newcommand{\ignore}[1]{}

%\newcommand{\convd}{\stackrel{d}{\to}}
\newcommand{\convd}{\Longrightarrow}



\renewcommand{\Pr}{{\bf P}}
\renewcommand{\P}{{\bf P}}
\newcommand{\Px}{\mathop{\bf P\/}}
\newcommand{\E}{{\bf E}}
\newcommand{\Ex}{\mathop{\bf E\/}}

\newcommand{\Var}{{\rm Var}}
\newcommand{\Cov}{{\rm Cov}}
\newcommand{\Varx}{\mathop{\rm Var\/}}

\newcommand{\bits}{\{-1,1\}}

\newcommand{\nsmaja}{\textstyle{\frac{2}{\pi}} \arcsin \rho}

\newcommand{\Inf}{\mathrm{Inf}}
\newcommand{\I}{\mathrm{I}}
\newcommand{\J}{\mathrm{J}}

\newcommand{\eps}{\epsilon}
\newcommand{\lam}{\lambda}
\newcommand{\N}{\mathbb N}
\newcommand{\R}{\mathbb R}
\newcommand{\Z}{\mathbb Z}
\newcommand{\C}{\mathbb C}
\newcommand{\cb}{\mathcal{B}}
\newcommand{\cd}{\mathcal{D}}

\newcommand{\CalE}{{\mathcal{E}}}

\newcommand{\CalU}{{\mathcal{U}}}
\newcommand{\F}{{\mathcal{F}}}
\newcommand{\CalC}{{\mathcal{C}}}
\newcommand{\CalM}{{\mathcal{M}}}
\newcommand{\CalR}{{\mathcal{R}}}
\newcommand{\CalS}{{\mathcal{S}}}
\newcommand{\CalV}{{\mathcal{V}}}
\newcommand{\CalX}{{\boldsymbol{\mathcal{X}}}}
\newcommand{\CalG}{{\boldsymbol{\mathcal{G}}}}
\newcommand{\CalY}{{\boldsymbol{\mathcal{Y}}}}
\newcommand{\CalZ}{{\boldsymbol{\mathcal{Z}}}}
\newcommand{\CalF}{{\mathcal{Z}}}
\newcommand{\boldG}{{\boldsymbol G}}
\newcommand{\boldQ}{{\boldsymbol Q}}
\newcommand{\boldR}{{\boldsymbol R}}
\newcommand{\boldS}{{\boldsymbol S}}
\newcommand{\boldX}{{\boldsymbol X}}
\newcommand{\bfX}{{\boldsymbol X}}
\newcommand{\boldB}{{\boldsymbol B}}
\newcommand{\boldY}{{\boldsymbol Y}}
\newcommand{\boldZ}{{\boldsymbol Z}}
\newcommand{\boldV}{{\boldsymbol V}}
\newcommand{\boldsigma}{{\boldsymbol \sigma}}
\newcommand{\boldupsilon}{{\boldsymbol \upsilon}}
\newcommand{\hone}{{\boldsymbol{H1}}}
\newcommand{\htwo}{\boldsymbol{H2}}
\newcommand{\hthree}{\boldsymbol{H3}}
\newcommand{\hfour}{\boldsymbol{H4}}
\newcommand{\poly}{\boldsymbol{poly}}


\newcommand{\sgn}{\mathrm{sgn}}
\newcommand{\Maj}{\mathrm{Maj}}
\newcommand{\Thr}{\mathrm{Thr}}
\newcommand{\littlesum}{{\textstyle \sum}}

\newcommand{\half}{{\textstyle \frac12}}

\newcommand{\Stab}{\mathbb{S}}
\newcommand{\StabThr}[2]{\Gamma_{#1}(#2)}
\newcommand{\TestFcn}{\Psi}

\renewcommand{\phi}{\varphi}
\def \la      {\langle}
\def \ra      {\rangle}





\begin{document}
\lecture{3}{1}{Aug 31, 2007}{David Rosenberg}


%\maketitle
\section{First step in Stein's method}

Suppose you have a r.v.\ $W$ and a standard gaussian r.v.\ $Z$ and you want to bound\[
\sup_{g\in\cd}\left|\Ex g(W)-\Ex g(Z)\right|,\]
where $\cd$ is some given class of functions.
The first step is to find another class of functions $\cd'$ such that 

\begin{equation}\label{steinidea}
\sup_{g\in\cd}\left|\Ex g(W)-\Ex g(Z)\right|\le\sup_{f\in\cd'}\left|\Ex\left(f'(W)-Wf(W)\right)\right|.
\end{equation}
 
Stein's idea: If $\cd'$ is a class of functions such that for every
$g\in\cd$, $\exists f\in\cd'$ s.t. 
\begin{equation}\label{steineq}
f'(x)-xf(x)=g(x)-\Ex g(Z)
\end{equation}
for $Z\sim N(0,1)$, then \eqref{steinidea} holds. (This o.d.e.\ is sometimes called the `Stein equation'.) Indeed, take any $g\in\cd$, and find $f\in \cd'$ that solves the above equation. Then\begin{align*}
\Ex g(W)-\Ex g(Z) & =\Ex\left[g(W)-\Ex g(Z)\right]\\
 & =\Ex\left(f'(W)-Wf(W)\right).\end{align*}
Clearly, given $\cd$ it is in our interest to have $\cd'$ as small as possible.

\begin{lemma}
{\rm (Stein)} Given a function $g:\R\to\R$ that is bounded,
$\exists$ absolutely continuous $f$ solving $f'(x)-xf(x)=g(x)-\Ex g(Z)$
for all $x$, satisfying\begin{align*}
\left|f\right|_{\infty} \le\sqrt{\frac{\pi}{2}}\left|g-Ng\right|_{\infty} \ \text{ and } \ 
\left|f'\right|_{\infty}  \le2\left|g-Ng\right|_{\infty}\end{align*}
{\rm(}where $\left|f\right|_{\infty}=\sup_{x\in\R}\left|f(x)\right|$,
$Ng:=\Ex g(Z),Z\sim N(0,1)${\rm).}

If $g$ is Lipschitz, but not necessarily bounded, then \begin{align*}
\left|f\right|_{\infty}\le  \left|g'\right|_{\infty}, \ \ 
\left|f'\right|_{\infty}\le  \sqrt{\frac{2}{\pi}}\left|g'\right|_{\infty}, \ \text{ and } \
\left|f''\right|_{\infty}\le  2\left|g'\right|_{\infty}.\end{align*}
\end{lemma}
Actually, the third and fourth inequalities are not due to Stein, but were obtained later.

{\bf Exercise 1:} Show that all five constants are the best possible.

So we can now take $\cd'$ to be these $f$'s (which in particular
have the given bounds).

The above lemma tells us, for instance, that
 \[
\mbox{Wass}(W,Z)\le\sup\left\{ \left|\Ex\left(f'(W)-Wf(W)\right)\right| : |f|_\infty\le1,|f'|_\infty \le\sqrt{2/\pi},|f''|_\infty\le2\right\}. \]

\section{Example: Ordinary CLT in the Wasserstein metric}
Suppose $X_{1},X_{2},\ldots,X_{n}$ are independent, mean $0$, variance
$1$, $\Ex|X_{i}|^{3}<\infty$. Let $S_{n}=\sum_1^n X_{i}$. Take any $f\in C^1$ with $f'$ absolutely continuous, and satisfying $|f|\le1$,$|f'|\le\sqrt{2/\pi}$, and $|f''|\le2$. First, note that
\begin{equation}\label{eq1}
\Ex Wf(W)=\frac{1}{\sqrt{n}}\sum\Ex\left(X_{i}f(W)\right).
\end{equation}
Now let 
\[
W_{i}=W-\frac{X_{i}}{\sqrt{n}}=\frac{\sum_{j\neq i}X_{j}}{\sqrt{n}}
\]
Then $X_{i},W_{i}$ are independent.  Thus\[
\Ex X_{i}f(W_{i})=\underbrace{\Ex(X_{i})}_{=0}\Ex f(W_{i})=0\]
 and so
\begin{align*}
\Ex\left(X_{i}f(W)\right)= & \Ex\left(X_{i}\left(f(W)-f(W_{i})\right)\right)\\
= & \Ex\left(X_{i}\left(f(W)-f(W_{i})-(W-W_{i})f'(W_{i})\right)\right)\\
 & +\Ex\left[X_{i}(W-W_{i})f'(W_{i})\right].
 \end{align*}
 Note that\[
\left|f(b)-f(a)-(b-a)f'(a)\right|\le\frac{1}{2}(b-a)^{2}\left|f''\right|_{\infty}\]
 and that $W-W_{i}=X_{i}/\sqrt{n}$. Thus\begin{align*}
 & \left|\Ex\left[X_{i}\left(f(W)-f(W_{i})-\frac{X_{i}}{\sqrt{n}}f'(W_{i})\right)\right]\right|\\
&\le  \frac{1}{2}\Ex\left|X_{i}\frac{X_{i}^{2}}{n}\right|\cdot\left|f''\right|_{\infty}\le \frac{1}{n}\Ex\left|X_{i}\right|^{3}.
\end{align*}
Again,
 \begin{align*}
\Ex\left[X_{i}\left(W-W_{i}\right)f'(W_{i})\right] & =\frac{1}{\sqrt{n}}\Ex X_{i}^{2}f'(W_{i})\\
 & =\frac{1}{\sqrt{n}}\Ex f'(W_{i})\end{align*}
 since $\Ex X_{i}^{2}=1$ and $X_i$ is independent of $W_i$.

From \eqref{eq1} and the above calculation we see that\[
\left|\Ex Wf(W)-\frac{1}{n}\sum\Ex f'(W_{i})\right|\le\frac{1}{n^{3/2}}\sum_{i=1}^{n}\Ex\left|X_{i}\right|^{3}.
\]
Finally, note that\begin{align*}
 \left|\frac{1}{n}\sum\Ex f'(W_{i})-\Ex f'(W)\right|
&\le  \frac{|f''|_{\infty}}{n}\sum\Ex\left|W-W_{i}\right|\\
&=  \frac{\left|f''\right|_{\infty}}{n^{3/2}}\sum\Ex|X_{i}|\le\frac{2}{n^{3/2}}\sum\Ex\left|X_{i}\right|.
\end{align*}
Combining, we have\begin{align*}
 & \left|\Ex f(W)W-\Ex f'(W)\right|\\
&\le  \frac{1}{n^{3/2}}\sum\Ex\left|X_{i}\right|^{3}+\frac{2}{n^{3/2}}\sum\Ex\left|X_{i}\right|.
\end{align*}
Since $\Ex X_{i}^{2}=1$ we can conclude that $\Ex|X_i|^3 \ge 1$ and hence $\Ex|X_{i}|\le\left(\Ex|X_{i}|^{3}\right)^{1/3}\le \Ex|X_i|^3$.
%which implies that $\Ex|X_{i}|\le\Ex|X_{i}|^{3}$. So we can clean
%thing sup and write\[
%\left|\Ex f(w)w-\Ex f'(w)\right|\le\frac{3}{n^{3/2}}\sum\Ex\left|X_{i}\right|^{3}\]
% In thie iid case, this gives \[
%3\Ex\left|X_{i}\right|^{3}/\sqrt{n}\]
We have now arrived at a `Berry-Ess\'een bound' for the Wasserstein metric:
\begin{theorem}
Suppose $X_1,\ldots,X_n$ are independent with mean $0$, variance $1$, and finite third moments. Then
\[
\mathrm{Wass}\left(\frac{\sum_1^n X_i}{\sqrt{n}},\, Z\right) \le \frac{3}{n^{3/2}}\sum_1^n\Ex\left|X_{i}\right|^{3},
\]
where $Z\sim N(0,1)$.
\end{theorem}
Unfortunately, this isn't a real Berry-Ess\'een bound, since it's a bound
on the Wasserstein metric and not the Kolmogorov metric. From a lemma proved in Lecture 2, we can get \begin{align*}
\mbox{Kolm}(W,Z)&\le 2\sqrt{\frac{1}{\sqrt{2\pi}}\mbox{Wass}(W,Z)}=  \frac{2}{\left(2\pi\right)^{1/4}}\sqrt{\mbox{Wass}(W,Z)}.
\end{align*}
But this is of order $n^{-1/4}$, which is suboptimal. 

{\bf Exercise 2:} Get the true Berry-Ess\'een bound using Stein's method. This involves analyzing the solution of the Stein equation \eqref{steineq} for $g(x) = 1_{\{x\le t\}}$ for arbitrary $t\in \R$.

{\bf Exercise 3:} Consider Erd\H os-R\'enyi graph $G(n,p)$. Has $n$ vertices and  $\binom{n}{2}$
possible edges, each edge being open or closed with prob $p$ and $1-p$, independently of each other.
Let $T_{n}=\mbox{number of triangles in this graph}$. Find a way to use Stein's method to prove the CLT
for $T_{n}$ when (a) $p$ is fixed, and (b) $p$ is allowed to go to zero with $n$.



\end{document}

