我想找到以下分布和desnity函数参数的最大似然估计(MLE):
F(x) = 1- exp{-(ax)^b-(cx)^d}
f(x) = (a^b x^{b-1}-c^d x^{d-1})
对于x> 0,a,c> 0,b> 1,且d <1。
我编写了以下用于查找数据集MLE的R代码:
x = c(0.1, 0.2, 1, 1, 1, 1, 1, 2, 3, 6, 7, 11, 12, 18, 18, 18, 18, 18, 21, 32,
36, 40, 45, 46,47, 50, 55, 60, 63, 63, 67, 67, 67,67, 72, 75, 79, 82, 82, 83,
84, 84, 84, 85, 85, 85, 85, 85, 86, 86)
daddweibull = function(t, a, b, c, d){
- (a^b*(t^(b-1))-c^d*(t^(d-1)))*exp(-(a*t)^b-(c*t)^d)
}
AW.LIK.ADD.WEI=function(theta, x){
x = sort(x)
a=theta[1]
b=theta[2]
c=theta[3]
d=theta[4]
n=length(x)
logL = sum(log(daddweibull(x, a, b, c, d)))
return(logL)
}
applyDefault <- function(AW.LIK.ADD.WEI, x=x) {
function(theta) AW.LIK.ADD.WEI(theta, x)
}
constrOptim(c(1e-6, 1.2, 1e-6, 1e-6), applyDefault(AW.LIK.ADD.WEI,
x=x), NULL, ui=rbind(c(1, 0, 0, 0), c(0, 1, 0, 0),
c(0, 0, 1, 0), c(0, 0, 0, -1)), ci=c(0, 1, 0, -1),
control = list(fnscale = -1, abstol=1e-10))
$par
[1] 2.322322e-09 1.311376e+00 2.755276e-03 3.451048e-05
$value
[1] -203.9492
$counts
[1] 0
$convergence
[1] 0
$message
NULL
$outer.iterations
[1] 1
$barrier.value
[1] -0.0001547508
Warning messages:
1: In log(daddweibull(x, a, b, c, d)) : NaNs produced
2: In log(daddweibull(x, a, b, c, d)) : NaNs produced
3: In log(daddweibull(x, a, b, c, d)) : NaNs produced
4: In log(daddweibull(x, a, b, c, d)) : NaNs produced
5: In log(daddweibull(x, a, b, c, d)) : NaNs produced
6: In log(daddweibull(x, a, b, c, d)) : NaNs produced
7: In log(daddweibull(x, a, b, c, d)) : NaNs produced
正如我在一些论文中所看到的,参数估计的结果应该如下:
a ~ 0; b =30:069; c =0.0912, d=0:4996
我该如何解决这个问题?