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