[R] Gamma Distribution - is there any problem with "pgamma"?

Amelia Marsh amelia_marsh08 at yahoo.com
Wed Mar 11 19:58:02 CET 2015


Dear Mr Byng,

Thanks a lot for your great help. Appreciate.

Regards

Amelia
--------------------------------------------
On Wed, 11/3/15, Martyn Byng <martyn.byng at nag.co.uk> wrote:

 Subject: RE: [R] Gamma Distribution - is there any problem with "pgamma"?

elp at r-project.org>
 Date: Wednesday, 11 March, 2015, 11:48 AM

 Hi,

 Try

 pgamma(amounts,shape_gamma,scale=scale_gamma)

 as I am guessing you mean
 scale_gamma to be the scale of the distribution, but are
 using it as the rate ( = 1 / scale) instead

 Martyn

 -----Original Message-----
 From: R-help [mailto:r-help-bounces at r-project.org]
 On Behalf Of Amelia Marsh
 Sent: 11 March
 2015 09:42
 To: r-help at r-project.org
 Subject: [R] Gamma Distribution - is there any
 problem with "pgamma"?

 Dear R forum

 I
 have following data

 amounts
 =
 c(928906.144,156091.0576,433798.3404,993425.7224,1323976.364,649106.9339,
 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))


 Fx               
     <-            pgamma(amounts, shape_gamma,
 scale_gamma)



 I get following values of
 Fx

 > Fx 
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 1 1 1 1 1 



 I have tried this for
 different dataset but still each time I am getting values of
 Fx as 1's only.

 Is
 there any problem with pgamma command?

 Kindly advise.

 Regards

 Amelia

 ______________________________________________
 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.

 ________________________________________________________________________
 This e-mail has been scanned for all viruses by
 Star.



More information about the R-help mailing list