R/bellmle.R

Defines functions bell_mle

Documented in bell_mle

#' @export
#' @import lamW
#' @import stats
#' @import numbers
bell_mle <- function(x) {

  n <- length(x)

  sx <- sum(x)
  theta <- lamW::lambertW0(sx/n)


  loglik <- sx*log(theta)+n*(1-exp(theta))+sum(log(sapply(x,numbers::bell)))-sum(lgamma(x + 1))

  list(loglik =loglik, theta = theta)

}

Try the countDM package in your browser

Any scripts or data that you put into this service are public.

countDM documentation built on May 31, 2023, 6:13 p.m.