b. alzahrani
2013-Nov-04 19:14 UTC
[R] transform one probability distribution into another
Hi guys Given a exponential curve, is there any function on r that can generate exponential distributed random numbers? in General I want an function that can transform one probability distribution into another?? Regards ****************************************************************** Bander ************************************* [[alternative HTML version deleted]]
Rui Barradas
2013-Nov-04 19:54 UTC
[R] transform one probability distribution into another
Hello, At an R prompt type ?rexp Also, read An Introduction to R, file R-intro.pdf that comes with your distribution of R, namely, chapter 8 Probability distributions. Hope this helps, Rui Barradas Em 04-11-2013 19:14, b. alzahrani escreveu:> > Hi guys > > Given a exponential curve, is there any function on r that can generate exponential distributed random numbers? > > in General I want an function that can transform one probability distribution into another?? > > Regards > ****************************************************************** > Bander > ************************************* > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >
As a general rule, the distribution functions that start with p (e.g. pnorm, pexp, pgamma, ...) will transform a random variable from the corresponding distribution to a uniformly distributed random variable. The functions that start with q (e.g. qnorm, qexp, qgamma, ...) will transform a uniform random variable to the corresponding distribution. So going via the uniform distribution you can convert any distribution to another one (provided the functions exist and you have the correct one to begin with). If there is not a built in function for your distribution then you can create the appropriate distributions from the cumulative distribution function and the inverse cumulative distribution function (the distr package and friends could be of help). But in practice if you just want to generate data from a distribution you should look at the r functions (rnorm, rexp, regamma, ...). On Mon, Nov 4, 2013 at 12:14 PM, b. alzahrani <cs_2002 at hotmail.com> wrote:> > Hi guys > > Given a exponential curve, is there any function on r that can generate exponential distributed random numbers? > > in General I want an function that can transform one probability distribution into another?? > > Regards > ****************************************************************** > Bander > ************************************* > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
Possibly Parallel Threads
- d, p, q, r - What are the math relations with each other of this functions?
- Latin Hypercube Sampling when parameters are defined according to specific probability distributions
- Probability plotting with R
- Latin Hypercube Sampling when parameters are defined according to specific probability distributions
- problems with rexp ?