[R] random sampling vector from any dsitribution

Michael Weylandt michael.weylandt at gmail.com
Tue Dec 18 12:01:29 CET 2012



On Dec 18, 2012, at 9:07 AM, Kairos2012 <lucie.salwiczek at zooplus.de> wrote:

> Hi,
> 
> help is very much appreciated. Thanks in advance!!!
> 
> rgamma(...)
> As far as I know with this function (code) one can randomly sample 100
> numbers simultanously.
> 
> Question is: is it possible to sample 100 random numbers e.g. from 100
> different gamma distributions using only one command line (or: using only
> one function)?
> 
> One idea how this could look like:
> rgamma(1:100, shape=c(s1,s2,...,s100), rate=c(r1,r2,...,r100))


So close: change 1:100 to simply 100 

 MW

> 
> What I do not know: is it correct to assume that effectively only ONE random
> number (with the respective paramateres  s1<>s2<>...<>s100 und
> r1<>r2<>...<>r100) has been drawn from 1 gamma distribution (out of 100
> various gamma distributions) ?
> 
> Thanks again for any thoughts and advice!
> Merry Christmas!
> 
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/random-sampling-vector-from-any-dsitribution-tp4653410.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list