dCMP: Probabiilty mass function for CMP

Usage Arguments Examples

Usage

1
dCMP(x, lambda, mu, nu, log = TRUE, tol = 0.01, iter.max = 200)

Arguments

x
lambda
mu
nu
log
tol
iter.max

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, lambda, mu, nu, log = TRUE, tol = 0.01, iter.max = 200) 
{
    if (!missing(mu) & !missing(lambda)) 
        stop("'mu' and 'lambda' both specified")
    if (missing(mu) & !missing(lambda)) 
        loglike = x * log(lambda) - nu * lfactorial(x) - compute_CMP_constant(Lambda = lambda, 
            Nu = nu, Mu = NA, Tol = tol, Max = iter.max, Log = TRUE, 
            Type = "Z")
    if (!missing(mu) & missing(lambda)) 
        loglike = nu * x * log(mu) - nu * lfactorial(x) - compute_CMP_constant(Lambda = NA, 
            Nu = nu, Mu = mu, Tol = tol, Max = iter.max, Log = TRUE, 
            Type = "S")
    if (missing(mu) & missing(lambda)) 
        stop("Neither 'mu' or 'lambda' is specified")
    if (log == TRUE) 
        return(loglike)
    if (log == FALSE) 
        return(exp(loglike))
  }

James-Thorson/Conway-Maxwell-Poisson documentation built on May 7, 2019, 10:19 a.m.