[R] R 3.1.2 mle2() function on Windows 7 Error and multiple optimal solutions

Mosab Alqurashi malqurashi at KSU.EDU.SA
Wed Jan 14 10:49:46 CET 2015


?Hello,


I want to get the Maximum Likelihood Estimate (MLE) for an Extended weibull  with three parameters. I have two problems. First, some times if I change the starting point for one of the parameters I got an error message. Second, sometime when I change the starting point for one of the parameters the solution changes. I don't know what I'm doing wrong or if there is a better way to get the MLE for a distribution.


Here is my Example and the Error message.


Problem 1:

y=c(5,11,21,31,46,75,98,122,145,165,195,224,245,293,321,330,350,420) #My data set

Nweibull <- function(x,lambda,alpha,beta){lambda*beta*(x/alpha)^(beta-1)*exp(1)^((x/alpha)^beta+lambda*alpha*(1-exp(1)^((x/alpha)^beta)))}  # The PDF

LL <- function(lambda,alpha,beta) {
  R = Nweibull(y,lambda,alpha,beta)

  -sum(log(R))
} # defining the Likelihood Function

g=mle2(LL, start = list(lambda=.01,alpha=325,beta=.8),data = list(y),method = "L-BFGS-B",lower=c(.00001,.00001,.00001),upper = c(Inf, Inf,Inf))
summary(g)

#### Out Put###

Maximum likelihood estimation
Call:
mle2(minuslogl = LL, start = list(lambda = 0.01, alpha = 325,
    beta = 0.8), method = "L-BFGS-B", data = list(y), lower = c(1e-05,
    1e-05, 1e-05), upper = c(Inf, Inf, Inf))
Coefficients:
         Estimate Std. Error    z value     Pr(z)
lambda 3.6926e-03 8.9662e-04 4.1183e+00 3.817e-05 ***
alpha  3.2500e+02 1.1953e-04 2.7191e+06 < 2.2e-16 ***
beta   9.3856e-01 2.0186e-01 4.6496e+00 3.326e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
-2 log L: 218.7464

Now If I change the starting point for theta to be 0.7 I got the following error message:
g=mle2(LL, start = list(lambda=.01,alpha=340,beta=.7),data = list(y),method = "L-BFGS-B",lower=c(.00001,.00001,.00001),upper = c(Inf, Inf,Inf))

Error in optim(par = c(0.01, 325, 0.7), fn = function (p)  :
  L-BFGS-B needs finite values of 'fn'

Problem 2:
If I change the starting point for alpha to be 340 the optimal solution will change too:
g=mle2(LL, start = list(lambda=.01,alpha=340,beta=.8),data = list(y),method = "L-BFGS-B",lower=c(.00001,.00001,.00001),upper = c(Inf, Inf,Inf))
summary(g)

Maximum likelihood estimation

Call:
mle2(minuslogl = LL, start = list(lambda = 0.01, alpha = 340,
    beta = 0.8), method = "L-BFGS-B", data = list(y), lower = c(1e-05,
    1e-05, 1e-05), upper = c(Inf, Inf, Inf))

Coefficients:
         Estimate Std. Error    z value     Pr(z)
lambda 3.7938e-03 9.3580e-04 4.0541e+00 5.034e-05 ***
alpha  3.4000e+02 1.2039e-04 2.8243e+06 < 2.2e-16 ***
beta   9.6164e-01 2.0766e-01 4.6309e+00 3.642e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

-2 log L: 218.7979

Thanks,
Mosab





________________________________

Disclaimer:
This communication is intended for the above named person and is confidential and / or legally privileged. Any opinion(s) expressed in this communication are not necessarily those of KSU (King Saud University). If it has come to you in error you must take no action based upon it, nor must you print it, copy it, forward it, or show it to anyone. Please delete and destroy the e-mail and any attachments and inform the sender immediately. Thank you.
KSU is not responsible for the political, religious, racial or partisan opinion in any correspondence conducted by its domain users. Therefore, any such opinion expressed, whether explicitly or implicitly, in any said correspondence is not to be interpreted as that of KSU.
KSU may monitor all incoming and outgoing e-mails in line with KSU business practice. Although KSU has taken steps to ensure that e-mails and attachments are free from any virus, we advise that, in keeping with best business practice, the recipient must ensure they are actually virus free.

	[[alternative HTML version deleted]]



More information about the R-help mailing list