我想估计 beta 正态分布的参数。我使用了 maxLik 包
library(VGAM)
library(maxLik)
alfa=2;beta=3;mu=0;sigma=1
n=100
x=rbetanorm(n,alfa,beta,mu,sigma)
logLikFun=function(w){
alfa=w[1]
beta=w[2]
mu=w[3]
sigma=w[4]
ll={-n*log(beta(alfa,beta))+(alfa-1)*sum(log(pnorm((x-mu)/sigma,mean=0,sd=1)))+(beta-1)*sum(log(1-pnorm((x-mu)/sigma,mean=0,sd=1)))-n*log(sigma)+sum(log(dnorm((x-mu)/sigma,mean=0,sd=1)))}
ll
}
mle=maxLik(logLikFun,start=c(alfa=3,beta=2,mu=1,sigma=2))
summary(mle)
但它给出了错误
----------------------------------
Maximum Likelihood estimation
Newton-Raphson maximisation, 4 iterations
Return code 2: successive function values within tolerance limit
Log-Likelihood: -86.16515
4 free parameters
Estimates:
Estimate Std. error t value Pr(> t)
alfa 3.000 Inf 0 1
beta 2.941 Inf 0 1
mu 1.000 Inf 0 1
sigma 2.000 Inf 0 1
--------------------------------------------
问题是错误的无限值是不可接受的。如果有人能解决这个问题,我会很高兴。