# How to graph distribution of Order statistics?

Is there a software that can graph the pdfs and Cds of an arbitrary number of order statistics or is there some code such software?

How to do it?

I'm trying to understand the distribution of order statistics easily.

• The order statistics of the uniform distribution have beta-function pdfs, so those are the easiest to plot and to understand. Then the $k$ of $n$ order statistic for an arbitrary continuous distribution with cdf $F$ is distributed as $F^{-1}$ of the corresponding order statistic for the uniform distribution. – Matt F. Dec 17 '19 at 13:25

You should be able to do that in most statistical or graphing software. Some examples:

The minimum of $$n$$ iid observations from some distribution is an order statistic. Its density function (assuming a continuous distribution) can be calculated by (in R)

dmin  <-  function(x, N=1, basename="norm", ..., log=FALSE) {
dfun  <-  get(paste("d", basename, sep=""))
pfun  <-  get(paste("p", basename, sep=""))
logdens  <-  log(N) + (N-1)*pfun(x, ..., lower.tail=FALSE, log.p=TRUE) + dfun(x, ..., log=TRUE)
retval  <-  if (log) logdens else exp(logdens)
retval
}


And we can use it to graph the density of the minimum of 10 iid standard normals:

 plot( function(x) dmin(x, N=10, "norm"),  from=-5, to=5, col="blue", main="density of min of 10 iid N(0, 1)") For more general order statistics we can do

dorder <-  function(x, N=1, r=1, basename="norm", ..., log=FALSE)  {
pfun  <-  get(paste("p", basename, sep=""))
dfun  <-  get(paste("d", basename, sep=""))
stopifnot(r <= N)

logdens  <-  -lbeta(r, N-r+1)+(r-1)*pfun(x, ..., log.p=TRUE) +(N-r)*pfun(x, ..., lower.tail=FALSE, log.p=TRUE) + dfun(x, ..., log=TRUE)
retval  <-  if (log) logdens else exp(logdens)

retval
}


As an example the density of 3rd order stat for a sample of 10 standard normals:

 plot( function(x) dorder(x, N=10, 3,  "norm"),  from=-5, to=5, col="blue", main="density of 3rd order stat of 10 iid N(0, 1)") EDIT


You probably needs to study the theory of order statistics and their distributions some more. There are many posts here, you could look through this list. Wikipedia is also use full and has good references.

As for your questions in comment, 1) Since for any $$r < s$$ we have $$X_{(r)}\le X_{(s)}$$ the same must hold for their expectations (assuming they exist.) 2) is definitely wrong.

• Is the distribution of the first order statistics have a mean always less than that of the last order sttaitsics? Are higher order statistics' distribution simply the right shifting of the lower order statistics? – user262965 Dec 17 '19 at 14:34
• @Numbers, yes to the first question, no to the second, and you can verify these with the order statistics of the uniform distribution. – Matt F. Dec 18 '19 at 5:02