# Median of order statistics

I recently learned that to find the pdf of the median of say $X_1,X_2, X_3$, you first find the Cdf via $$P(M \le x) =P(\text{at least 2 are}\, \le x) = P( \text{exactly 2 are}\, \le x) + P(\text{all 3 are} \le x)$$ where $M$ denotes the median. Finaly you differentiate to get the required pdf.

My questions:

1. How does one find the cdf/pdf of an arbitrary number of order statistics?
2. Is there a generalized formula?

Thanks

Edit:

Let's suppose the $X_i$'s are iid.

-
Michael Hardy's answer hints at the combinatoric types of things you want to be doing to answer this. For (say) iid $X_i$ you can get the joint distribution of any number of order statistics. Here are some notes I found online that might be useful. It derives the joint distribution of all the order statistics, and the marginal of any single order statistic. One can get formulas the joint distribution of any subvector of the order statistics in terms of the pdf $f$ and cdf $F$ in the iid case, but I don't think it has all that. –  guy Jul 24 '12 at 2:41
@guy: The link you gave me is broken ;) –  John Jul 24 '12 at 3:59
The site is fine, I just accidentally put an extra bracket in at the end :). I fixed it! It actually has more material than I thought; it addresses the general case, exchangeable case, and finally the iid case, and gets joint distributions. –  guy Jul 24 '12 at 4:32
@guy Thanks. ${}{}{}{}{}{}$ –  John Jul 24 '12 at 12:50

Suppose (capital) $F$ is the cumulative probability distribution function of any of the three observations $X_1,X_2,X_3$, so that $F(x) = \Pr(X_1\le x) = \Pr(X_2\le x) = \Pr(X_3\le x)$. Then $$\Pr(\text{exactly two}\le x)$$ is the probability of exactly two successes in three independent trials with probability $F(x)$ of success on each trial. In other words, the probability distribution of the number of observations that are $\le x$ is a binomial distribution with $n=3$ and $p=F(x)$. So we have $$\Pr(\text{exactly two}\le x) = {3\choose 2} F(x)^2(1-F(x))^1.$$
More generally $$\Pr(\text{exactly k of n observations are}\le x) = {n\choose k} F(x)^k(1-F(x))^{n-k}.$$
This is a nice start, but it has a long way to go before it adequately addresses OP's questions :) OP didn't actually specify that the $X_i$ are iid, but you probably need some assumptions to make useful progress on this problem. –  guy Jul 24 '12 at 2:35
@MichaelHardy Thanks for your answer. How do I find the median of an arbitrary number of $X_i$? –  John Jul 24 '12 at 12:53
For order statistics, we want $P(\mbox{at least$k \le n$})$ but this answer gives the probability of exactly $k \le n$. We are a sum away from getting the CDF of an order statistic. –  guy Jul 24 '12 at 16:35
@John : Did you mean "How do I find the median?" or "How do I find the distribution of the median?"? In the latter case, the equality after the words "More generally" will do it if you pick $n$ and $k$ correctly. –  Michael Hardy Jul 24 '12 at 20:50