1

优化问题:

    x <- c(1,2,3,4,5,8,4,5)
    y <- c(-2,-5,-3,1,5,3,-17,1)
    alpha0 <- 0.01
    Q <- function(alpha, x, y){

        n <- length(x)
        mu <- sum(x)
        xi <- sum(y)
        L1 <- (alpha-1)*xi-alpha*mu
              -n*log(gamma(alpha))+n*alpha*log(alpha)
        return(-L1)
    }

      Qaf <- nlm(Q, alpha0, x, y, hessian=T)
      Qaf <- nlminb(alpha0, Q, x=x, y=y, hessian=T)
      Qaf <- optim(alpha0, Q, x=x, y=y, hessian=T, method="CG")
      Qaf <- optim(alpha0, Q, x=x, y=y, hessian=T, method="BFGS")
      Qaf <- optim(alpha0, Q, x=x, y=y, hessian=T, method="SANN")
      Qaf <- optim(alpha0, Q, x=x, y=y, hessian=T)

每次优化都会给出不同的参数结果和不同数量的 NaN 警告()。我可以重新参数化参数空间来解决这个问题吗?如何重新参数化参数空间并使用 R 代码解决这个问题?

4

0 回答 0