Modified Weibull Error - the function failed to estimate the parameters, with the error code 100

两盒软妹~` 提交于 2019-12-11 15:43:25

问题


I'm trying to estimate the Almalki and Yuan's modified Weibull distribution (NMW) parameters, but I'm encountering the following error:

The value of the AIC is giving negative ONLY VERY NEGATIVE. Something is wrong. I know that in the literature the AIC may be negative, but I believe that some error in the estimation or the functions is happening. Can the bug be in the estimation, fitdist or something like that? Somebody help me?

ARTICLE

 https://www.sciencedirect.com/science/article/pii/S0951832012002396

Acumulative Function

  pnmw = function(x, alpha, beta, gama,theta, lambda)
{
  1 - exp(-alpha*(x^(theta))-beta*(x^(gama))*exp(lambda*x))
}

Density Function

       dnmw = function(x, alpha, beta, gama, theta, lambda)
{
  (alpha * theta * (x^(theta - 1)) + beta*(((gama+lambda*x)*(x^(gama-1))*exp(lambda*x))*exp(-alpha*x^(theta)-beta*x^(gama)*exp(lambda*x)))) 
}

Harzard Function

   hnmw = function(x, alpha, beta, gama, theta, lambda)
{
  alpha * theta * x^(theta - 1) + beta * (gama  + lambda * x) * 
    x^(gama - 1) * exp(lambda * x)
}

Survival Function

   snmw = function(x, alpha, beta, gama, theta, lambda)
{
  exp(-alpha*x^(theta)-beta*x^(gama)*exp(lambda*x))
}

Estimation

paramYuan = fitdist(data = dadosp, distr = 'nmw', start = c(0.05,5,1.25,5,0.05),lower = c(0, 0))

IMAGES

 [https://i.stack.imgur.com/XDxwC.png][1] Image
    [https://i.stack.imgur.com/87Cid.png][1] Image Estimation
    [https://i.stack.imgur.com/FScsM.png][3] Image Functions

Sample:

    dadosp = c(240.3,71.9,271.3, 186.3,241,253,287.4,138.3,206.9,176,270.4,73.3,118.9,203.1,139.7,31,269.6,140.2,205.1,133.2,107,354.6,277,27.6,186,260.9,350.4,242.6,292.5, 112.3,242.8,310.7,309.9,53.1,326.5,145.7,271.5, 117.5,264.7,243.9,182,136.7,103.8,188.3,236,419.8,338.6,357.7)

[https://i.stack.imgur.com/U0KwD.png][1] IMAGE


回答1:


Let's do a little testing with your effort at a density function.

dnmw = function(x, alpha, beta, gama, theta, lambda)
   {
(alpha * theta * (x^(theta - 1)) + beta*(((gama+lambda*x)*(x^(gama-1))*exp(lambda*x))*
     exp(-alpha*x^(theta)-beta*x^(gama)*exp(lambda*x)))) 
    }
 curve(dnmw(x,4,.3,2.4,2,0.05))

I think we need to conclude that this is NOT a good density function since it's integral is clearly greater than 1. Also look at the documentation: http://uksacb.org/sites/default/files/webform/Research%20Paper1_A%20new%20modi%EF%AC%81ed%20Weibull%20distribution_0.pdf

So take the code and put it into an R-aware editor and see where the match to the rightmost paren might be:

dnmw = function(x, alpha, beta, gama, theta, lambda)
{
(alpha * theta * (x^(theta - 1)) + beta*(((gama+lambda*x)*(x^(gama-1))*exp(lambda*x))*
#^
             exp(-alpha*x^(theta)-beta*x^(gama)*exp(lambda*x)))) 
#                                                              ^
}

It matched with the one to the extreme left! But that left-paren was supposed to be matching the one just to the right of exp(lambda*x) to fence off what I would call the normalization terms. So put a right paren in that spot and try to figure out where there is a missing paren elsewhere. .... After several corrections, we get:

dnmw = function(x, alpha, beta, gama, theta, lambda)
{
  (alpha*theta*(x^(theta - 1)) +beta*( (gama+lambda*x) * x^(gama-1)*
  exp(lambda*x) ))*exp(-alpha*x^(theta)-beta*x^(gama)*exp(lambda*x))
}

And now things look more sensible when examining a graphical test. But I also think you need to make sure your other distribution functions do not have similar errors.



来源:https://stackoverflow.com/questions/52731375/modified-weibull-error-the-function-failed-to-estimate-the-parameters-with-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!