# Plotting tight bounds for simple Wiener Brownian motion - problems with classic definitions (Law of iterated logarithm)

I am trying to plot the standard bounds of simple Brownian motion (implemented as a Wiener process), but I have found some difficulties when drawing the typical equations:

1. When trying to plot the bound given by the Law of the iterated logarithm: $$f_1(t) = \sqrt{2t\log(\log(t))}$$, it fails to work at $$t = [0 ; 1]$$, because $$\log(t) < 0$$ so $$\log(\log(t))$$ is undefined.
2. Then, I tried to fix it leting $$f_2(t) = \sqrt{2t\log(\log(t+1))}$$, but again gives problems because it becomes "imaginary" due the square root of $$\log(\log(t+1))<0$$ on $$t = [0 ; 1]$$.
3. So I tried again using $$f_3(t) = \sqrt{2t\log(\log(t+1)+1)}$$ as the bound defined by the Law of the iterated logarithm, and it works (is well defined, and when $$t \rightarrow \infty$$ should reach a "similar" limit than the first attempts). Unfortunately, when plotted against many realizations of the Brownian paths, the bound is overpassed too many times at the start to be a good "tight" bound (it's "too tight").
4. So, I tried another bound shown in the Wiener processes' Wikipedia named as "Modulus of Continuity", $$f_4(t)=\sqrt{2t\log(\log(1/t))}$$, which also have the "logarithm" problems as previous attempts for $$t = [0 ; 1]$$ (fixables), but it shows to be imaginary for almost all the domain $$t > 0$$. Not too promising (even when works good for valued near zero), but since it is also proportional to the first attempts (because $$\log(1/t) = - \log(t)$$), I tried using the absolute value of the adapted function for the "Modulus of Continuity" as the envelope-bound: $$f(t)_\pm=\pm\sqrt{2t\sqrt{\pi^2+{\log(1+\log(1+t))}^2}}$$ Which works really good as a tight bound for the Brownian realizations. Also at the beginning their behavior $$\propto \sqrt{2t\pi}$$ remembers me the bounds for standard 1D random walk which is $$\sqrt{2t/\pi}$$.

Example of tested bounds and Brownian realizations: https://i.stack.imgur.com/c6GQl.png The proposed bounds $$f(t)_\pm$$ are in green.

The red one is just a modification of the green one: $$g(t)_\pm=\pm\sqrt{t\sqrt{\pi^2+{\log(1+\log(1+t))}^2}}$$ which fits tight as an envelope of the shaded area. Both quite wider than the clasic one sigma deviation of a nornalized Brownian path ($$\sigma=1$$) which should be proportional to $$\sqrt{t}$$.

Actually it works so good, that I don't know if it is just a coincidence (maybe I made a mistake when defining the Brownian paths), but I don't found this bound in any website, so if right, it could be useful for everybody so I left it here, but certainly, I don't have the ability to probe anything related to it:

1. If it is "mathematically" right? (such as the "real" form of the law of the iterated logarithm).
2. If it is "tight" as an "almost-sure" true limit? (such something outside by a value $$\epsilon \to 0$$ don't going to be surpassed almost surely infinitely many times, but something inside will do).
3. If it is going to be surpassed infinitely many times or not? (i It is really a frontier or not?)
4. It is a "better" metric for/than the Law of the Iterated Logarithm?
5. It is a "better" metric for/than the Modulus of Continuity?
6. To which percentile these bounds are corresponding?, etc... (I tried to fit it in a gaussian distribution but it don't fit a constant-term deviation).

I hope you can help to tell me if is "mathematically" the "right envelope function, or just a mistake that has a beauty plot.

I left the code so you can play with it, is specially better at the first values (as it was mentioned, standard metrics fails here near zero).

Beforehand, thanks you very much.

The Matlab code I use:

length = 500;
N = 10000;
white_noise = wgn(length-1,N,0);
simple_brownian = zeros(length,N);
t = 0:1:(length-1);

%Wiener brownian vectors starting at zero
for m = 1:1:N
simple_brownian(2:1:length,m) = cumsum(white_noise(:,m));
end

% Law of iterated logarithm (modif)
envp = sqrt(2.*t.*(log(1+log(1+t))));
envm = -envp;

% Proposed bounds
envp2 = sqrt(2.*t.*sqrt(pi^2+log(log(t+1)+1)).^2);
envm2 = -sqrt(2.*t.*sqrt(pi^2+log(log(t+1)+1)).^2);

figure(1), hold on,
plot(t,envp,'y',t,envm2,'g',t,envp2,'g',t,envm,'y'),
legend('Law iterated log.','Proposed bounds'),
plot(t,simple_brownian),
plot(t,envp,'y',t,envm2,'g',t,envp2,'g',t,envm,'y'),
hold off;


About point (5), commenting something mentioned in the comments: as $$t\to \infty$$ the Law of the Iterated Logarithm such as $$f_{\pm}(t)$$ will behave similar in the sense their fraction $$\lim_{t\to \infty} \frac{f_\pm(t)}{\text{LIL}(t)}\to 1$$ as can be seen in Wolfram-Alpha.

I think since the Modulus of continuity kind of show how much could change at max some function (as a kind-of-derivative when differentiation is undefined), it should fit the envelope I am looking for.

After some trials I think the found bound $$f_{\pm}(t)$$ could be improved just adjusting by just one displacement the mentioned Modulus of continuity of the Wiener process as: $$h(t)_\pm=\left|\sqrt{2t\log\left(\log\left(\frac{1}{t\color{red}{+1}}\right)\right)}\right|=\pm\sqrt{2t\sqrt{\pi^2+{\log(\log(1+t))}^2}}$$

But also, the classic LIL could be improved as:

$$k(t)_\pm = \pm\sqrt{2t\log(\log(t\color{red}{+e}))}$$

So for me is not clear at all which one is fulfilling being the "real envelope" of a wiener process and behaving as a LIL should do: as example $$k_\pm(t)$$ behaves more similar to $$g_\pm(t)$$ than it do to $$h_\pm(t)$$ (this is why, based on the plots, I think is $$h_\pm(t)$$ the better one).

Also, since at the beginning $$h_\pm(t)$$ behaves similar to $$h_\pm(t) \sim \sqrt{2\pi t}$$, neither is clear for me that if the standard deviation of a Brownian motion is $$\sigma = \sqrt{t}$$, then how should be interpreted this envelope corresponding to a standard deviation of $$\sqrt{2\pi}\sigma$$.

• The law of iterated logarithm $f(t) = \sqrt{2 t \ln \ln t}$ is the correct bound, but only as $t \rightarrow \infty$. What you (and evidently Wikipedia) call the "Modulus of Continuity" is simply the law of iterated logarithm for $t \downarrow 0$. I would guess that $t=500$ is not enough for the LIL bounds to be binding. I suspect your proposed $f$ will be too lose because it effectively involves squaring the $\ln \ln t$ part. Sep 27, 2021 at 16:51
• It is being squared under a square root function where only a constant is added, the same equation could be written as $$f(x)=\sqrt{2t\log{(\log(t+1)+1)}\sqrt{1+\pi^2/\log{(\log(t+1)+1)}^2}}$$ were the "$\pi$"-part will becomes zero when $t \rightarrow \infty$, so I believe that in the limit have the same behaviour as the Law of the Iterated Logarithm Sep 27, 2021 at 17:43
• Oh, I see, I missed there was an extra square root. Then yes, I agree that these should have the same behavior as $t \rightarrow \infty$. Sep 27, 2021 at 17:53
• Well, definitely there can't be any bounds for $W_t$ with probability $1$ for a fixed $t$ that depend only on $t$ due to the distribution of $W_t$.
– SBF
Nov 15 at 14:40
• Infinitely often is tricky with brwownian motion, it’s “single” crossing may already provide infinite number of points where it crosses another curve
– SBF
Nov 15 at 14:49

There is no "envelope" that will contain the graph of Brownian motion with probability one for all $$t>0$$ because of the following support theorem: if $$B$$ is a standard BM in $$\mathbb{R}$$ and $$f\in C([0,T],\mathbb{R})$$ for $$T>0$$, then for any $$\epsilon>0$$ $$\mathbb{P}(\sup_{t\in [0,T]}|B_t-f(t)|<\epsilon)>0.$$

So draw any continuous function $$f$$ you like, and Brownian motion has a positive probability of being epsilon close to it and thus outside any gauge function you can imagine.

Here are some references

On the other hand by the law of the iterated logarithm we have that almost surely there exists a random $$t_{0}$$ such that for all $$t\geq t_{0}$$

$$|B_{t}|\leq 2 \sqrt{2t\log\log t}$$

(eg. Remark 5.2. in Mörters-Peres book on Brownian motion).

So up to any deterministic time $$T>0$$, BM will not be contained almost-sure in any envelope $$\psi(t)$$. However, by LIL, there exists a random time $$t_{0}(\omega)$$ after which BM is contained in the envelope $$2 \sqrt{2t\log\log t}$$.

• Thanks you very much for taking the time to answer. Maybe I am mistaken, but I believe I am asking in principle a slightly different question: what I think the equation you shared said is that there exist always a positive probability for the Brownian motion of achieving any possible envelope function, which is related to their values distributing Normally which have infinite support. But what I aimming to find if there is an envelope that split the path on the region wich values will be matched a.s. infinitely often from others that will not be crossed infinitely often Nov 15 at 23:01
• Could you elaborate into this? Maybe the equation you shared already define that every value will be matched a.s. infinitely often but I am not understanding it properly. Nov 15 at 23:03
• @Joako So up to any deterministic time $T>0$, BM will not be contained almost-sure in any envelope $\psi(t)$. However, by LIL, there exists a random time $t_{0}(\omega)$ after which BM is contained in the envelope $2 \sqrt{2t\log\log t}$. This $t_{0}(\omega)$ is not concrete. It changes for each realization. Nov 15 at 23:28
• Thanks for the book recomendation. I checked the remark $5.2$ and I want to notice the plot shown right before: as the Law of the Iterated Logarithm $\text{LIL}(t)$ makes a tight bound for some big time $t_0$, it fails at shorts times where comes into show the Modulus of Continuity $\text{MOC}(t) = \sqrt{2t\log(\log(1/t))}$ for some $t\to 0^+$, so its kind of too-tight for short times. If you notice the first part of my question the $\text{MOC}(t)$ function becomes complex-valued, so if I take $|\text{MOC}(t)| = \sqrt{2t\sqrt{\pi^2+\log(\log(t))^2}}$ the function I modified for the envelope... Nov 16 at 0:58
• Any epsilon will do. As you take $\epsilon$ smaller, it will actulaly make the upper bound sharper and so the random time larger $t\geq t_{0}(\omega)$. Nov 17 at 3:41