Relative rank (source code)

= Relative rank
{title2=$R_n=1+\#\{i<n:X_i<X_n\}$}

For distinct observations $X_1,\ldots,X_n$, the <relative rank> of the latest observation among those seen so far is $R_n=1+\#\{i<n:X_i<X_n\}$, taking <rank> one as smallest. With values $(4,1,3)$ the successive <ranks> are $(1,1,2)$. Under <independent and identically distributed> continuous observations, symmetry gives $\mathbb P(R_n=j)=1/n$ for $j=1,\ldots,n$. Ranking largest as one is another common convention. Ties require a stated rule, such as random tie-breaking. Relative <ranks> make sequential selection possible without knowing the underlying distribution.