# Simulate k random samples of size n from the # statandard normal distribution. Plot the first values # versus the last values. Then plot the simulated # joint distribution of the min and the max. # See the last formula from the notes on Order Statistics # for the formula. n <- 5 k <- 1000 x <- matrix(rnorm(n*k),nrow=k) x[1:3,] x.order <- t(apply(x,1, sort)) x.order[1:3,] plot(x[,1],x[,n]) plot(x.order[,1],x.order[,2])