I'm trying to get the MLE.
loglike <- function(theta) {
ll <- 14 * log(1 - theta) + 12216 * log(theta)
ll
}
neg.loglike <- function(theta) -loglike(theta)
mle(neg.loglike, start = list(theta = 0.5))
I'm getting the error
Error in optim(start, f, method = method, hessian = TRUE, ...) :
non-finite finite-difference value [1]
In addition: There were 37 warnings (use warnings() to see them)
I usually use the above code, but I found another function:
mle2(neg.loglike, start = list(theta = 0.5))
And it worked. Why isn't the other one working?