在R中使用fitdistplus包

时间:2017-05-08 19:08:41

标签: r

我的问题我希望通过4个参数将数据与我的模型进行审查

我的代码:

 library(fitdistrplus)
d11<-data.frame(left=c(72,411,228,126,118,10,82,110,314,100,42,8,144,25,11,30,38,4,54,13,123,97,15,59,117,16,151,22,56,2,18,139,20,31,52,287,18,51,122,27,54,7,63,392,10,8,92,35,117,132,1,16
                       ,3,95,177,162,216,553,278,12,260,200,156,182,143,105,103,250,100,999,112,87,231,242,991,111,1,587,389,33,25,357,467,201,1,30,44,283,15,25,103,21,13,87,2,20,7,24,99,8,99,25,95,80,51
                       ,29,24,18,83,31,51,90,52,73,8,36,48,7,140,186,84,19,45,80,52,164,19,53,15,43,340,133,111
                       ,231,378,49),
                right=c(72,411,228,126,118,10,82,110,314,NA,42,8,144,NA,11,30,38,4,54,13,NA,NA,15,59,117,16,151,22,56,2,18,139,20,31,52,287,18,51,122,27,54,7,63,392,10,8,92,35,117,132,1,16
                        ,3,95,177,162,216,553,278,12,260,200,156,NA,143,105,103,250,100,999,112,NA,NA,242,991,111,1,587,389,33,25,357,467,201,1,30,44,283,15,25,NA,21,13,87,2,20,7,24,99,8,99,25,95,80,51
                        ,29,24,18,NA,31,51,90,52,73,8,36,48,7,140,186,84,19,45,80,52,164,19,53,15,43,340,133,111
 ,231,378,49))

#pdf of my model 
dw<-function(x,a,b,c,d) {2*a*b*(c^2)*d*x*exp(-(x*c)^2)*(1-exp(-(c*x)^2))^((d*b)-1)/(1-(1-exp(-(c*x)^2))^(d))^(b+1)*exp(-a*(1-exp(-(c*x)^2))^(d*b)/((1-(1-exp(-(c*x)^2))^(d))^(b)))}

##cdf of my model 
pw<-function(q,a,b,c,d) {


  (1-exp(-a*(1-exp(-(c*q)^2))^(d*b)/((1-(1-exp(-(c*q)^2))^(d))^(b))))}


model3<fitdistcens(d11,"w",start=list(a=0.02,b=0.02,c=0.0002,d=0.0002),optim.method="Nelder-Mead")
summary(model3)

我这个步骤的问题

model3

我得错了说:

Error in fitdistcens(d11, "w", start = list(a = 0.02, b = 0.02, c = 2e-04,  : 
  the function mle failed to estimate the parameters, 
        with the error code 100

0 个答案:

没有答案