I cannot manage the problem with the maximum likelihood estimation, could you give me some advise please?
I am trying to fit the parameter of the cumulative distribution function but I have an warning message as follow both with mle()
and fitdist()
:
simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data, gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth, lower = lower, upper = upper, ...): initial value in 'vmmin' is not finite>
The function is: 1-((1-q)*(1-theta)/q/theta/n)^(1/(n-1)) with the unknown parameter theta
My script for mle()
is:
n<-as.numeric(length(price))
pclearing<-function(q,theta) 1-((1-q)*(1-theta)/q/theta/n)^(1/(n-1))
dclearing<-function(x,theta) ((1-x)*(1-theta)/x/theta/n)^((1/(n-1))-1)*((1/(n-1))*(((1-theta)/x+(1-x)*(1-theta)/x^2)/theta/n))
mledist(price,"clearing",start=list(theta=0.0001))
the data is numeric
named price
:
0.717534108
0.757705912
0.598281961
0.628852956
0.684588176
0.6725619
0.639919151
0.606366852
0.658943911
0.570995452
0.576200101
0.558362809
0.551187468
0.610156645
0.620262759
0.545224861
0.575795856
0.629358262
0.69909045
1
0.658110157
0.587670541
0.639919151
0.654850935
0.602299141
0.631379485
0.685447196
0.771576554
0.545224861
0.702880243
0.655634159
0.591207681
0.688731683
0.603082365
0.698029308
0.748863062
0.665740273
0.570995452
0.709499747
0.535219808
0.61066195
0.652602324
0.729156139
0.630368873
0.567205659
0.641965639
0.689186458
0.678120263
0.577817079
0.548256695
0.714754927
0.535219808
0.632895402
0.573774634
0.59914098
0.64426478
0.644012127
0.535118747
0.703132895
0.691258211
0.716018191
0.6725619
0.71104093
0.665740273
0.66902476
0.741359272
0.719833249
0.708084891
0.858767054
0.555583628
0.674482062
0.568468924
0.535118747
0.665740273
0.548256695
0.728941385
0.68499242
0.716801415
0.568216271
0.609903992
0.716270844
0.717534108
0.717534108
0.655634159
0.615209702
0.581101566
0.568468924