There are several non-normal distributions built in that you could just use 
their generationg functions.  There are packages (most with dist somewhere in 
the name) that allow for functions on standard distributions including 
combining together distributions.

If your distribution is not one of the above, but has a well defined inverse 
cumulative distribution then you can just generate random uniforms (runif) and 
put them into the inverse.

If none of the above works then there are still many tools available such as 
rejection sampling or metropolis-hastings sampling.

The logspline package can approximate a distribution from a dataset and 
generate values from the approximation.

We would need to know more about the actual distribution that you are 
interested in to be of more specific help.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Anna Lee
> Sent: Thursday, March 31, 2011 1:24 PM
> To: r-help@r-project.org
> Subject: [R] generate random numbers
> 
> Hey List,
> 
> does anyone know how I can generate a vector of random numbers from a
> given distribution? Something like "rnorm" just for non normal
> distributions???
> 
> Thanks a lot!
> Anna
> 
> --
> 
> 
> 
> Der Inhalt dieser E-Mail ist vertraulich. Sollte Ihnen die E-Mail
> irrtümlich zugesandt worden sein, bitte ich Sie, mich unverzüglich zu
> benachrichtigen und die E-Mail zu löschen.
> 
> This e-mail is confidential. If you have received it in error, please
> notify me immediately and delete it from your system.
> 
> ______________________________________________
> R-help@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.

______________________________________________
R-help@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.

Reply via email to