# A random sample of size 10 of order statistics from a Extreme Value Distribution.
order_glg(10,0,1,1,1,50)
if (FALSE) # A small comparison between two random sampling methods of order statistics
# Method 1
m <- 10
output <- rep(0,m)
order_sample <- function(m,n,k){
for(i in 1:m){
sample <- rglg(n)
order_sample <- sort(sample)
output[i] <- order_sample[k]
}
return(output)
}
N <- 10000
n <- 200
k <- 100
system.time(order_sample(N,n,k))
sample_1 <- order_sample(N,n,k)
hist(sample_1)
summary(sample_1)
# Method 2
system.time(order_glg(N,0,1,1,k,n))
sample_2 <- order_glg(N,0,1,1,k,n)$sample
hist(sample_2)
summary(sample_2)
Run the code above in your browser using DataLab