6
$\begingroup$

Let's say I'm in the business of sampling from the standard normal distribution. And let's ignore floating point issues and other numerical inaccuracies for the moment. Say I want to be lazy and instead of drawing an exact sample from the normal distribution I only get the first 3 digits beyond the decimal point right. After that I just add uniformly random digits. It seems to me that the random number I'm sampling in this fashion will still be fairly close to normally distributed. But in what sense? What kind of formal statement could one make here?

$\endgroup$
6
$\begingroup$

Let $\hat Z$ denote the number that your procedure generates from $Z\sim\text{Normal}(0,1)$ by replacing all the digits after the thousandths place by a sequence of iid uniform digits. Thus,
$$\hat Z =\begin{cases}Z-10^{-3}\{10^3Z\}+10^{-3}U &\text{if } Z\ge 0\\[2ex] Z+10^{-3}\{10^3|Z|\}-10^{-3}U &\text{if } Z<0, \end{cases}$$ where $U\sim\text{Uniform}(0,1)$ (independent of $Z$) and $\{x\}=x-\lfloor x\rfloor$ denotes the fractional part of any real $x$. Then the error produced by the procedure is found to be $\newcommand{\sgn}{\operatorname{sgn}}$ $$\text{err}:=\hat Z-Z=10^{-3}\left(U-\{10^{3}|Z|\}\right)\sgn(Z),$$ so $$|\text{err}|=10^{-3}\left|U-\{10^{3}\,|Z|\}\right|.$$ Now for any $\sigma>0$, $$\begin{align}\Pr\left( \{|\sigma Z|\} \le x \right) &=\sum\limits_{k=0}^\infty\Pr\left(-k-x< \sigma Z \le -k \right) +\sum\limits_{k=0}^\infty\Pr\left(k< \sigma Z \le k+x \right)\\ &=2\,\sum\limits_{k=0}^\infty\Pr\left(k< \sigma Z \le k+x \right)\\ &=2\,\sum\limits_{k=0}^\infty{\large(}\Pr\left(\sigma Z \le k+x \right)-\Pr\left(\sigma Z \le k\right){\large)}\\ \end{align}$$ and differentiating to obtain the probability density ... $$\begin{align}f_{\{|\sigma Z|\}}(x) &=2\,\sum\limits_{k=0}^\infty f_{\sigma Z}\left({k+x}\right), \end{align}$$ where $f_{\sigma Z}(x)={1\over\sigma\sqrt{ 2\pi}}\exp(-{1\over 2}({x\over\sigma})^2)$. By plotting this density function for $0<x<1$, it is found that when $\sigma\ge 1$, $$\left|f_{\{|\sigma Z|\}}(x)-1\right| <{1\over 2\sigma}$$ so that for $\sigma=10^3$, the distribution of $\{|\sigma Z|\}$ is effectively $\text{Uniform}(0,1)$. In addition to plotting the actual function as above, following are simulation results with $10^7$ samples:

enter image description hereenter image description here enter image description hereenter image description here


EDIT: I've posted a proof that as $\sigma\to\infty$, $f_{\{|\sigma Z|\}}(x) = 1+O(\sigma^{-1}),\ 0<x<1;$ more precisely, $$f_{\{|\sigma Z|\}}(x) = 1+{1\over\sigma\sqrt{2\pi}}(1-2x) + O(\sigma^{-2}),\quad 0<x<1.$$


Consequently, $$|\text{err}| \approx 10^{-3}\left|U-U'\right|= T $$ where $T$ has a $\text{Triangular}(a=0,b=10^{-3},c=0)$ distribution.

Following are simulation results using $\sigma=10^3$ with $10^7$ samples:

enter image description here enter image description here

NB: My original posting failed to notice that the formula for $\hat Z$ depends on whether $Z$ is positive or negative. A consequence of this more-complicated formula is that the Fourier transform of the density no longer simplifies as before, making it harder to analyze the behavior as $\sigma\to\infty.$ (Hence the resort to plotting the density in lieu of a formula that would show the approach to uniformity.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.