Skip to main content
1-Visitor
Jul 11, 2014 4:39 PM UTC
Question

Random number generation of Beta distribution on [Z1,Z2] (not [0,1])

Hi,

I am interested in generating random numbers from a Beta distribution with parameters a and b, where the generated numbers are distributed on the interval [Z1,Z2] and not [0,1]. I know the latter can be obtained by using rbeta(n,a,b).

Thanks

Hussein

3 replies

19-Tanzanite
Jul 11, 2014 7:30 PM UTC

Z1 + (Z2 - Z1)*rbeta(n,a,b)

Alan

Translate
24-Ruby IV
Jul 12, 2014 3:17 AM UTC

AlanStevens wrote:

Z1 + (Z2 - Z1)*rbeta(n,a,b)

Alan

better

rAlanStevens(n, α, β, a, b) := a + (b - a)*rbeta(n, α , β)

I have saw in one sheet 100*runif(n, 0, 1)

And the second.

Do you know why we have rbeta, rgamma but not ralpha?

Translate
1-Visitor
Jul 31, 2014 12:46 PM UTC

Thanks. I thought may be Beta has a specific function.

Translate