Re: cdfgam_p

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Feb 19 2010 - 12:10:46 MST

I asked a statistician

The problem comes from the convention in the parametrization.

Some languages use as input for the two parameters that characterize a
Gamma distribution a and b such that a/b is the mean of the
distribution and a/(b2) is the variance. Some languages use a and b
such that a*b is the mean and a*(b2) is the variance.

Excel evidently uses the opposite of NCL. The difference would not
appear in the first example since b=1 so whatever the convention is
in the first example the Gamma has mean 3 and variance 3. In the
second example depending on the convention it either has mean 2/43 or
2*43 and variance 2/432 or 2*432 which makes a big difference.

I just checked in R and if I ask pgamma(50.29,2,43) I indeed get 1,
while if I ask pgamma(50.29,2,1/43) I obtain 0.32... like Excel.

So tell your user to make sure he enters the parameters such that they
give him the needed mean and variance for the gamma distribution.

debasish@gi.alaska.edu wrote:
> Dear Dennis,
>
> Thanks for your response. I just used function "GAMMADIST" from
> microsoft excel to calculate the cumulative distribution.
>
> For
> GAMMADIST(6.29,3,1,TRUE) = 0.949787846 which is well agreed with NCL
>
> but for
> GAMMADIST(50.29,2,43,TRUE) = 0.32633483 while ncl gives 1
>
> Actually I have a timeseries with values of the order of 50 and shape=2
> and scale =43. Using "GAMMADIST" in excel give me expected cumulative
> distribution curve but NCL returns 1 in all cases.
>
> I am sending my excell sheet attached with this mail where x mentioned
> in column B, shape in G, scale in H and cumulative distribution function
> in column I. The pot is given in chart3.
>
> Thanks again for helping me
>
> Debasish
>
> Quoting Dennis Shea <shea@ucar.edu>:
>
>> I am not sure wher you go that he correct answer is 0.34
>>
>> Using the R-statistical package
>>
>>> pgamma(6.29,3,1)
>> [1] 0.9497878
>>
>>> pgamma(50.29,2,43)
>> [1] 1
>>
>> These agree with NCL.
>>
>> D
>>
>>
>> debasish@gi.alaska.edu wrote:
>>> Hello,
>>>
>>> I just like to know is there any error in the function "cdfgam_p"
>>> It works fine for the example mentioned in the web page
>>> i.e. p=cdfgam_p(6.29,3,1); p=0.95
>>>
>>> but for
>>> p=cdfgam_p(50.29,2,43); p=1 instead of 0.34
>>>
>>> thanks
>>>
>>> Debasish
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 19 12:10:52 2010

This archive was generated by hypermail 2.1.8 : Tue Feb 23 2010 - 08:26:41 MST