Help with simulation and MLE

Hello,
I am trying to plot the MLE estimates and then the density of MLE after simulating MLE function 100 times but has failed miserably. Tried searching for help in other forums but to no avail.
Any help will be grateful.
Code and questions are attached.

draw= rexp(50, rate=2)
fexp = function(theta, x){ prod(dexp(x,rate=(1/theta))) }
res3<-optimize(f=fexp,interval=c(0,50), maximum=T, x= draw)
res3
theta2= seq(0,50, by= 1)
plot(theta2, fexp2(theta2, draw), type = "l")
fexp2 = function(theta, x){ sum(dexp(x,rate=(1/theta))) }
res4<-optimize(f=fexp,interval=c(0,50), maximum=T, x=draw)
res4![IMG-20171107-WA0001|375x500](upload://g5vU98pUpf2Ei6grr4Xwcsfb2gl.jpg)

Hi @tsrockon28 please take a look at the site's homework policy in the FAQs Frequently Asked Questions.

1 Like

not asking for solution of entire problem but i can't figure out specifically how to plot likelihood and log likelihood functions.