[R] Error in fitdist- mle failed to estimate parameters

Ben Bolker bbolker at gmail.com
Wed Mar 21 13:55:14 CET 2012


vinod1 <vinod.hegde.c <at> gmail.com> writes:

> I am trying fit certain data into Beta distribution. I get the error saying
> "Error in fitdist(discrete_random_variable_c, "beta", start = NULL, fix.arg
> = NULL) :   the function mle failed to estimate the parameters,   with the
> error code 100"
> 
> Below is the sorted data that I am trying to fit. Where am I going wrong.
> 
> Thanks a lot for any help.
> 
> Vinod

 Works for me.  In the future, please (1) put the data in a more
convenient format (dput() works nicely) and (2) let us know what
non-base packages you're using (I had to guess at fitdistrplus)

## x <- scan("betatmp.dat")
## dput(x,"")
x <- c(2.05495e-05, 3.68772e-05, 4.21994e-05, 4.38481e-05, 5.55001e-05, 
5.74267e-05, 6.27489e-05, 6.43976e-05, 6.64938e-05, 7.40247e-05, 
7.60495e-05, 7.90767e-05, 8.07253e-05, 8.60475e-05, 8.70433e-05, 
9.23773e-05, 9.45742e-05, 9.76995e-05, 9.93482e-05, 9.96262e-05, 
0.000101275, 0.000103371, 0.000106597, 0.000108693, 0.000110342, 
0.000110902, 0.000112927, 0.000116224, 0.000118249, 0.000119346, 
0.000119898, 0.000120773, 0.000121994, 0.000122925, 0.000123921, 
0.000131451, 0.000134577, 0.000136225, 0.000136774, 0.000138422, 
0.000139895, 0.000140519, 0.000141322, 0.000142543, 0.000150074, 
0.00015475, 0.000155126, 0.000156223, 0.000156775, 0.00015765, 
0.000161545, 0.000163194, 0.000164621, 0.000165842, 0.00016612, 
0.000166402, 0.000167769, 0.000173373, 0.000173651, 0.000174846, 
0.000176273, 0.000177396, 0.0001782, 0.000179421, 0.000183522, 
0.000183744, 0.000186952, 0.000187267, 0.000192274, 0.000193371, 
0.000197945, 0.000202719, 0.000203267, 0.000207816, 0.00021025, 
0.00021315, 0.00021392, 0.000218694, 0.00022162, 0.000230248, 
0.0002308, 0.000231675, 0.000240145, 0.000244693, 0.000252224, 
0.000266343, 0.000308765, 0.000422837, 0.000429537, 0.000443386
)
library(fitdistrplus)
fitdist(x,"beta",start=NULL)
         estimate   Std. Error
shape1     4.28803    0.5101352
shape2 27534.67757 3373.9026660
hist(x,col="gray",freq=FALSE,breaks=20)
curve(dbeta(x,4.288,27534),add=TRUE,col=2)



More information about the R-help mailing list