Expected value of item in a sorted list of integers If you were to take random positive integers, put them into a list, and sort them is there anyway to find the expected value of the kth item in the list? The list is sorted in ascending order. 
By random positive integer I mean some number in the range 0-N where the probability of each number occurring is equal. (I think what I'm trying to say is uniform distribution). 
 A: To be precise, suppose that $k$ integers $y_1, y_2, \ldots, y_k$ are uniformly and independently drawn from the set $S = \{0,1,\ldots, N\}$ with replacement.
Let $x$ be any value in $S$.  Then the chance that the $r^\text{th}$ smallest of the $y_i$ (written $y_{[r]}$) is less than or equal to $x$ is the chance that $r$ or more of the $y_i$ are less than or equal to $x$.  The number of $y_i$ less than or equal to $x$ has a Binomial distribution with parameters $p=(x+1)/(N+1)$ (the chance of the outcome being in the set $\{0,1,\ldots, x\}$) and $k$ (the number of "trials").  Therefore (taking $N$ and $k$ as given),
$$\Pr(y_{[r]}\le x) = \sum_{i=r}^k \binom{k}{i} p^i(1-p)^{k-i}.$$
From this we compute 
$$p(x,r,k,N) = \Pr(y_{[r]}= x) = \Pr(y_{[r]}\le x) - \Pr(y_{[r]}\le x-1),$$
understanding $\Pr(y_{[r]}\le -1) = 0$, and obtain the expectation directly from its definition,
$$\mathbb{E}[y_{[r]}] = \sum_{x=0}^N p(x,r,k,N) x.$$
For example, letting $N=10$ and $k=7$, the expectations for $y_{[1]}$ through $y_{[7]}$ are
$$0.927812, 2.250436, 3.624783, 5.000000, 6.375217, 7.749564, 9.072188.$$
For sufficiently large $N$, the expectation of $y_{[r]}$ will be approximately $rN/(k+1)$.

R code to perform these calculations follows.  Begin with computing $p(x,r,k,N)$:
prob <- function(x, r, n, k) {
  p <- (x+1)/(n+1)
  if (p>=1) return (1)
  if (p<=0) return (0)
  i <- r:k
  sum(choose(k, i) * p^i * (1-p)^(k-i))
}

This should be replaced by better code for large $k$, such as system-supplied code to compute binomial probabilities, as in
prob <- function(x, r, n, k) pbinom(r-1, k,  (x+1)/(n+1), lower.tail=FALSE)

However it is implemented, prob can be used by differencing, multiplying by the x, and summing:
> n <- 10; k <- 7
> zapsmall(sapply(1:k, function(i) 
     sum(diff(sapply(-1:n, function(x) prob(x, i, n, k))) * 0:n)))

[1] 0.927812 2.250436 3.624783 5.000000 6.375217 7.749564 9.072188

A more efficient implementation uses summation by parts:
> zapsmall(n - sapply(1:k, function(i) sum(sapply(-1:(n-1), function(x) prob(x, i, n, k)))))

[1] 0.927812 2.250436 3.624783 5.000000 6.375217 7.749564 9.072188

