[R] draw random samples from empirical distribution

bogdan romocea br44114 at yahoo.com
Mon Feb 28 18:54:30 CET 2005


Dear useRs,

I have an empirical distribution (not normal etc) and I want to draw
random samples from it. One solution I can think of is to compute let's
say 100 quantiles, then use runif() to draw a random number Q between 1
and 100, and finally run runif() again to pull a random value from the
quantile Q. Is there perhaps a better/more elegant way of doing this?

Thank you,
b.




More information about the R-help mailing list