MagikarpSama
MagikarpSama

Reputation: 323

What exactly does the rexp()-method in R do?

i am trying to generate random values for an Exp(0.5) distribution. I have the following code :

y <- rexp(10, rate=1/2)    
y

This gives me:

 [1] 4.5582556 2.3285161 4.2466828 0.9995597 3.6326827 0.1016917 0.2518124
 [8] 0.3189424 0.8553740 0.8277078

The problem i have here is that i don´t know what this values mean. They can´t be values of the density function of Exp(1/2) which is density function, because the density function is defined as 0 for x < 0 and f(x) = 4.55 for x < 0.

What do these values mean?

Upvotes: 1

Views: 1972

Answers (1)

Severin Pappadeux
Severin Pappadeux

Reputation: 20130

For people coming to R from statistics, for any distribution:

d - PDF
p - CDF
q - inverse CDF
r - sampling according to PDF

Upvotes: 2

Related Questions