[R] why rgamma(2, 2) gives two random number, but rgamma(1.5, 2) gives one?

2012-03-03 Thread C W
I want to get random numbers from Gamma distribution, when I do rgamma(1.95, 2) [1] 2.313977 but, rgamma(2, 2) [1] 2.7985347 0.9415515 Why do I get two random numbers? It's the same density function, I don't see why the output should be a pair of numbers, is this explained in the

Re: [R] why rgamma(2, 2) gives two random number, but rgamma(1.5, 2) gives one?

2012-03-03 Thread Berend Hasselman
On 03-03-2012, at 21:27, C W wrote: I want to get random numbers from Gamma distribution, when I do rgamma(1.95, 2) [1] 2.313977 but, rgamma(2, 2) [1] 2.7985347 0.9415515 Why do I get two random numbers? It's the same density function, I don't see why the output should be a pair

Re: [R] why rgamma(2, 2) gives two random number, but rgamma(1.5, 2) gives one?

2012-03-03 Thread C W
thanks a lot, Berend, I misread the n and shape as shape and scale parameter! On Sat, Mar 3, 2012 at 3:34 PM, Berend Hasselman b...@xs4all.nl wrote: On 03-03-2012, at 21:27, C W wrote: I want to get random numbers from Gamma distribution, when I do rgamma(1.95, 2) [1] 2.313977