[R] generate random number of any given distribution

Liaw, Andy andy_liaw at merck.com
Sat Jan 17 00:19:11 CET 2004


If you can compute the quantile function of the distribution (i.e., the
inverse of the integral of the pdf), then you can use the probability
integral transform:  If U is a U(0,1) random variable and Q is the quantile
function of the distribution F, then Q(U) is a random variable distributed
as F.

This is not necessarily the most efficient way of generating the random
number, but it may be the only way in some cases.

HTH,
Andy 

> From: Yan Yu
> 
> Hello,
> Is there a function in R to generate random number of any given
> distribution (its pdf is given), besides uniform and gaussian
> distribution?
> 
> Thanks,
> yan


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list