令f (g ; n ,m )为最小值a (1 )等于g的机会;也就是说,样本由g和n − 1子集{ g + 1 ,g + 2 ,… ,m }组成。有( m − gf(g;n,m)a(1)ggn−1{g+1,g+2,…,m}ñ - 1)个这种子集出的(米(m−gn−1)n)同样可能的子集(mn)
Pr (a (1 ) = g = f (g ; n ,m )= ( m - gn − 1)(米n)。
Pr(a(1)=g=f(g;n,m)=(m−gn−1)(mn).
对于所有大于g的k的可能值,将f (k ; n ,m )相加得出生存函数f(k;n,m)kg
Pr (a (1 ) > g )= Q (g ; n ,m )= (m − g )( m − g − 1n − 1)Ñ (米n)。
Pr(a(1)>g)=Q(g;n,m)=(m−g)(m−g−1n−1)n(mn).
令G n ,m为最大差距给定的随机变量:Gn,m
Gn,m=max(a(1),a(2)−a(1),…,a(n)−a(n−1)).
Gn,m=max(a(1),a(2)−a(1),…,a(n)−a(n−1)).
(此响应的问题如最初框架,它被修改为包括之间的间隙前一个(Ñ )和米)。a(n)m
我们将计算其生存函数P (克; Ñ ,米)= 镨(ģ Ñ ,米 > 克),从中可以轻松得出G n ,m的整个分布。该方法是一个从n = 1开始的动态程序,对于
P(g;n,m)=Pr(Gn,m>g),
Gn,mn=1
P(g;1,m)=Pr(G1,m>1)=m−gm, g=0,1,…,m.
P(g;1,m)=Pr(G1,m>1)=m−gm, g=0,1,…,m.(1)
For larger n>1n>1, note that the event Gn,m>gGn,m>g is the disjoint union of the event
a1>g,
a1>g,
for which the very first gap exceeds gg, and the gg separate events
a1=k and Gn−1,m−k>g, k=1,2,…,g
a1=k and Gn−1,m−k>g, k=1,2,…,g
for which the first gap equals kk and a gap greater than gg occurs later in the sample. The Law of Total Probability asserts the probabilities of these events add, whence
P(g;n,m)=Q(g;n,m)+g∑k=1f(k;n,m)P(g;n−1,m−k).
P(g;n,m)=Q(g;n,m)+∑k=1gf(k;n,m)P(g;n−1,m−k).(2)
Fixing gg and laying out a two-way array indexed by i=1,2,…,ni=1,2,…,n and j=1,2,…,mj=1,2,…,m, we may compute P(g;n,m)P(g;n,m) by using (1)(1) to fill in its first row and (2)(2) to fill in each successive row using O(gm)O(gm) operations per row. Consequently the table can be completed in O(gmn)O(gmn) operations and all tables for g=1 through g=m−n+1 can be constructed in O(m3n) operations.
These graphs show the survival function g→P(g;n,64) for n=1,2,4,8,16,32,64. As n increases, the graph moves to the left, corresponding to the decreasing chances of large gaps.
Closed formulas for P(g;n,m) can be obtained in many special cases, especially for large n, but I have not been able to obtain a closed formula that applies to all g,n,m. Good approximations are readily available by replacing this problem with the analogous problem for continuous uniform variables.
Finally, the expectation of Gn,m is obtained by summing its survival function starting at g=0:
E(Gn,m)=m−n+1∑g=0P(g;n,m).
This contour plot of the expectation shows contours at 2,4,6,…,32, graduating from dark to light.