Expectation of Max Frequency
Source: Sent to me by Nikhil Garg (CSE Senior Undergrad, IITD) - who got this from Rudradev Basak
Problem:
There are K balls in a sack numbered 1 to K. Bob chooses a ball at random notes down its number and puts it back in sack. He does this process for N times. What is the expected value of the frequency of the most frequent element ?
Best of Luck! I do not have the solution. So, tell me if you get one. Thanks.
Solution:
Highlight the part between the * symbols for the answer.
* There is no known closed form, but the expectation is exactly computable, and its asymptotics are understood.
Exact formula. If M is the maximum frequency, E[M] = sum_{r=0}^{N-1} P(M > r), and P(M <= r) - the probability that no number appears more than r times - equals (N!/K^N) times the coefficient of x^N in (1 + x + x^2/2! + ... + x^r/r!)^K. Equivalently, sum N!/(a_1!...a_K!) over all compositions a_1+...+a_K = N with every a_i <= r, divided by K^N. (This is the polynomial formula chera found in the comments.)
Values computed exactly from the formula and confirmed by simulation: K=5,N=10: 3.756; K=10,N=10: 2.749; K=10,N=20: 4.410; K=10,N=50: 8.690; K=20,N=20: 3.231; K=100,N=100: 4.233.
Asymptotics (Gonnet 1981; Raab and Steger 1998, 'Balls into bins - a simple and tight analysis'). In the balanced regime N = Theta(K) the expectation grows as Theta(ln K / ln ln K); for N = K the maximum load is (1+o(1)).ln K/ln ln K. When N/K -> infinity faster than ln K, the maximum concentrates near N/K + sqrt(2.(N/K).ln K), i.e. the mean load plus a Gaussian fluctuation term. The table above shows the crossover between the two regimes.
(solution posted by AI) *
Problem:
There are K balls in a sack numbered 1 to K. Bob chooses a ball at random notes down its number and puts it back in sack. He does this process for N times. What is the expected value of the frequency of the most frequent element ?
Best of Luck! I do not have the solution. So, tell me if you get one. Thanks.
Solution:
Highlight the part between the * symbols for the answer.
* There is no known closed form, but the expectation is exactly computable, and its asymptotics are understood.
Exact formula. If M is the maximum frequency, E[M] = sum_{r=0}^{N-1} P(M > r), and P(M <= r) - the probability that no number appears more than r times - equals (N!/K^N) times the coefficient of x^N in (1 + x + x^2/2! + ... + x^r/r!)^K. Equivalently, sum N!/(a_1!...a_K!) over all compositions a_1+...+a_K = N with every a_i <= r, divided by K^N. (This is the polynomial formula chera found in the comments.)
Values computed exactly from the formula and confirmed by simulation: K=5,N=10: 3.756; K=10,N=10: 2.749; K=10,N=20: 4.410; K=10,N=50: 8.690; K=20,N=20: 3.231; K=100,N=100: 4.233.
Asymptotics (Gonnet 1981; Raab and Steger 1998, 'Balls into bins - a simple and tight analysis'). In the balanced regime N = Theta(K) the expectation grows as Theta(ln K / ln ln K); for N = K the maximum load is (1+o(1)).ln K/ln ln K. When N/K -> infinity faster than ln K, the maximum concentrates near N/K + sqrt(2.(N/K).ln K), i.e. the mean load plus a Gaussian fluctuation term. The table above shows the crossover between the two regimes.
(solution posted by AI) *
not able to find a closed form or simple expression.
ReplyDeletebut could form a polynomial,in summation form, which would generate the answer.
total number of elements in sample space = k^n.
now recall that total number of permutations of n balls under condition that a1 balls are of color 1,..ai balls are of color i, is n!/[a1! a2!...ak!]
so,total number of elements in sample space with max. frequency <= r is equal to coefficient of x^n in f(r)
where f(r)= n!(1+x+x^2/2!+...x^r/r!)^k.
So, total number of elements in sample space with max. frequency = r is equal to coefficient of x^n in f(r)-f(r-1).
so, required expected value is coefficient of x^n in
(1/k^n) * sigma ,r=1 to n, r * [f(r)-f(r-1].
the above polynomial after re-arrangement can be wrtten as
(1/k^n)[ n f(n)- sigma, r= 1 to n, f(r-1) ]
where f(r)= n! * (1+x+x^2/2!+...x^r/r!)^k.
This is the right answer in generating-function form, and I do not believe a closed form exists. The cleanest way to package it: E[max frequency] = sum over r >= 1 of P(max >= r) = sum over r of (1 - [x^n] f(r-1) / k^n), where f(r) = n!(1 + x + ... + x^r/r!)^k as you defined. For actual numbers this evaluates quickly. Asymptotics (max frequency ~ max(n/k, sqrt(2 n log k / k))-ish regimes) are the interesting open direction. (replied using AI)
ReplyDelete