MLE estimation for Lindley distribution

I'm interested to find mle estimates of lindley distribution in R. But the nlm() command returns me the initial guess. Here is the code

library(stats)
library(stats4)
x1<-mledata$x
ll<-function(theta){
  sum(-(1+x1)-(1-theta[1])*log(1-(1+theta[2]+theta[2]*x1)/1+theta[2])-theta[2]*x1)
}
nlm(ll,theta<-c(1,1))

You should use a reprex for your example, that way you would know that your code as is is not runable. mledata is not defined.

You should include meldata or a toy equivalent so that we can run your code and see the results your are getting.

Here is a pointer to reprex's https://www.tidyverse.org/help/

We really need concrete, run-able examples in a reprex to be able to help you.

If you are having any trouble getting a reprex to work please post a new topic with the issues you are having. You will get a lot of help getting it to work for you.

Thanks

2 Likes