[R] Fitting gamma and exponential Distributions with fitdist

vioravis vioravis at gmail.com
Wed Apr 27 09:01:36 CEST 2011


I am trying to fit gamma and exponential distributions using fitdist function
in the "fitdistrplus" package to the data I have and obtain the parameters
along with the AIC values of the fit. However, I am getting errors with both
distributions. I have given an reproducible example with the errors I am
getting below. Can someone please let me know how to overcome this issue???

library("fitdistrplus")
test <- (895.13582915.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)

fitdist(test,"gamma",method ="mle")

Error in fitdist(test, "gamma", method = "mle") : 
  the function mle failed to estimate the parameters, 
                with the error code 100
In addition: Warning messages:
1: In dgamma(x, shape, scale, log) : NaNs produced
2: In dgamma(x, shape, scale, log) : NaNs produced
3: In dgamma(x, shape, scale, log) : NaNs produced
4: In dgamma(x, shape, scale, log) : NaNs produced
5: In dgamma(x, shape, scale, log) : NaNs produced
6: In dgamma(x, shape, scale, log) : NaNs produced
7: In dgamma(x, shape, scale, log) : NaNs produced
8: In dgamma(x, shape, scale, log) : NaNs produced
9: In dgamma(x, shape, scale, log) : NaNs produced


fitdist(test,"exp",method ="mle")

Error in fitdist(test, "exp", method = "mle") : 
  the function mle failed to estimate the parameters, 
                with the error code 100
In addition: Warning message:
In dexp(x, 1/rate, log) : NaNs produced

Thank you.
Ravi

--
View this message in context: http://r.789695.n4.nabble.com/Fitting-gamma-and-exponential-Distributions-with-fitdist-tp3477391p3477391.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list