Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

Re: [R] draw random samples from empirical distribution

Kjetil Brinchmann Halvorsen

2005-03-01

Replies:

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@(protected)
>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.

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
©2008 r-help.com - Jax Systems, LLC, U.S.A.