7
$\begingroup$

Recently, I encountered an interesting thing with numbers. I couldn't find a satisfactory explanation hence, I decided to post it here.

So, basically say we generate 5 random numbers with mean = 0 and standard deviation = 1 and take a cumulative sum over it and take the index which gives us the max value. To explain this with an example :

5 random numbers with mean = 0 and sd = 1

1.8871962   -2.0479581   -0.7508212   -1.2745548    -0.7129499

Take cumulative sum over it which gives us

1.8871962   -0.1607619    -0.9115832     -2.1861380   -2.8990878

and now we take the index of the highest value which is : 1 in this case.

Now I repeat this procedure for million observation and check what is the ratio of each index to occur and it gives me this ratio :

1 -   0.273311
2 -   0.156218 
3 -   0.140228 
4 -   0.156293 
5 -   0.273950 

I ran this simulation multiple times and this ratio stays more or less same. I find this weird. I expected the ratio to be more or less the same for all the indices. If you also observe the 1st and 5th index have same ratio, 2nd and 4th have same ratio.

Instead of taking 5 random variables, I changed it to 10 and it changed the ratio numbers but it still holds the symmetry where 1st and 10th index have the highest value and are same, 2nd and 9th are second highest and same and so on.

Do you know what is going on there?

I don't know what this phenomenon is called so couldn't find appropriate words to google it as well.

This is a reproducible R script with results, if that is of any help.

generate_random_numbers <- function() {
   num = numeric()
   for (i in seq(1000000)) {
     vec = rnorm(5)
     num[i] = which.max(cumsum(vec))
 }
 table(num)/length(num)
}

generate_random_numbers()
#num
#       1        2        3        4        5 
#0.272608 0.156398 0.140701 0.156537 0.273756 

generate_random_numbers()
#num
#       1        2        3        4        5 
#0.273287 0.156035 0.140446 0.156400 0.273832 
$\endgroup$
3
  • $\begingroup$ I believe this is due to using a distribution that is symmetric about the mean of 0, that is, a distribution where $X_1$ and $-X_1$ have the same distribution. Can you try using an asymmetric distribution? $\endgroup$
    – Michael
    Apr 26, 2018 at 5:05
  • $\begingroup$ @Michael for asymmetric distribution is it enough if I change the mean value which is not 0? $\endgroup$
    – Ronak Shah
    Apr 26, 2018 at 5:11
  • $\begingroup$ I would keep zero mean, but use asymmetric about that. You could for example generate $B$ binary with $P[B=0]=3/4$ and if $B=0$ generate $U$ uniform over $[0.4, 0.6]$, and if $B=1$ generate $U$ uniform over $[-2, -1]$. Then $E[U]=0$ but $U$ and $-U$ have different distributions. $\endgroup$
    – Michael
    Apr 26, 2018 at 5:18

2 Answers 2

13
$\begingroup$

What you're observing is a discrete version of an arcsine law for one-dimensional random walks. The third arcsine law states that the point $T$ in the interval $[0,1]$ where a Brownian motion achieves its maximum follows an arcsine distribution: $$P(T\le t)=\frac2\pi\arcsin\sqrt t,$$ so the density of $T$ is $$ f_T(t)=\frac1{\pi\sqrt{t(1-t)}},$$ which has the U-shape that you've observed. A consequence of this arcsine law is that a symmetric random walk is most likely to hit its maximum either very early, or very late over its first $N$ steps.

$\endgroup$
3
$\begingroup$

Suppose we have 5 i.i.d. random variables $X_1, ..., X_5$ with mean zero and with a symmetric distribution, so that $X_1$ and $-X_1$ have the same distribution. I claim that the probability that 1 is the unique max index is the same as the probability that 5 is the unique max index.

Let $E_1$ be the event that index 1 is the unique maximum: \begin{align} X_1 &> X_1 + X_2 \\ X_1 &> X_1 + X_2 + X_3 \\ X_1 &> X_1 + X_2 + X_3 + X_4\\ X_1 &> X_1 + X_2 + X_3 + X_4 + X_5 \end{align} Equivalently: \begin{align} 0 &> X_2 \quad (Eq *)\\ 0 &> X_2 + X_3 \\ 0&> X_2 + X_3 + X_4\\ 0 &> X_2 + X_3 + X_4 + X_5 \end{align} Let $E_5$ be the event that index 5 is the unique maximum: \begin{align} X_1 &<X_1 +X_2+X_3+X_4+X_5\\ X_1 + X_2 &<X_1 +X_2+X_3+X_4+X_5\\ X_1 + X_2 + X_3 &<X_1 +X_2+X_3+X_4+X_5\\ X_1 + X_2 + X_3 + X_4 &<X_1 +X_2+X_3+X_4+X_5 \end{align} equivalently \begin{align} 0&<X_2+X_3+X_4+X_5 \\ 0&<X_3+X_4+X_5\\ 0&<X_4+X_5\\ 0&<X_5 \end{align} Because $\{X_i\}$ have the same distribution as $\{-X_i\}$, $P[E_1]$ is the same as the probability of the following event, call it event $C$ \begin{align} 0&<-X_2+-X_3+-X_4+-X_5\\ 0&<-X_3+-X_4+-X_5\\ 0&<-X_4+-X_5\\ 0&<-X_5 \end{align} equivalently \begin{align} 0&>X_2+X_3+X_4+X_5\\ 0&>X_3+X_4+X_5\\ 0&>X_4+X_5\\ 0&>X_5 \end{align} By relabeling the $X_i$ values we see that $P[C]$ has the same probability as the event specified in (Eq *), so $$ P[E_5]=P[C] = P[E_1]$$

$\endgroup$
5
  • $\begingroup$ A similar argument can likely be used to show that, in the symmetric case, the probability that index 2 is the unique maximum is the same as the probability that 4 is the unique maximum. $\endgroup$
    – Michael
    Apr 26, 2018 at 5:24
  • $\begingroup$ My main question is why P[E1] is different from P[E2] ? Shouldn't they be equally distributed and the number be the same? P[E1] is equal to P[E5] is just an observation. Moreover, if X1 > X1 + X2 equivalently, shouldn't it be 1 > X2 instead of 0 ? $\endgroup$
    – Ronak Shah
    Apr 26, 2018 at 5:29
  • $\begingroup$ Well, I expect that $P[E_1]\neq P[E_5]$ when you have an asymmetric distribution. I don't see any reason to expect $P[E_1]=P[E_2]$. Was your last sentence in the above comment a typo? We have $X_1 > X_1 + X_2 \iff 0 > X_2$. $\endgroup$
    – Michael
    Apr 26, 2018 at 5:31
  • $\begingroup$ The probability of any of the 5 numbers being highest is equal, right? Then why taking a cumulative sum over those numbers change the probability of each of those numbers being highest? $\endgroup$
    – Ronak Shah
    Apr 26, 2018 at 5:43
  • $\begingroup$ It is correct that each number has an equal chance of being highest. But summing over the numbers changes things, the sum of two iid numbers now has a larger variance. Just write the 4 inequalities needed for index 2 to be the unique max, and you will see they are quite different than the inequalities associated with the event $E_1$. I would expect $P[E_1]\neq P[E_2]$ even in the symmetric case. $\endgroup$
    – Michael
    Apr 26, 2018 at 5:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .