Reputation: 747
The gamma distribution with a shape parameter k and a scale parameter theta is defined by =
In R If I want to find the quantile at 0.05 probability for a gamma distribution with Gamma(10,0.5)
I used
> qgamma(0.05,shape=10,scale=0.5)
[1] 2.712703
but this is not the value I want. The desired value I get when I use,
qgamma(0.05,10,0.5)
[1] 10.85081
So what is the difference of qgamma(0.05,10,0.5)
and qgamma(0.05,shape=10,scale=0.5)
.
Why do I get two completely different results?
Upvotes: 3
Views: 14202
Reputation: 1351
qgamma(x,shape,rate,scale=1/rate)
#here when we use it as a process
qgamma(0.05,10,0.5)
#it takes 0.5 as a rate but not as a scale
qgamma(0.05,shape=10,scale=1/0.5)
#here 1/0.5 is a scale value but not rate
qgamma(0.05,10,shape=1/0.5)
10.85081
qgamma(0.05,10,0.5)
10.85081
Upvotes: 5
Reputation: 263411
Read the help page: Scales is the fourth parameter of qgamma
. The third parameter is rate = 1/shape
. If you want to call qgamma
with positional matching of parameters then it should be:
> qgamma(0.05, 10, 1/0.5)
[1] 2.712703
Upvotes: 5