[R] draw random samples from empirical distribution
Kjetil Brinchmann Halvorsen
kjetil at acelerate.com
Tue Mar 1 14:15:49 CET 2005
bogdan romocea wrote:
>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.
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>
>
>
sample(mysample, n, replace=TRUE)
Kjetil
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
-- Mahdi Elmandjra
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
More information about the R-help
mailing list