[R] Gamma Distribution - is there any problem with "pgamma"?
Amelia Marsh
amelia_marsh08 at yahoo.com
Wed Mar 11 20:00:27 CET 2015
Dear Sir,
Thanks a lot for your help and guidance.
Regards
Amelia
--`------------------------------------------
On Wed, 11/3/15, Ben Bolker <bbolker at gmail.com> wrote:
Subject: Re: [R] Gamma Distribution - is there any problem with "pgamma"?
To: r-help at stat.math.ethz.ch
Date: Wednesday, 11 March, 2015, 11:54 AM
Amelia Marsh <amelia_marsh08
<at> yahoo.com> writes:
>
> Dear R forum
>
> I have following data
>
> amounts =
c(928906.144,156091.0576,433798.3404,993425.7224,
>
369967.2612,2528872.35,1226093.655,
>
1145446.149,1809624.453,599329.0394,2200955.213,2583318.064,
>
745625.8069,961828.8828,1744841.313,1939390.005,1077873.654,
>
729924.2713,803584.2636,287020.8529,530910.9004,818574.0089,
> 1908133.51,262336.0893,593808.2542,780258.1354)
> # Estimating Gamma distribution parameters
>
> shape_gamma
<-
(mean(amounts)/sd(amounts))^2
>
> scale_gamma <-
(sd(amounts)^2/mean(amounts))
>
The default parameterization of the Gamma distribution in R
uses a rate parameter, not a scale parameter. You can
override this:
Fx <- pgamma(amounts, shape_gamma,
scale=scale_gamma)
or
Fx <- pgamma(amounts, shape_gamma,
rate=1/scale_gamma)
One place you can find a description of the
parameterizations
in R is
http://journal.r-project.org/archive/2013-1/lebauer-dietze-bolker.pdf
______________________________________________
R-help at r-project.org
mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible
code.
More information about the R-help
mailing list