How to get the quantiles by simulations? I would like to find the quantiles of a random variable $X$ by simulations. I plan to do it in the following way, however, I do not know which one should be more correct though the results look very very close.
Let's say p=0.99
A)1.Simulate 100 random numbers of $X$, order them, and pick up the 99th one.
  2.Do 1 for 1e4 times and take the average.
B)Simulate 1e6(100*1e4) random numbers of $X$, and pick up the .99*1e6-th one from the ordered sequence.
I guess A may look may "correct", and the standard error can be computed. But B is much faster. However, I do not know how to compute the standard error with B. The reuslts are close indeed.
Thanks a lot for you helps
 A: Your second method is more accurate for extracting the quantile.  You're confused because you're not considering SE correctly.
Perhaps if you get the SE's for both values the same way you'll have a better understanding.  For A it's the SD of your sampling across your 1e4 simulations and for B it's the same if you again do a bunch of samples.
What you should find, with a little experimentation, is that if the initial sample (your simulation) is large enough then the SE tends toward 0.  Therefore, method B is better.  In such examples considerations of SE are often irrelevant.  SE is very important when you can't get enormous sample sizes. But if you can, like when your computer pumps them out instantaneously, SE becomes equivalent to 0.  Try it out.
mX  <- 100
sdX <- 15

Y <- replicate(1e4, sort(rnorm(100, mX, sdX))[99])
sd(Y)
mean(Y)


Y <- replicate(1e4, sort(rnorm(1e4, mX, sdX))[.99*1e4])
sd(Y)
mean(Y)

It will take a little while to run the second one.  I shortened to it 1e4 so you get the idea.  Make the n in rnorm big enough and you can ignore SE.
