Dear R list, I am trying to find the MLE of the likelihood function. I will plot the log-likelihood to check my answer.
Here's my R code: xvec <- c(2,5,3,7,-3,-2,0) fn <- function(theta){ sum(0.5 * (xvec - rep(theta, 7)) ^ 2 / 1 + 0.5 * log(1)) } gn <- Vectorize(fn) curve(gn, -5, 20) optimize(gn, c(-5, 20)) $minimum [1] 1.714286 $objective [1] 39.71429 The MLE using optimize() is 1.71, but what curve() gives me is the absolute minimum. I think 1.71 is the right answer, but why does the graph showing it's the minimum? What is going on here? Thank so much! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.