# Distribution of max of partial sums of normal distributions

I was surprised not to find this question already answered: if I take the maximum of the partial sums of n normal distributions, what is the resulting distribution?

I know that https://math.stackexchange.com/questions/68553 "solves" this in general, but I'm hoping for a simpler form for the normal distribution.

t[n_] := t[n] = Histogram[
Table[Max[Accumulate[Table[RandomVariate[NormalDistribution[]],{i,n}]]],
{j,1,100000}]];

The code above convinces me the resulting distribution isn't normal (except for n=1 of course), although it looks somewhat normal for low values of n.

• Try this code t[n_] := Histogram[MapThread[Max, Accumulate[RandomVariate[NormalDistribution[], {n, 100000}]]]] Mar 21, 2016 at 19:08
• @Coolwater OK, but why?
– user1722
Mar 21, 2016 at 19:18

Here is a partial answer (pun intended). Sometimes it helps just to start with a brute force approach and with a small n:

(* (x1,x1+x2) has a multivariate normal distribution *)
d = MultinormalDistribution[{0, 0}, {{1, 1}, {1, 2}}];

(* Cumulative distribution function: Pr(Max[x1,x1+x2] < t) *)
cumulative = Integrate[PDF[d, {x, y}], {x, -∞, t}, {y, -∞, x}] +
Integrate[PDF[d, {x, y}], {y, -∞, t}, {x, -∞, y}]
(* (1+Erf[t/2])^2/8+(1+Erf[t/Sqrt[2]])/4 *)

(* Density *)
f = FullSimplify[D[cumulative, t]]
(* (Sqrt[2]+E^(t^2/4)*(1+Erf[t/2]))/(4*E^(t^2/2)*Sqrt[π]) *)

(* Show density and histogram of a large sample *)
n = 2;
Show[Histogram[Table[Max[Accumulate[Table[RandomVariate[NormalDistribution[]],
{i, n}]]], {j, 1, 100000}], "Scott", "PDF"], Plot[f, {t, -3, 6}]]

So, yes, these distributions are not exactly normal.

Update

The paper you need to see is "The Variance of the Maximum of Partial Sums of a Finite Number of Independent Normal Variates" by A.A. Anis, Biometrika, Vol. 42, No. 1/2 (Jun., 1955), pp. 96-101. This gives you the exact mean and variance for any $n$ along with the asymptotic distribution. Below is the asymptotic distribution for $n=100$ and the histogram of a large random sample:

n = 100;
x = Table[Max[Accumulate[Table[RandomVariate[NormalDistribution[]], {i, n}]]], {j, 1,100000}];
Show[Histogram[x, "Scott", "PDF"],
Plot[E^(-(t^2/(2 n))) Sqrt[2/(n π)], {t, 0, n}, PlotRange -> Full]]

In short, you won't find an exact representation of the distribution for $n>2$. (Correction: That should be $n>3$.)

• Thanks! Actually, if you graph my function for n=50, it looks nothing like the normal distribution. So.. I'm still looking for what kind of distribution it actually is.
– user1722
Mar 21, 2016 at 22:12
• Yes! This is exactly what I needed. It approaches the half normal distribution for large values of n (which I kind of sort of suspected, but wasn't sure about).
– user1722
Mar 22, 2016 at 12:11