[R] Fitting gamma and exponential Distributions with fitdist

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 28 08:41:14 CEST 2011


On Wed, 27 Apr 2011, Joshua Wiley wrote:

> Hi,
>
> I am not incredibly knowledgeable about gamma distributions, but
> looking at your data, you have a tiny mean:variance ratio, which, I
> believe, means that the bulk of the distribution will be near 0 and
> you may run into computational problems (again I think.  I would
> gladly be corrected).

No, the data are well-fitted by an exponential of mean about 2000.

>  This all makes me think it might be a
> convergence issue.  Perhaps you can transform your data for estimation
> and then transform it back (not sure if this would yield equivalent
> results)?
>
> fitdist(test + 10^4, "gamma")

No.

> fitdist(test/10^4, "gamma")

Yes.  This indeed a scaling issue: the estimated rate is very small.


> Good luck,
>
> Josh
>
>
> On Wed, Apr 27, 2011 at 9:42 PM, vioravis <vioravis at gmail.com> wrote:
>> There was a small error in the data creation step and have fixed it as below:
>>
>> test <- c(895.1358,2915.7447,335.5472,1470.4022,194.5461,1814.2328,
>> 1056.3067,3110.0783,11441.8656,142.1714,2136.0964,1958.9022,
>> 891.89,352.6939,1341.7042,167.4883,2502.0528,1742.1306,
>> 837.1481,867.8533,3590.4308,1125.9889,1200.605,4321.0011,
>> 1873.9706,323.6633,1912.3147,865.6058,2870.8592,236.7214,
>> 580.2861,350.9269,6842.4969,1886.2403,265.5094,199.9825,
>> 1215.6197,7241.8075,2381.9517,3078.1331,5461.3703,2051.3997,
>> 751.6575,714.3536,598.4539,425.6656,215.2103,608.785,
>> 369.4744,2398.6506,918.6844,525.6925,2549.3694,4108.8983,
>> 2824.0758,1068.7508,249.995,3863.9839,1152.1506,531.6844)
>>
>> Any help would be appreciated. Thank you.
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Fitting-gamma-and-exponential-Distributions-with-fitdist-tp3477391p3480133.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
>>
>
>
>
> -- 
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list