我尝试了以下代码来估算以下参数:alpha
,beta
,k
,lambda
& p
我建议的发行版。 r代码如下所示。
library('bbmle')
xvec <- c(0.55, 0.93, 1.25, 1.36, 1.49, 1.52, 1.58, 1.61, 1.64, 1.68, 1.73,
1.81, 2,0.74, 1.04, 1.27, 1.39, 1.49, 1.53, 1.59, 1.61, 1.66, 1.68, 1.76,
1.82,2.01, 0.77, 1.11, 1.28, 1.42, 1.5, 1.54, 1.6, 1.62, 1.66, 1.69, 1.76,
1.84, 2.24, 0.81, 1.13, 1.29, 1.48, 1.5, 1.55, 1.61, 1.62, 1.66, 1.7, 1.77,
1.84, 0.84, 1.24, 1.3, 1.48, 1.51, 1.55, 1.61, 1.63, 1.67, 1.7, 1.78, 1.89)
n <- length(xvec)
ln <- function(alpha, beta, k, lambda, p) {
-sum(log(alpha*beta*xvec**(alpha-1) + k*lambda*xvec**(k-1)*(1+xvec**k)**(-1))) + sum(lambda*log(1+xvec**k))-(n*log(1-p)) + beta*sum(xvec**alpha)-2*sum(log(1-p*(exp(-beta*xvec**alpha)/(1+xvec**k)**lambda)))
}
mle2(minuslogl = ln, start = list(alpha = 1, beta = 15, k = 1,
lambda = 0.5, p = 0.4), hessian.opts = TRUE)
summary(mle.result1)
我对参数使用了不同的初始值而没有很好的估计(上面的代码中显示了最后一组)。获得的最后一个解决方案是:
Maximum likelihood estimation
Call:
mle2(minuslogl = ln, start = list(alpha = 1, beta = 15, k = 1,
lambda = 0.5, p = 0.4), hessian.opts = TRUE)
Coefficients:
Estimate Std.Error z value Pr(z)
alpha 0.15002 NA NA NA
beta 15.10368 NA NA NA
k 0.98189 NA NA NA
lambda 0.58166 NA NA NA
p -0.05312 67.82338 -8e-04 0.9994
-2 log L: -1.229098e-06
Warning message:
In sqrt(diag(object@vcov)) : NaNs produced
拜托,我哪里出错了?谢谢。