R/dbellt.r

Defines functions dbellt

Documented in dbellt

#' @export
#' @import stats

dbellt<-function(x, lambda, theta, log = FALSE) {
  if (any(lambda <= 0))
    stop(paste("lambda must be greater than 0"))
  if (any(theta <= 0))
    stop(paste("theta must be greater than 0"))

    TPx <- c()
    for (i in 1:length(x)) {
        TPx[i] <- TP(x[i], theta=theta)
    }

	lf <- x * log(lambda)+ theta * ( -exp(lambda) + 1 ) + log(TPx) - lgamma(x + 1)
    if (log == TRUE) {
        return(lf)
    }
    else {
        return(exp(lf))
    }
}

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.