In: Statistics and Probability
a) Find the analytic MLE formula for exponential distribution exp(λ). Show that MLE is the same as MoM estimator here. (b) A random sample of size 6 from the exp(λ) distribution results in observations: 1.636, 0.374, 0.534, 3.015, 0.932, 0.179. Find the MLE on this data set in two ways: by numerical optimization of the likelihood and by the analytic formula. For (b): please give both values from the analytic MLE formula and numerical MLE solution on this data set. Also, please submit the R code for numerically finding the MLE.
## Following is the R code for part (b)
rm(list=ls(all=TRUE))
n <- 6;
data <- c(1.636, 0.374, 0.534, 3.015, 0.932, 0.179);
log_likelihood <- function(lambda){
lik <- n*log(lambda) - lambda*sum(data);
return(-lik);
}
parm <- 1; # initial guess
# finding mle numerically using optim function in r
numerical_mle <- optim(parm, log_likelihood, method="Brent",
lower=0, upper=10)$par
analytic_mle = sum(data)/n; # finding mle analytically
cat("\n Analytic MLE is ", analytic_mle, "\n");
cat("\n Numerical MLE is ", numerical_mle, "\n");