广义正态分布的MLE

时间:2019-03-27 14:13:01

标签: r mle

运行下面给出的代码(广义正态分布的mle)后,我在R中收到警告消息。我的问题是

为什么这些警告来了?我们如何解决这些警告? 我在对象“结果”中的代码可能有点错误?

library(AdequacyModel)

# New generalized exponential

data1 <- rnorm(1000)

Phi<- pnorm
phi<-dnorm

pdf_exps <- function(par,x){
beta = par[1]
gamma= par[2]
mean = par[3]
sd = par[4]
         ( beta*gamma* (1-(1-(Phi(x,mean,sd)))^beta)^(gamma-1) * (1- 
         (Phi(x,mean,sd)))^(beta-1)* phi(x,mean,sd) )
}


 cdf_exps <- function(par,x){
 beta = par[1]
 gamma= par[2]
 mean = par[3]
 sd = par[4]
  ( (1-(1-(Phi(x,mean,sd)))^beta)^gamma )
  }



  result = goodness.fit(pdf = pdf_exps, cdf = cdf_exps,
  starts = c(1,1,1,1),data =data1  , method = "BFGS",
   domain = c(-Inf,Inf), lim_inf = c(0,0,0,0),
   lim_sup = c(2,2,2,2), S = 250, prop=0.1, N=50)
   result$mle

       There were 33 warnings (use warnings() to see them)
       result$mle
       [1]  0.49952916  0.61402586 -0.07688582
       [4]  0.70616246
       warnings()
       Warning messages:
       1: In log(pdf(par, x)) : NaNs produced
       2: In log(pdf(par, x)) : NaNs produced

0 个答案:

没有答案